Vous êtes sur la page 1sur 50

PGDCA Semester 1

Assignment set 1

Book ID: B0678


1. Explain the following operators with an example for each:

a. conditional operators The conditional operators ? and : are sometimes called ternary operators since they are neither unary or binary and take three operands. In fact they form a kind of if-then-else. The general syntax is, expression 1 ? expression 2 : expression 3 The meaning is, if expression 1 is true (if value is non-zero) then the returned value will be expression 2, otherwise the returned value will be expression 3. It's not mandatory that the conditional operator must be used only with arithmetic statements, and they can also be nested in some operations. Example: average = (n > 0) ? sum / n : 0 can also be written as if(n > 0) average = sum / n; else average = 0; b. bitwise operators The bitwise operators are mostly used in programming for interacting with the hardware, but also for manipulating date at the bit level. So they work only with string of 0's and 1's. Bitwise operators only work on a limited number of types: int and char. Bitwise operators fall into two categories: binary bitwise operators and unary bitwise operators. Binary operators take two operands, while unary operators only take one. The operators are: & bitwise AND ^ bitwise exclusive OR << shift left | bitwise OR ~ one's complement >> shift right

Truth Table for logical Bitwise Operations


Operand 1 x 1 1 0 0 Operand 2 y 1 0 1 0 X&y 1 0 0 0 X|y 1 1 1 0 X^y 0 1 1 0

Bitwise complement OR operator is represented by a tilde (~) and is also known as one's complement operator. It inverts all the bits. Thus all the zeros becomes 1 and all the one's become 0. Sikkim Manipal University Page 1

PGDCA Semester 1

Assignment set 1

Bitwise shift operator s are used to push the bit patterns to the right or left by the number of bits given by their right operand. Syntax: Expression >> n (where n is the number of bits to be shifted)

Example: #include<stdio.h> main() { int x,y,w=-1; printf(\n Enter two integers: ); scanf(%d %d,&x,&y); printf(\n w= %d One's compliment= ~w = %d \n,w,~w); printf(x & y = %d,x&y); printf(x | y = %d,x|y); printf(x^y = %d,x^y); printf(x << 2 = %d,x<<2); printf(x>>2 = %d,x>>2); getch(); return; } Output: Enter two integers 24 9 w = -1 One's compliment= ~W= 0 x&y=8 x | y = 25 x ^ y = 17 x << 2 = 96 x >> 2 = 6

c. gets() and puts() functions These functions are considered as input/output functions, since they allow to transfer information between the computer and the peripherals devices. gets() function is used to get data from the user. It gets an entire string of characters and stores them in a set of consecutive memory locations called array. The string of characters is passed into the function as a single argument. So basically this function allows the interaction between the user an the running program, since value is entered using keyboard and accepted when return key is pressed. If there was no error in the input process, it returns the same string (as a return value, which may be discarded); otherwise, if there was an error, it returns a null pointer. Sikkim Manipal University Page 2

PGDCA Semester 1

Assignment set 1

puts() function is used to display a string of character to the output device. puts() function can be considered as a simplified version of the printf() function. But unlike printf it doesn't requires any formating case like quotes "" and it always displays the newline character at the end of its output. The usage of these functions requires the header file stdio.h. Example: #include<stdio.h> main( ) { char name[30] ; printf ( "Enter your name\n" ) ; gets ( name ) ; puts ( "Welcome ....."); puts ( name ) ; getch(); }

2.

Explain the following with a programming example for each

a. Array of structures Arrays are generally used to represent a set of homogenous data items. However arrays cannot be used to represent a collection of items of differents data types. Therefore structures are a facility that permit several data items to be grouped together and treated as single unit. In the array of structures, structures a generally used to describe a set of logically related variables. For example a structure called stdent can be used to store informations regarding ID, name and marks obtained in various subject by a given student. However when the same set of information has to be stored for a whole class of students, then an array of shuch stucture need to created. Example: #include<stdio.h> struct stden { char name[25]; int mark1; int mark2; int mark3; int total; }; main() { Sikkim Manipal University Page 3

PGDCA Semester 1

Assignment set 1

struct stden stud[3]; int i; printf(\n Enter Name and Marks in 3 subjects: \n); for(i=0;i<3;i++) { scanf(%s%d%d %d,stud[i].name,&stud[i].mark1,&stud[i].mark2,&stud[i].mark3); stud[i].total=stud[i].mark1+stud[i].mark2+stud[i].mark3; } printf(\n Name \t Total Marks); for(i=0;i<3;i++) printf(\n %s \t %d,stud[i].name,stud[i].total); return; } Output: Enter Name, Marks in 3 subjects: NAVEEN 35 55 60 UMESH 42 58 40 DIVYA 75 50 55 Name NAVEEN UMESH DIVYA Total Marks 150 140 180

b. Unions A Union can be defined as a variable typed by the keyword union, which may hold at different times, objects of diferrents types and sizes. Union provides a way to manipulates differents kinds of data in a single variable, wich can hold anyone of the several types defined. The general syntax is : Union tag { type member type member type member . . . type member };
//tag is a name that identifies union of this type

1; 2; 3;

n;

Sikkim Manipal University

Page 4

PGDCA Semester 1

Assignment set 1

Unions are useful for applications involving multiple members, where values needed to be assigned to all the members at any instant. Each member of the union is stored in the same address. The compiler allocates a piece of storage large enough to hold the largest variable type in the union. Therefore union helps to make an efficient usage of memory. Example: #include<stdio.h> main() { union box { int num; char ch[2]; }; union box key; key.num=512; printf(\n key.num = %d,key.num); printf(\n key.ch[0] = %d,key.ch[0]); printf(\n key.ch[1] = %d,key.ch[1]); } Output: key.num = 512 key.ch[0] = 0 key.ch[1] = 2 In this example the union occupies only 2 bytes of memory. key.ch[0] and key.ch[1] are using the same memory location used by key.num

3. Write a program demonstrating the usage of pointers with one dimensional and two dimensional arrays. #include<stdio.h> #include<conio.h> Void main () { Int a[10]; Int i; For (i = 0; i < 10; i++); Scanf (%d, &a[i]); For (i = 0; i < 10; i ++) Printf (I = %d, a[i] = %d; *(a + i) = %d, &a[i] = %u, a + i = %u, i, a[i], *(a + i), &a[i], a +i); getch(); } Sikkim Manipal University Page 5

PGDCA Semester 1

Assignment set 1

4. Describe the following with suitable programming examples: a) Input/output operations on files: For each of the I/O library functions used in C programming, there is a companion function which accepts an additional file pointer argument telling it where to read from and write to. In case of printf, companion function is fprintf and the file pointer argument comes first. To print a string to the output.dat file, a function like fprintf (Hello); can be called. For getchar, the companion function is getc where the file pointer is its only argument. To read a character from an input.dat file, int c; c = getc (ifp); may be called. Similarly, putc is the companion to putchar and file pointer argument comes last. Example: Writing a data to the file #include<stdio.h> Void main () { FILE *fp; Char stuff [25]; Int index; Fp =fopen (TENLINES.TXT,w); Strcpy (stuff, This is example line.); For (index = 1; index <= 0; index ++); Fprintf (fp, %s Line Number %d, stuff, index); Fclose (fp); } b) Predefined Streams Basically there are 3 pre-defined streams besides existing file pointers (called by fopen). A file pointer corresponding to standard input is stdin while stdout is the file pointer corresponding to standard output. They can be used anywhere a file pointer is called. The third predefined stream is stderr connected to the screen by default. When standard output is redirected, stderr is not redirected. In case of UNIX or MSDOS, program > filename invocation ensures that anything printed to stdout is redirected to the file but anything printed to stderr still goes to the screen. The intention behind stderr is that it is the standard error output error messages printed to it will not disappear into an output file. Example: To read a data file input.dat consisting of rows and columns of numbers #define MAXLINE 100 #define MAXROWS 10 Sikkim Manipal University Page 6

PGDCA Semester 1 #define MAXCOLS 10 #include<stdio.h> #include<conio.h> { Int array [MAXROWS][MAXCOLS]; Char *filename = input.dat; FILE *ifp; Char line [MAXLINE]; Int nrows = 0; Int n; Int t; Ifp = fopen (filename, r); If (ifp == NULL) { Fprintf (stderr, cant open %s, filename); Exit (EXIT_FAILURE); } While (fgetline (ifp, line, MAXLINE) ! = EOF) { If (nrows >= MAXROWS) { Fprintf (stderr, too many rows); Exit (EXIT_FAILURE); } N = getwords (line, words, MAXCOLS); For (I = 0; I < n; I ++) Array [nrows][i] = atoi (words [i]); Nrows ++; } }

Assignment set 1

c) Error handling during I/O operations The standard I/O functions maintain two indicators in each open stream to show the end-of-file and error status of the stream. These can be interrogated and set by the following functions namely:

otherwise). . Ferror (returns non-zero if the streams error indicator is set, zero otherwise) and . Perror (prints a single-line error message on the programs standard output) prefixed by a string pointed to bys with a colon and a space appended. The error message is determined by the value of the error and is Sikkim Manipal University Page 7

. Clearer (clears the error and EOF indicators for the stream). . Feof (returns non-zero if the streams EOF indicator is set, zero

PGDCA Semester 1

Assignment set 1

intended to give some explanation of the condition causing the error. Example: Printing an error message Bad File Number #include<stdio.h> #include<stdlib.h> #include<conio.h> Void main () { Fclose (stdout); If (fgetc (stdout) > = 0) { Fprintf (stderr, What No Error!); Exit (EXIT_FAILURE); } Perror (fgetc); Exit (EXIT_SUCCESS); } d) Random access to files Random access means we can move to any part of a file and read or write data from it without having to read through the entire file. we can access the data stored in the file in two ways: Sequentially or randomly The random A read followed by a write followed by a read (if permitted) will cause the 2nd read to start immediately following the end of the data just written. For controlling this, the Random Access functions allow control over the implied read/write position in the file. The file position indicator is moved without the need for a read or a write and indicates the byte to be the subject of the next operation on the file. Three types of function exist which allow the file position indicator to be examined or changed. They are: i) Ftell: This function return the current position of the file position pointer. The value is counted from the beginning of the file.Returns the current value measured in characters of the file position indicator if the stream refers to a binary file. For a text file, a magic number is returned which may only be used on a subsequent call to fseek to reposition to the current file position indicator. So it gives the current position in the file On failure, -1L is returned and errno is set. ii) Rewind: It sets the current file position indicator to the start of the file indicated by the stream. The files error indicator is reset by a call of rewind. No value is returned. iii) Fseek: This function is used to move the file position to a desired location within the file. Its purpose is to change the file position indicator for the specified stream. Fileptris a pointer to the file concerned. Offset is a Sikkim Manipal University Page 8

PGDCA Semester 1

Assignment set 1

number or variable of type long, and position in an integer number. Offset specifies the number of positions (bytes) to be moved from the location specified bt the position. The position can take the 3 values: 0,1 or 2 General format is: fseek(file pointer,offset, position); Example: #include<stdio.h> #include<conio.h> #include<stdlib.h> struct emprecord { char name[30]; int age; float sal; }emp; void main() { int n; FILE *fp; fp=fopen("employee.dat","rb"); if (fp==NULL) { printf("/n error in opening file"); exit(1); } printf("enter the record no to be read"); scanf("%d",&n); printf(Use of FSEEK); fseek(fp,(n-1)*sizeof(emp),0); freed(&emp,sizeof(emp),1,fp); printf("%s\t,emp.name); printf("%d\t",emp.age); printf("%f\n",emp.sal); printf(Use of FTELL); printf("position pointer in the beginning -> %1d ",ftell(fp)); while("fread(position pointer -> 1%d\n",ftell(fp)); printf("position pointer -> %1d\n",ftell(fp)); printf("%s\t",emp.name); printf("%d\t",emp.age); printf("%f",emp.sal); } printf("size of the file in bytes is %1d\n",ftell(fp)); fclose(fp); getch();
};

Sikkim Manipal University

Page 9

PGDCA Semester 1 Book ID: B0680 1. Describe the following:

Assignment set 1

a. Binary Number system The binary number system is used in digital systems.It has only two digits 0 and 1. Therefore it's radix base is 2. So this number system allows to work at the bit level of data. However Bit is an abbreviation for binary digits, thus each of the binary digits 0 and 1 are called bits. A binary number is a weighted number. The right most bit is the least significant bit (LSB) and has a weight of 20=1 . The weight increase from right to left by a power of two for each bit. The left most bit is the Most Significant Bit (MSB) and it's weight depands on the size of the binary number. If there are 'n' bits, then weight of MSB will be 2n-1. Fractional numbers can also be represented in binary by placing bits to the right of the binary point. The left most bit in the frational number has a weight of 2-1 =0.5. The fractional weights decrases from left to right by a negative power of two for each bit. Weight structure of binary number: 2n-1 . . . 23 22 21 20 . 2-1 2-2 . . . 2-n Example: 1101101(2) = 109(10) 0.011(2) = 0.375(10) 101.11(2) is a binary number where 2 is the base within the parenthesis. This number can be represented as a weighted sum. So 110.11(2) = 1*22+1*21+0*20+1*2-1+1*2-2

b. Octal number system The octal number system consists of eight digits 0 to 7. The base radix of this system is 8 as eight different numbers can occur in each position of the number. It provides a convenient way to express binary numbers and codes. with 0 having the least value and seven having the greatest value. Columns are used in the same way as in the decimal system, in that the left most column is used to represent the greatest value. Octal number can be obtained by making a successive division by 8 of a decimal number. Each resulting quotient is divided by 8 until there is a '0' whole number quotient. The remainders generated by each division form a whole octal number. The first raminder produced is the least significant Digit (LSD) in the binary number and the last remainder to be produced is the Most Significant Digit (MSD). Weight structure of octal number: 8n-1 . . . 83 82 81 80 . 8-1 8-2 . . . 8-n Example: 3146.52(8) = 1638.6562(10) 510.26(8) is an octal number where 8 is the base within the parenthesis. This number can be represented as a weighted sum. Sikkim Manipal University Page 10

PGDCA Semester 1 So 710.16(8) = 5*82+1*81+0*80+2*8-1+6*8-2

Assignment set 1

c. Hexadecimal number system Numbers in hexadecimal system are generally used in computers and microprocessors. They are much shorter than binary numbers as four binary digits can be represented by a single hexadecimal digit. They can easily be converted to binary whenever necessary. Hexadecimal number system has a base (radix) of 16. It is composed of numbers 0 to 9 and alphabets A to F, whose values range from 10 to 15 respectively. Mostly digital systems process binary data in groups that are multiplies of four bits, making the hexadecimal representation very convenient as each group of four bits can be represented by one hexadecimal digit. Hexadecimal number can be obtained by making a successive division by 16 of a decimal number. Weight structure of hexadecimal number: 16n-1 . . . 163 162 161 160 . 16-1 16-2 16-3 . . . 16-n Example: 1B62.F53 (16) is a hexadecimal number where 16 is the base within the parenthesis.

2.

Describe the Canonical Logical Forms

a) Sum of Products Form: In Boolean algebra the product of two variables can be represented with AND function and the sum of any two variables can be represented with OR function. Therefore AND and OR functions are defined with two or more input gate circuitries. Sum of Products (SOP) expressions is two or more AND and OR functions expressed together. The AND terms are known as miniterms. A popular method of representation of SOP form is with miniterms. Since the miniterms are OR functions, a summation notation with the prefix m is used to indicate SOP. If n is number of variables used then the miniterms are noted with a numeric representation starting from 0 to 2n. SOP is a useful form as it can be implemented easily with logic gates. Such implementations are always 2-level gate network meaning a signal will pass from a maximum of 2 gates from the input to the output. Example:

f = abc + abc + abc + abc

In the above case, the function f has 4 miniterms. Each miniterms has 3 variables. Hence the miniterms can be represented with the associated 3-bit representation. Representation of miniterms with 3-bit binary and equivalent decimal number can be noted. Sikkim Manipal University Page 11

PGDCA Semester 1 Hence abc = 101 = 7.


(2)

Assignment set 1 = 5, abc = 011


(2)

= 3, abc = 110

(2)

= 6 and abc = 111

(2)

Therefore f = (3,5,7,6)
m

b) Product of Sums Form Product of Sum (POS) expression is the AND representation of two or more OR functions The OR terms are known as maxterms. POS is also useful as it can be implemented easily with logic gates. Such implementations are always 2-level gate network meaning a signal will pass from a maximum of 2 gates from the input to the output. Similar to SOP, a popular method of representation of POS form is with maxterms. Since the maxterms are ANDed a product notation with the prefix M is used. If n is number of variables used then the maxterms are noted with a numeric representation starting from 0 to 2n. Example: f = (a+b+c) (a+b+c) (a+b+c). There are 4 maxterms containing 3 variables each. Hence the maxterms can be represented with the associated 3-bit representation. Representation of maxterms with 3-bit binary and equivalent decimal number can be noted. Hence (a+b+c) = 010 (2) = 2, (a+b+c) = 001 (2) = 1, (a+b+c) = 100 (2) = 4. Hence f = (2, 1, 4) M 3. Explain examples. the universal NAND and NOR gates with suitable

The concept of the universal gate is that the given gate should be able to generate all the basic gate functions/logics (AND, NOT and OR). NAND and NOR gates are universal as they can realize all basic gates. They are explained below with suitable examples. a) NOT realization using NAND: A two input NAND is used with both input terminals supplied with the same input function. Here f = a.a = a.

Sikkim Manipal University

Page 12

PGDCA Semester 1 b) AND realization using NAND: f = a.b = a.b aa

Assignment set 1

ff

b b

c) OR realization using NAND: f = a.b = a + b = a + b


a f

d) NOT realization using NOR: f = a + a = a.

Sikkim Manipal University

Page 13

PGDCA Semester 1

Assignment set 1

e) AND realization using NOR: f = a + b = a.b = a.b

f) OR realization using NOR: f = a + b = a + b.


a

Book ID: B0684 4. Describe the following with appropriate block diagrams

a) Control Unit: This is the portion of the processor that actually causes things to happen. It controls the system operations by routing the selected data items to the selected processing hardware at the right time. Its a nerve center for other units. It decodes and translates the instructions and generates the necessary signals for other units. Sikkim Manipal University Page 14

PGDCA Semester 1

Assignment set 1

This unit a) interprets instructions and b) sequences the instructions. In instruction interpretation, the unit reads instructions from the memory and recognizes the instruction type, gets necessary operand and sends them to correct functional unit. Signal needed to perform desired operation is taken to processing unit and results are sent to the correct section. In instruction sequencing, it determines the address of the next instruction to be executed and loads it into program counter. Control circuits govern the transfer of signals and data transfer from processor to memory. b) Bus Structure: A bus contains 1 or more wires. Computers have several buses connecting different units. The size of the bus is the number of wires in the bus. Individual wires or groups of wires can be represented by subscripts. A bus can be drawn as a line with a dash across it to indicate if there is more than one wire. The dash is labeled with number of wires and designation of those wires. A bus allows any number of devices to hook up with it. Devices share the bus. Only one device can use it at a time. Most devices have a certain number of connections and do not permit dedicated connections to other devices. A bus doesnt have this problem. A bus diagram is presented below. A slant slash goes across a horizontal line meaning more than 1 wire. The slant dash is labeled 32 meaning there are 32 wires and A31-0 signifies individual 32 wires from A0 to A31.
32

Bu s A31-0

c) Von Neumann Architecture This architecture is based on three key concepts: Data and instructions are stored in a single read-write memory. The content of this memory is addressable by location, without regard to the type of data contained there. Execution occurs in a sequential fashion unless explicitly modified from one instruction to the next.

Sikkim Manipal University

Page 15

PGDCA Semester 1 The Von-Neumann architecture consists of

Assignment set 1

A main memory which stores instructions and data. An arithmetic logic unit (ALU) capable of operating on binary data. A control unit which interprets the instructions in memory and causes them to be executed. Input and Output (I/O) equipment operated by the control unit.

Representation based on Von-Neumann architecture

Arithmetic Logic Unit (ALU)

Main Memory
Program Control Unit (CU)

I/O Devices

5. Discuss the different types of Addressing Modes with suitable examples The different types of addressing modes are as follows: Direct Addressing Mode: Here EA (effective or actual address of the location containing the referenced operand) = A (contents of an address field in the instruction) meaning address field contains address of the operand. Example: ADD A means add contents of cell A to accumulator. Look in memory at address A for operand. Memory is referred to once for accessing data.

Sikkim Manipal University

Page 16

PGDCA Semester 1

Assignment set 1

Immediate Addressing Mode: The operand is actually present in the instruction. The operand can be used to define and use constants and set initial values. The operand is part of the instruction and is same as the address field. Example: ADD 5 means add 5 to the contents of the accumulator where 5 is the operand. Memory is not referred to fetch data. Indirect Addressing Mode: Here the memory cell is pointed to by the address field. It contains the address of the operand. Here EA = A. Hence the processor will look at A, find address (A) and look there for operand. Example: ADD A means add contents of cell pointed to by contents of A to accumulator. The address space is large (equal to 2n where n is word length). Memory is accessed multiple times to find the operand. Register Addressing Mode: Here the operand is held in the register named in the address field. EA = R. Here very small address fields are needed; shorter instructions needed and they are fetched faster; memory access is not required. It requires good assembly programming. Example: In C programming say register int a. The operand a is held in the register named in the address field. Register Indirect Addressing Mode: Here EA = R. the operand is in the memory cell pointed to by contents of register R. The address space is large (equal to 2n). Needs fewer memories access than indirect addressing mode. This is same as indirect addressing mode. Displacement addressing mode: Here EA = A + R. The address field holds two values namely A (base value) and R (register that holds displacement) or vice versa. Relative addressing mode: its a version of displacement addressing where R = PC (program counter). EA = A + PC meaning operand A is obtained from the current location pointed to by PC. Base-Register addressing mode: A holds displacement and R holds pointer to base address. R may be implicit or explicit. Segment registers in 80*86 are examples. Indexing: EA = A + R where A is base value and R is the displacement. This mode is good for accessing arrays. Hence EA = A + R and then R++. Stack Addressing: The operand is implicitly on top of the stack. ADD means pop two items from stack and add. Auto increment mode: This mode is useful for accessing data items in Page 17

Sikkim Manipal University

PGDCA Semester 1

Assignment set 1

successive locations in the memory. The EA of the operand is the contents of a register specified in the instruction. After accessing the operand, the contents of this register are automatically incremented to point to the next item in a list. This is denoted by putting specified register in a parenthesis to show the register content being used as EA followed by a plus sign indicating that the same are to be incremented after the operand is accessed. Hence this mode is written as (Ri) +.

6. Describe the following: a) Programmed I/O: When the CPU is executing a program and encounters an instruction to I/O; it executes the former by issuing a command to the appropriate I/O module. With this technique, the I/O module will perform the requested action and then set appropriate bits in the status register. The I/O module does not take any further action to alert the CPU. It doesnt interrupt the CPU. Hence the CPU periodically checks the status of the I/O module until it finds that operation is complete. The sequence of actions taking place here is: CPU requests I/O operation. I/O module performs operation. I/O module sets status bits. CPU checks status bits periodically. I/O module doesnt inform CPU directly. I/O module doesnt interrupt CPU. CPU may wait or come back later.

b) Interrupt Driven I/O: In this process the CPU issues an I/O command to the I/O module which then interrupts the CPU when its ready to exchange data with the latter. Then CPU executes data transfer and resumes its former processing. Hence CPU doesnt need to check on the I/O module and it saves time. Interrupts enable transfer of control from program to program to be initiated by an event that is external to the computer. Execution of interrupted program resumes post completion of execution of interrupted service routine. This concept is useful in operating systems and in many control applications where processing of certain routine has to be accurately timed relative to external events. The sequence of actions is as follows: CPU issues read command. I/O module gets data from peripherals while CPU does other work. I/O module interrupts CPU. CPU checks status and if no errors are present, requests data Sikkim Manipal University Page 18

PGDCA Semester 1 I/O module transfers data. CPU reads data and stores in main memory.

Assignment set 1

Book ID: B0676

Sikkim Manipal University

Page 19

PGDCA Semester 1

Assignment set 1

1. A computer company wants to hire 25 programmers to handle systems programming and 40 programmers for applications programming. Of those hired, ten will be expected to perform jobs of both types. How many programmers must be hired? Solution: Here 25 programmers can work on systems while 40 can work only on applications programming. Of the hired programmers, 10 will do both types of work. Let's consider If A = {25} and B = {40}, then as per the problem C = AB = {10}. Hence the number of programmers need to be hired = (A + B) (AB) = (25 + 40) 10 = 55. Therefore total number of programmers = 55

2. If A = {1, 2, 3}, B= {2, 4, 5} find (a) (AB) (AB) AB = {2} AB = {1, 3} Hence (AB) (AB) = {2} {1, 3} = {(2, 1), (2, 3)}. (b) A (AB) A = {1, 2, 3} AB = {1, 3} Hence A (AB) = {1, 2, 3} {1, 3} = {(1, 1), (1, 3), (2, 1), (2, 3), (3, 1), (3, 3)}.

3. Prove that the set of real numbers is an Abelian group with respect to Multiplication. Let R be a set of real numbers such that a, b R. The word Abelian means commutative. If we can prove that regarding multiplication R obeys closed, associative, identity and inverse properties, R can be termed as Abelian. In order to prove this we have to consider R as a set of real numbers where R = R {0}. Closed: Let a and b be two elements such that a, b R. Let it be such that a * b = c. if a = 5 and b = 6, then c = 30 which is real. If a = - 6 and b = 7, c = -42 which is also a real number. Hence for all a and b belonging to R, we can say that c R. Hence R is closed w.r.t multiplication. Sikkim Manipal University Page 20

PGDCA Semester 1

Assignment set 1

Associative: Let a, b and c R. Let it be such that a * (b * c) = (a * b) * c. if a = 5, b = 6 and c = 2, d = 5 * (6 * 2) = 60 = (5 * 6) * 2. If a = -5, b = 6 and c = -3, then d = -5 * (6 * -2) = 60 = (-5 * 6) * (-2). Hence for all a, b, c belonging to R, associative property is satisfied. Identity: The property suggests that a * e = a. In this case e = 1 where e is known as identity. Also e * a = a implies e = 1. Again 1 is a real number belonging to R. Hence R satisfies identity property. Inverse: This property says that a * a = e meaning a * a = 1. Hence a R. Now a-1 is 1/a. If a is not equal to zero (0), then 1/a is also a real number. Hence 1/a R meaning that inverse property is satisfied. Since R satisfies all four properties, R is an Abelian group with respect to multiplication.

Book ID: B0677 4. Prove that a given connected graph G is Euler graph if and only if all vertices of G are of even degree. Proof: Lets assume that G is an Euler graph meaning G contains an Euler line. Hence a closed walk exists running through all the edges of G exactly once. Let v V be a vertex of G. tracing the walk sees it going through two incident edges on v with one entered v and the other exited.
V

This is true for intermediate vertices of the walk and terminal vertex because we exited and entered at the same vertex at the beginning and ending of the walk. Therefore if v occurs k times in the Euler line then d (v) = 2k. Thus if G is an Euler graph, then the degree of each vertex is even. Converse: Suppose all the vertices of G are of an even degree. We have to construct a closed walk starting at an arbitrary vertex v and running through all the edges of G exactly once. To find a closed walk, lets start from the vertex v. Since every vertex is of even degree, we can exit from every vertex we entered. The tracing cannot stop at any vertex but at v. Since v is also of even degree, we shall eventually reach v when the tracing comes to an end. If this closed walk (say h) includes all the edges of G, then G is an Euler graph. Suppose the closed walk h doesnt include all the edges. Sikkim Manipal University Page 21

PGDCA Semester 1

Assignment set 1

Then the remaining edges form a subgraph h1 of G. Since G and h have their vertices of an even degree, the degree of the vertices of h1 is also even. Moreover h1 must touch at least one vertex a because G is connected. Starting from a we can again construct a new walk in graph h1. Since all the vertices of h1 are of even degree and this walk h1 must terminate at vertex a this walk h1 combined with h forms a new walk which starts and ends at vertex v and has more edges than those are in h. This process is repeated until we obtain a closed walk travelling through all the edges of G. in this way we can get an Euler line. Thus G is an Euler graph.

5. Prove that a connected planar graph with n vertices and e edges has e n + 2 regions. Let G be a connected graph where n, e and f are the number of vertices, edges and faces (or regions) respectively. Then we need to prove that n - e + f = 2 or f = e - n + 2 Proof: (Using mathematical induction on the number of faces f). Part i): Suppose f = 1. Then G has only one region. If G contains a cycle, then itll have at last two faces which is a contradiction. Hence G has no cycles. Since G is connected, we have that G is a tree. In a tree, we know that n = e + 1. So e n + 2 = e (e + 1) + 2 = 1 = f. Hence the statement is true for f = 1. Part ii) Induction hypothesis: Suppose f>1 and the theorem is true for all connected planar graphs with the number of faces less than f. Since f>1, G isnt a tree as a tree contains only one infinite region. Then G has an edge k which is not a bridge (since G is a tree and only if every edge of G is a bridge).
K F1

F2

Graph G with 4 faces

Graph G k with 3 faces

So the subgraph G k is still connected. Since any subgraph of a plane Sikkim Manipal University Page 22

PGDCA Semester 1

Assignment set 1

graph is also a plane graph, we have that G k is also a plane graph. Since k is not a bridge, we have that k is a part of a cycle (since an edge e of G is a bridge if and only if e is not a part of any cycle in G). So it separates two faces F1 and F2 of G from each other. Hence in G k, these two faces F1 and F2 combined to form one face of G k. we can observe this fact in above graphs. Let n (G k), e (G k) and f (G k) denote number of vertices, edges and faces of G k respectively. Now we have n (G k) = n, e (G k) = e 1 and f (G k) = f 1. By our induction hypothesis, we have that n(G k) e(G - k) + f(G k) = 2 or n (e -1) + (f-1)=2 or n - e + f = 2 implying f = e - n +2 Hence by mathematical induction e conclude that the statement is true for all connected planar graphs.

6. Find the values of the Boolean function Let's build the truth table for the given function x 0 0 0 0 1 1 1 1 y 0 0 1 1 0 0 1 1 z 0 1 0 1 0 1 0 1 x 1 1 1 1 0 0 0 0 y 1 1 0 0 1 1 0 0 z 1 0 1 0 1 0 1 0

f =( x y ' ) z '

( x y )

'

f =( x y ) z

'

'

0 0 0 0 1 1 1 1

1 0 1 0 1 1 1 1

Book ID: B0703

Sikkim Manipal University

Page 23

PGDCA Semester 1 1. Describe the following:

Assignment set 1

a. Internet technologies As internet is becoming more and more integrated to every people life, various technologies are created to make internet more reliable, capable of offering new services, and applications of quality everyday. So there are many technologies available like: - VOIP stands for Voice Over Internet Protocol (also called IP Telephony, Internet telephony, and Digital Phone). VoIP is basically a telephone connection over the Internet. The data is sent digitally, using the Internet Protocol (IP) instead of analogue telephone lines. This allows people to talk to one another long-distance and around the world without having to pay long distance or international phone charges. Technically speaking VOIP is the routing of voice conversations over the Internet or any other IP-based network. In order to use VoIP, you need a computer, an Internet connection, and VoIP software. You also need either a microphone, analog telephone adapter, or VoIP telephone. The largest provider of VoIP services is Vonage, but there are several other companies that offer similar services. While Vonage charges a monthly service fee, programs like Skype and PeerMe allow users to connect to each other and talk for free. - Flash technology is mainly present on internet and its related applications. So the word Flash on internet refers mainly to Adobe flash, which is a multimedia technology. Flash allows Web developers to incorporate animations and interactive content into their websites. This technology was basically an animation tool and an optional plug-in for Web browsers, but now it has become a standard plug-in over internet that every web browser need. It supports bidirectional streaming of audio and video, and it can capture user input via mouse, keyboard, microphone, and camera. Flash contains an object-oriented language called ActionScript and supports automation via the Javascript Flash language (JSFL). This technology is so revolutionary that it has enabled video distribution platforms such as youtube to be leaders in their field, by the method of compressing multimedia contents, so it has a low size and can be downloaded faster by the user. To view Flash content in your Web browser, the Flash plugin must be installed. While Flash is automatically installed with most browsers today, some animations may require an updated version of Flash to run. - Wireless Technology is actually one of the most innovative technology brought with the usage of internet. With now the constant increasing number of people using internet service such as mail, telephony, multimedia contents the wireless technology makes this all easy to use for clients. Technically speaking wireless medium is an unguided form of transmission medium. Signals are transmitted through air and space using radio and satellite networks. Satellite communication network transmit and Sikkim Manipal University Page 24

PGDCA Semester 1

Assignment set 1

receive signals between earth base stations and satellites located in space. An access point device is needed to establish the connection. So it connects both wire and wireless networks. Wireless transmission involves the use of technologies such as bluetooth, infrared, lasers, radio signals and microwave technologies. Lasers, microwaves, bluetooth are used mainly in LAN environment whereas microwaves and other radio frequencies are used to connect vast geographical locations. Mobile communication, which involves wireless communication of data, allows users to do their work at any location. Users can do their job using bluetooth or radio frequencies with help of devices such as cell phones, handled PCs, notebooks and require sometimes internal or external wireless network adapter connected to USB or serial port. - Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. Java is a general-purpose, concurrent, class-based, object-oriented language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere.", meaning that code that runs on Windows does not need to be edited to run on a Mac. Java is currently one of the most popular programming languages in use, particularly for client-server web applications. The syntax of Java is much like that of C/C++, but it is object-oriented and structured around "classes" instead of functions. Java can also be used for programming applets -- small programs that can be embedded in Web sites. The language is becoming increasingly popular among both Web and software developers since it is efficient and easy-to-use. Java is developed specifically for network-heavy environment such as internet and enterprise Intranet, it is a major part of the informations infrastructure being developed all over the world. Like the C++ language (on which it is based) Java is object oriented: meaning its programs are built with 'modules' of code which can be employed in building new programs without rewriting the same code. However (unlike C++) it is an interpreted language and therefore has longer execution time than the compiled languages, although the gap has considerably narrowed over the last few years. b. Networks A network can be defined as a collection of computers connected to each others through a cable or a media. Basically it allows the computers to communicate to each others and share resources which can be informations, software and peripheral devices such as printers, scanners. Computer network can be wired or wireless. Networks can be categorized as per the geographical area covered by the network. So it includes Local Sikkim Manipal University Page 25

PGDCA Semester 1

Assignment set 1 Area

Area Network (LAN), Campus Area Network (CAN), Metropolitan Network (MAN) and wide Area Network (WAN).

- Point-to-Point Network: It consists of many connections between individual pairs of machines. A circuit connects two nodes directly without intermediate nodes. P packet going from source to destination may have to go through an intermediate node. As a rule, large networks use this network but there are exceptions. - LAN is a computer network that span over a small area. It connects computers and workstations to share data and resources such as printers, faxes. LAN is restricted to small area like school, office,home. It covers a local area of 1 Km. - CAN is a computer network which is made up of two or more LANs within a limited area. It can cover many buildings in a area. The main feature of a CAN is that all the computers which are connected have some relationship to each other. For example, different buildings in a campus can be connected using CAN. CAN is larger than a LAN but smaller than WAN. Wire, wireless or some other technology can be used to connect these computers. Generally it covers privately owned campus with an area of 5 to 10 Km. - MAN is the interconnection of networks in a city. Generally MAN is not owned by a single organisation. It acts as a high speed network to allow sharing resources within a city. MAN can also be formed by connecting remote LANs through telephone lines or radio links. This type of network support data and voice transmission. It covers area of 2 to 100 Km. - WAN covers a wide geographical area which includes multiple computers or LANs. It connects computers though computer network, like telephone system, microwave or satellite link or lease lines. Most of the WAN use leases lines for internet access as they provides faster data transfer. So it enables communication between a organisation and the rest of the world, since it span large area more than 100km. c. Media Access Control There are two access methods used by the network determined by NIC. Ethernet, the most popular LAN technology which strikes a good balance between speed, price and ease of installation. Its speeds varies from 10 million bits/second or 100 million bits/second. The advanced version ethernet is known as Fast Ethernet. It employs CSMACD using all nodes which listen to the traffic on the network and try to send data only when its quiet. If two nodes transmit data at same time, collisions are detected and the nodes go quiet and try to re-send the same, this to avoid collision. This can be configured in either a bus or start topology. Sikkim Manipal University Page 26

PGDCA Semester 1

Assignment set 1

Media Access Control (MAC) is a technology which provides unique identification and access control for computers on an Internet Protocol (IP) network. In wireless networking, MAC is the radio control protocol on the wireless network adapter . Media Access Control works at the lower sub-layer of the data link layer (Layer 2) of the Open Systems Interconnection model (OSI model). Media Access Control assigns a unique number to each IP network adapter called the MAC address. A MAC address is 48 bits long assigned by the network adapter manufacturer. The MAC address is commonly written as a sequence of 12 hexadecimal digits as follows: 87-3F-5A-61-55-BC Token Ring is one if not the best alternative to Ethernet. It avoids collisions all together. The key is in token ring passing. Here only one station transmits data at one time. Prior actual information is sent, a packet (token) is sent from one station to another. When sender gets the token back, actual information packet is sent. It travels in one direction around the ring, passing all other stations. The receiving station copies it but the packet continues around the ring returning to the sender. The latter removes the former and sends a free token to the next station around the ring. Hen ce a message in token format is sent from node to node in one direction. At receiving node, user examines the token while other nodes can only listen to the network. Token passing continues till original sender node receives the token from the last network node, which acknowledges that the intended receiver has seen the message

2.

Explain various mails protocols

- SMTP Stands for "Simple Mail Transfer Protocol." This is the protocol used for sending e-mail over the Internet. Your e-mail client (such as Outlook, Eudora, or Mac OS X Mail) uses SMTP to send a message to the mail server, and the mail server uses SMTP to relay that message to the correct receiving mail server. Basically, SMTP is a set of commands that authenticate and direct the transfer of electronic mail. When configuring the settings for your e-mail program, you usually need to set the SMTP server to your local Internet Service Provider's SMTP settings (i.e. "smtp.yourisp.com"). However, the incoming mail server (IMAP or POP3) should be set to your mail account's server (i.e. hotmail.com), which may be different than the SMTP server. SMTP is specified for outgoing mail transport and uses TCP port 25. The protocol for new submissions is effectively the same as SMTP, but it uses port 587 instead. SMTP connections secured by SSL are known by the shorthand SMTPS, though SMTPS is not a protocol in its own right. While electronic mail servers and other mail transfer agents use SMTP to send and receive mail messages, user-level client mail applications typically only use SMTP for sending messages to a mail server for relaying. In the sending process a User Agent establishes a connexion with a Mail Trafer Agent and transmit its e-mail message. Mail Transfer Agent (MTA) also use SMTP to relay the e-mail from MTA to MTA, until it reaches the appropriate Sikkim Manipal University Page 27

PGDCA Semester 1 MTA for delivery to the receiving User Agent (UA).

Assignment set 1

- POP Stands for "Post Office Protocol." POP3, sometimes referred to as just "POP," is a simple, standardized method of delivering e-mail messages. A POP3 mail server receives e-mails and filters them into the appropriate user folders. When a user connects to the mail server to retrieve his mail, the messages are downloaded from mail server to the user's hard disk. When you configure your e-mail client, such as Outlook (Windows) or Mail (Mac OS X), you will need to enter the type of mail server your e-mail account uses. Technically, the Post Office Protocol (POP) is an application-layer Internet standard protocol used by local e-mail clients to retrieve e-mail from a remote server over a TCP/IP connection POP3 allows a client computer to retrieve electronic mail from a POP3 server via a TCP/IP or other connection. It does not provide for sending mail, which is assumed to be done via SMTP or some other method. POP is useful for computers, e.g. mobile or home computers, without a permanent network connection which therefore require a "post office" (the POP server) to hold their mail until they can retrieve it. Still, most mail servers use the POP3 mail protocol because it is simple and well-supported. You may have to check with your ISP or whoever manages your mail account to find out what settings to use for configuring your mail program. If your e-mail account is on a POP3 mail server, you will need to enter the correct POP3 server address in your e-mail program settings. Typically, this is something like "mail.servername.com" or "pop.servername.com." Of course, to successfully retrieve your mail, you will have to enter a valid username and password too. - IMAP is a protocol allowing a client to access and manipulate electronic mail messages on a server. It permits manipulation of remote message folders ( mailboxes), in a way that is functionally equivalent to local mailboxes. IMAP includes operations for creating, deleting, and renaming mailboxes; checking for new messages; permanently removing messages; searching; and selective fetching of message attributes, texts, and portions thereof. It does not specify a means of posting mail; this function is handled by a mail transfer protocol such as SMTP. IMAP (Internet Message Access Protocol): IMAP is gradually replacing POP as the main protocol used by email clients in communicating with email servers. Using IMAP an email client program can not only retrieve email but can also manipulate message stored on the server, without having to actually retrieve the messages. So messages can be deleted, have their status changed, multiple mail boxes can be managed IMAP offers access to the mail storage. Clients may store local copies of the messages, but these are considered to be a temporary cache. Incoming e-mail messages are sent to an e-mail server that stores messages in the recipient's email box. The user retrieves the messages with an e-mail client that uses one of a number of e-mail retrieval protocols. Some clients and servers preferentially use vendor-specific, proprietary protocols, but most Sikkim Manipal University Page 28

PGDCA Semester 1

Assignment set 1

support the Internet standard protocols, SMTP for sending e-mail and POP and IMAP for retrieving e-mail, allowing interoperability with other servers and clients. For example, Microsoft's Outlook client uses a proprietary protocol to communicate with a Microsoft Exchange Server server as does IBM's Notes client when communicating with a Domino server, but all of these products also support POP, IMAP, and outgoing SMTP. - MIME and S/MIME: SMTP can handle text only containing 7-bit ASCII text. It cannot handle binary data and other multimedia formats that we now send as attachments. Hence Multipurpose Internet Mail Extensions (MIME) that packs data in other format into a format that SMTP can handle. SMIME stands for Secure MIME. This allows addition of security to MIME messages. Security services allowed are authentication and privacy. SMIME is not specific to internet and can be used in any electronic mail environment. UUCP: This is a UNIX based network. Its built in to machines operating on UNIX. It connects UNIX based machines but less powerful than TCP/IP. UUCP doesnt allow remote login, mail is slower and more awkward than TCP/IP. It is cheap and reliable over dial-up or hardwired connections. Its a standard part of UNIX. It allows UNIX systems to connect together forming a chain. Internet and UUCP connections cannot be compared if we consider all connections in internet as permanent and messages are transmitted quickly. To send mail to UUCP address, the route to be taken by the message must be specified. Post creation of message, the user system will start the message until a contact is established and within seconds the message will be transmitted. If a user has no idea about the path or path is too long, a UUCPMAPPING PROJECT is used allowing the user to use a UUCP address similar to an internet address. 3. Explain various HTML tags associated with creation of lists on a web page Lists commonly are found in web pages. As they help to itemize such things as elements, components, or ingredients. So it helps to present informations in better way. There are three types of lists: ordered lists, unordered lists, and definition lists. Basically, an empty tag called a list tag is used to emphasize with a bullet, words or phrases which need to be set apart from the rest of the body of text <LI>: creates a bullet in front of text which is to be set apart for emphasis and causes all text after it to be indented, either until another list tag is detected or until the end of the list is reached. It is used to itemize elements of unordered and ordered lists. Since a list tag is an empty tag it indents the text following so, it cannot be alone; otherwise, the entire remainder of the document would be indented. Therefore, list tags (<LI>) must be incorporated between two non-empty Sikkim Manipal University Page 29

PGDCA Semester 1 tags. One such pair of tags is called unordered list tags:

Assignment set 1

<UL>unordered list</UL>: is a bulleted list that uses <UL> and <LI> tags. The items are generally of equal importance and do not need to go in any particular order. Each item begins with a <LI> tag. Unordered lists may be nested inside unordered lists or inside any other types of lists (one list inside of another list inside of another list). A line space automatically is inserted before and after an unordered list (that is, an entire line is skipped between an unordered list and any text before and after it), except for (on most browsers) a list nested within another list. The initial <UL> tag may contain within it this parameter as part of the command: TYPE="DISC"|"SQUARE"|"CIRCLE": designates the appearance of the bullets preceding the listed items. "DISC" causes each bullet to appear as a solid, round disc. "SQUARE" causes each bullet to appear as a solid square. "CIRCLE" causes each bullet to appear as an empty circle. Here it is used to format a series of items with no specific hierarchy. Example of format: <ul> <li>Item</li> <li>Item</li> <li>Item</li> </ul> <OL>ordered list</OL>: delineates a list, where the items are in sequential, numerical order. Each item begins with a <LI> tag. Ordered lists may be nested inside ordered lists or inside any other types of lists (one list inside of another list inside of another list). A line space automatically is inserted before and after an ordered list (that is, an entire line is skipped between an ordered list and any text before and after it), except for (on most browsers) a list nested within another list. The initial <OL> tag may contain within it this parameter as part of the command: TYPE="I"|"A"|"1"|"a"|"i": designates the appearance of the numbers preceding the items in the list and, therefore, is conducive to building an outline using nested ordered lists. "I" causes the items to be numbered I, II, III, IV, V, VI, VII, etc. "A" causes the items to be numbered A, B, C, D, E, F, G, etc. "1" (the default) causes the items to be numbered 1, 2, 3, 4, 5, 6, Sikkim Manipal University Page 30

PGDCA Semester 1

Assignment set 1

7, etc. "a" causes the items to be numbered a, b, c, d, e, f, g, etc. "i" cause the items to be numbered i, ii, iii, iv, v, vi, vii, etc. In an ordered list, the list (<LI>) tag may contain within it this parameter: VALUE="1"|"2"|"3"|...|"N": immediately changes the number of that item to the Nth term of that particular numbering type. For example, VALUE="4" would label that item in the sequence as follows: for TYPE="I" that item would be IV; for TYPE="A" that item would be D; for TYPE="1" that item would be 4; for TYPE="a" that item would be d; for TYPE="i" that item would be iv. A ordered list can be used to format a series of items to indicate a specific hierarchy; e.g. rank or process. General format is: <ol> <li>First item</li> <li>Second item</li> <li>Third item</li> </ol>

<DL>definition list</DL>: delineates a list, where the items are individual terms paired with their definitions, and each definition is indented and placed one line down from each term. Definition lists may be nested inside definition lists or inside any other types of lists (one list inside of another list inside of another list). A line space automatically is inserted before and after a definition list (that is, an entire line is skipped between a definition list and any text before and after it), excluding a list nested within another list. <DL COMPACT>definition list</DL>: same as <DL> & </DL>, except each definition is placed on the same line as each term. Within the definition list are terms, each marked with an empty definition-list term tag, as well as the actual definitions of the terms, each marked with an empty definition-list definition tag:
<DT>: creates (but does not place bullets in front of) terms included in a

glossary or definition list.


<DD>: indents (but does not place bullets in front of) definitions of

Sikkim Manipal University

Page 31

PGDCA Semester 1 terms in a glossary or definition list.

Assignment set 1

<DIR>directory list</DIR>: creates a directory listing where each entry is indented . Directory lists may be nested inside directory lists or inside any other types of lists. On most browsers, a line space automatically is inserted before and after a directory list (that is, an entire line is skipped between a directory list and any text before and after it), except for (on many browsers) a list nested within another list. EXAMPLE OF APPLICATION TO DEMONSTRATE USAGE OF LISTS CODE: <html> <body> <h1>DEMO FOR LISTS IN HTML</h1> <H3> UNORDERED LIST </H3> <H3> Objectives </H3> <UL> <LI> Acquire a comprehensive collection of multimedia materials</LI> <LI> Develop appropriate user education and training packages</LI> </UL> <H3> ORDERED LIST </H3> <H3> Library Resources </H3> <OL> <LI> Library Collections </LI> <LI> Library Catalog </LI> <LI> Electronic Resources </LI> </OL> <H3> NESTED LISTS </H3> <OL> <LI> Library Collections </LI> Sikkim Manipal University Page 32

PGDCA Semester 1 <UL> <LI> Books </LI> <LI> Journals </LI> </UL> <LI> Library Catalog </LI> <LI> Electronic Resources </LI> <UL> <LI> CD-ROMs </LI> <LI> Abstracts & Indexes </LI> </UL> </OL>

Assignment set 1

<H3>LIST ATTRIBUTES </H3> <OL type=I> <LI> Library Collections </LI> <UL type=square> <LI> Books </LI> <LI> Journals </LI> </UL> <LI> Library Catalog </LI> <LI> Electronic Resources </LI> <UL type=disc> <LI> CD-ROMs </LI> <LI>Abstracts & Indexes</LI> </UL> </OL>

<H3> DEFINITION LIST </H3> <DL> <DT> Definition Term </DT> <DD> Definition </DD> <DT> Membership Card </DT> <DD> Users of the library must present their membership card at the reception for services and privileges. </DD> </DL> </body> </html>

Sikkim Manipal University

Page 33

PGDCA Semester 1 SCREENSHOT:

Assignment set 1

4. Describe the following with respect to Form Controls: Sikkim Manipal University Page 34

PGDCA Semester 1 a. Form Controls

Assignment set 1

A form in a web page is user by a computer user to enter data that will be sent to a web server for processing. So it can be consider as a paper or a database form, because internet users fill out the forms using elements such as checkboxes,radio button, or text fields. For example, webforms can be used to enter user details or credit card data to make a reservation of a service or can be used to retrieve data. User interact with forms through controls. So we have the following controls: - Buttons There are 3 types of buttons which can be used in html: . Submit button: is the one that users press to send all the form data they have entered. The form is sent to the server. Once it is clicked, there is no possiblity of going back. The "submit" input displays the text that you specify in the value attribute, but if no value is specified, the button face will simply display the word Submit. . Reset button: The "reset" input is visually similar to the submit "button". It is like a button control that can be clicked on or pressed, and accepts no data from the user. However, a reset control is a very destructive control to introduce to a web page, as pressing it will clear all the data already entered into the form in which the reset button resides and set them to their initial value. . Push button: This type of input doesn't have a predefined behavior like submit or reset button. Generally it contains only some script which is executed when an particular event happens with the element attributes.

- Checkboxes This type of input is used when you need users to answer a question with a yes or no response. Theres no way that users can enter any data of their own, their action is simply a case of checking or unchecking the box. When the form is submitted, the server will be interested in the value attribute attached to the control, and the state of the checkbox (checked or unchecked). When youre specifying a checkbox input, the control should come first, and be followed by the associated text. Checkboxes allows user to select several values from the same property. The input element is used to create a checkbox control. - Radio buttons In order to explain how this control works, we need to come back to the Sikkim Manipal University Page 35

PGDCA Semester 1

Assignment set 1

origin of its name. In old-fashioned radio sets, tuning between stations wasnt achieved by using the scan facility, or even rotating a dial like now days. Rather, a series of buttons that were linked to a handful of radio stations could be chosen, one at a time. Pressing one button in the range would cause any other button to pop out. The same effect is in play here. Only one control can be selected from a range, and if you select another, the previously selected input is deselected. For this control to work, though, each radio button in the range that you want users to choose from must have the same name attribute. So radio button is a little bit like checkbox, but here the difference is when several have same control name, only one of them can be set at a time. Therefore when one is on, the others are in off state. - Menus A menu is a control type which allows the user to make a choice in a set of particular options. Menu are created with keyword Select, which may be combined with the OPTGROUP and OPTIONelements. - Text This is the most common kind of input that is encountered on internet, and that is needed most often as we are building our own forms. The "text" input creates a single-line box that the user can enter text into. User can type any character in most of the cases. However a TEXTAREA element can be created, but unlike the INPUT element, it is a multiline input control which allows to enter a bigger text in many lines. Generally Text input has a number of attributes, such as size, maxlength, disabled, readonly,name, and tabindex. - FILE select Generally this input type is used to upload a file. When the attribute is set to"file", two controls appear in the browser: a field that looks similar to a text input, and a button control thats labelled Browse. The text that appears on this button cant be changed, and a file upload control is generally difficult to style with CSS. The file upload control has an optional attribute, accept, which is used to define the kinds of files that may be uploaded. The INPUT element is used to create a file select control. - Hidden Controls A hidden form input is one that, though it doesnt appear on the page, can be used for storing a value. The value in a hidden field may be set at pageload time (it may be written using server-side scripting, as in the example below), or it may be entered or changed dynamically, via JavaScript. Authors generally use this control type to store information between client/server exchanges that would otherwise be lost due to the stateless nature of HTTP protocol. - Object Controls Sikkim Manipal University Page 36

PGDCA Semester 1

Assignment set 1

This type of control is used by the programmer to create some kind of control that are present most of the time inside a form element, but sometime they can also be outside the FORM element declaration in the cas of building user interface. b. The FORM element The <form> tag is used to create an HTML form for user input. The <form> element can contain one or more of the following form elements: <input> <textarea> <button> <select> <option> <optgroup> <fieldset> <label> This element has a number of attributes which specify actions to be performed by the form. The attribute definitions are below: Action: Specifies a form processing agent. Method: specifies which HTTP method will be used for submission. Enctype: specifies content type used to submit the form to the server. Accept-charset: Specifies list of character encodings for input data accepted by the server processing this form. Accept: specifies a comma-separated list of content types that a server processing this form will handle correctly. Name: It names the element so that it may be referred to from style sheets or scripts.

c) The INPUT element The attribute definitions associated with this element are described below in brief: Type = text|password|checkbox|radio|submit|reset|file|hidden|image|button: This specifies the type of control to create. Default value is text. Name = cdata: Assigns control name.

Sikkim Manipal University

Page 37

PGDCA Semester 1

Assignment set 1

Size: Tells the user agent the initial width of the control. Width is in pixels in general. Maxlength: When this has value text or password it specifies the maximum number of characters the user may enter. Checked: If radio or checkbox is the value this Boolean attribute specifies that the button is on. SRC: When this has image value it specifies the location of the image to be used to decorate the graphical submit button. d) The BUTTON element Buttons created with this element function same as those created by INPUT element but offer richer rendering possibilities. This element may have content. Visual user agents may render BUTTON buttons with relief and an up/down motion when clicked, while they may render INPUT buttons as flat images. The various attributes associated with BUTTON element are: Name: Assigns control name. Value: Assigns initial value to the button. Type: Declares type of button. Possible values are reset (creates reset button), button (creates a push button) and submit (creates a submit button).

Write the appropriate code showing the usage of the above concepts and show the appropriate web page output as a screen shot. <HTML> <HEAD> <TITLE> Form Control </TITLE> </HEAD> <BODY> <FORM action="..." method="post"> <H3> DEMONSTRATE USAGE OF FORMS CONTROLS</H3> <P> <FIELDSET> <LEGEND>Personal Information</LEGEND> Last Name: <INPUT name="personal_lastname" type="text" tabindex="1"> First Name: <INPUT name="personal_firstname" type="text" tabindex="2"> Address: <INPUT name="personal_address" type="text" tabindex="3"> < &nbsp > Please specify picture file:<nbsp> Sikkim Manipal University Page 38

PGDCA Semester 1

Assignment set 1

<input type="file" name="datafile" size="10"> </FIELDSET> <FIELDSET> <LEGEND>Medical History</LEGEND> <INPUT name="history_illness" type="checkbox" value="Smallpox" tabindex="20"> Smallpox <INPUT name="history_illness" type="checkbox" value="Mumps" tabindex="21"> Mumps <INPUT name="history_illness" type="checkbox" value="Dizziness" tabindex="22"> Dizziness <INPUT name="history_illness" type="checkbox" value="Sneezing" tabindex="23"> Sneezing .. . <SELECT name="ComOS"> <OPTION selected label="none" value="none">More </OPTION> <OPTGROUP label="HEART DISEASE"> <OPTION label="3.7.1" value="pm3_3.7.1">Hypertension</OPTION> <OPTION label="3.7" value="pm3_3.7">Tachicardy</OPTION> <OPTION label="3.5" value="pm3_3.5">Hypertrophy</OPTION> </OPTGROUP> <OPTGROUP label="ALLERGY"> <OPTION label="3.7" value="pm2_3.7">Latex</OPTION> <OPTION label="3.5" value="pm2_3.5">Glucose</OPTION> </OPTGROUP> </SELECT> </FIELDSET> <FIELDSET> <LEGEND>Current Medication</LEGEND> Are you currently taking any medication? <INPUT name="medication_now" type="radio" value="Yes" tabindex="35">Yes <INPUT name="medication_now" type="radio" value="No" tabindex="35">No If you are currently taking medication, please indicate it in the space below: <P> <TEXTAREA name="current_medication" rows="20" cols="50" tabindex="40"> </TEXTAREA> Sikkim Manipal University Page 39

PGDCA Semester 1 </P> </FIELDSET> <BUTTON name="submit" value="submit" type="submit"> Send<IMG src="/icons/wow.gif" alt=""></BUTTON> <BUTTON name="reset" type="reset"> Reset<IMG src="/icons/oops.gif" alt=" "></BUTTON> </FORM> </BODY> </HTML>

Assignment set 1

SCREENSHOT: Sikkim Manipal University Page 40

PGDCA Semester 1

Assignment set 1

Book ID: B0724 Sikkim Manipal University Page 41

PGDCA Semester 1 1. What is Depreciation?

Assignment set 1

Depreciation in accounting is a process that proportionately expenses the cost of a fixed asset over the asset's useful economic life. In time, fixed assets will eventually lose all their economic value due to a combination of aging,wear and tear, deterioration and/or obsolescence. Generally it is used to spread the cost of an asset over the span of several years. In simple words we can say that depreciation is the reduction in the value of an asset due to usage, passage of time, wear and tear, technological outdating or obsolescence, depletion, inadequacy, rot, rust, decay or other such factors. In accounting, depreciation is a term used to describe any method of attributing the historical or purchase cost of an asset across its useful life, roughly corresponding to normal wear and tear. Depreciation is often mistakenly seen as a basis for recognizing impairment of an asset, but unexpected changes in value, where seen as significant enough to account for, are handled through write-downs or similar techniques which adjust the book value of the asset to reflect its current value. Therefore, it is important to recognize that depreciation, when used as a technical accounting term, is the allocation of the historical cost of an asset across time periods when the asset is employed to generate revenues. 2. What are the elements of an accounting system? The elements of an accounting system are its Accounting Principles. These are rules of action or conduct adopted by the accountants university in recording accounting transactions. Different professional bodies across the world have made recommendations on accounting principles in recent years. The principles are collectively known as GAAP (Generally Accepted Accounting Principles). Accounting principles are classified into a) Accounting Concepts and b) Accounting Conventions. Accounting Concepts: They are postulates, assumptions or conditions upon which accounting records and statements are based. They are developed to convey the same meaning to everyone. Some of the major concepts are: a) b) c) d) e) f) g) h) Entity Concept Dual Aspect Concept Going Concern Concept Money measurement Concept Cost Concept Cost-attach concept Accounting Period Concept Accrual Concept Page 42

Sikkim Manipal University

PGDCA Semester 1 i) j) k)

Assignment set 1

Periodic Matching of Cost and Revenue Concept Realization Concept and Verifiable Objective Evidence Concept Accounting Conventions: Conventions are the customs or traditions guiding the preparation of accounting statements. They are adapted to make financial statements clear and meaningful. The major conventions are: a) b) c) d) Convention Convention Convention Convention of of of of Disclosure Materiality Consistency and Conservatism.

3. How do you prepare Flexible Budget? The following illustration represents how a flexible budget can be prepared. A budget is to be prepared for 6000 and 8000 units production. Administrative expenses are fixed for all levels of production. The expenses budget for production of 10000 units in a factory is displayed below: Details Materials Labor Variable overheads Fixed overheads (Rs 100000) Variable Expenses (Direct) Selling Expenses (10% fixed)13 Distribution Expenses (20% fixed) Administration Expenses (Rs 50000) Total Per units (Rs) 70 25 20 10 5 13 7 5 155

Table 1: Expenses budget for 10000 units production for company ABC Solution: a) b) c) Materials, labor, direct expenses and variable overheads are variable costs. Hence cost/unit will be the same in all production levels. Fixed overheads are constant for all production levels. Selling and distribution expenses are partly fixed and partly variable. Variable part/unit will be same for all levels. Fixed part in total will be constant for all levels. Page 43

Sikkim Manipal University

PGDCA Semester 1

Assignment set 1

At 10000 units, selling expenses per unit is 13 of which 10% is fixed. Hence fixed part is 10% of 13 = 1.3. Total fixed cost is 1.3*10000 = Rs 13000. Variable cost/unit = 90%*13 = Rs 11.70 The variable cost for 10000 units = Rs 11.70 * 10000 = Rs 111700. Total selling expenses for 10000 units = Rs 117000 + Rs 13000 = Rs 130000. Similarly for 6000 units, variable expenses =Rs 70200 and Fixed will be Rs 13000. Hence total selling expenses for 6000 units = Rs 83000. Similarly, distribution expenses are calculated. Cost 6000 units Per unit Total 70 25 5 100 420000 150000 30000 600000 8000 units Per unit Total 70 25 5 100 56000 0 20000 0 40000 80000 0 10000 0 16000 0 10600 00 50000 11100 00 10000 units Per unit Total 70 25 5 100 700000 250000 50000 1000000

Materials Labor Direct Expenses Prime Costs Factory overheads Fixed Variable Factory Cost Administrative Expenses
Selling &Distribution Expenses

16.67 20 136.67 8.33 145

100000 120000 820000 50000 870000

12.5 20 132.5 6.25 138.75

10 20 130 5 135

100000 200000 1300000 50000 1350000

Selling Distribution

13.87 7.93 166.8

83200 47600 1000800

13.32 7.35 159.35

10660 0 58800
12754 00

13 7 155

130000 70000 1550000

Total Cost

Table 2: Flexible budget calculations for 6000 and 8000 units production 4. Briefly explain concept of Profit/Volume Ratio. Sikkim Manipal University Page 44

PGDCA Semester 1

Assignment set 1

This is popularly known as P/V Ratio. It expresses the relationships between contribution and sales. Its expressed in percentage. P/V ratio can be calculated in either of the following ways: (1) OR

Where C = Contribution (difference between sales and variable costs), S = Sales and V = Variable Costs. P/V ratio can be determined by expressing change in profit or loss in relation to change in sales. P/V ratio indicates the relative profitability of different products, processes and departments. If information about two periods is given, P/V ratio is calculated as:

P/V ratio is more important to watch in business. Its the indicator of the rate at which the organization is earning profit. A high ratio indicates high profitability and a low one indicates low profitability. Its useful to calculate Break Even Point and at a given level of sales, what sales are required to earn a certain amount of profit etc. Higher P/V indicates that a firm is in good financial health. P/V ratio can be improved by taking the following steps: a) Sales increase b) Reduction in marginal costs and c) Concentration on sales of profitable product.

Limitations: a) b) c) d) e) Depends heavily on contribution Indicates only relative profitability. Over simplification may lead to wrong conclusions. Higher ratio shows the most profitable item only when other conditions are constant. Fails to consider the capital outlays required by additional productive capacity.

Factors affecting P/V Ratio: Sikkim Manipal University Page 45

PGDCA Semester 1 a) b) c) d) Fixed Cost Sales Volume Selling Price and Variable Cost/Unit.

Assignment set 1

5.Briefly explain features of cash flow statements. The following basic information is needed to prepare cash flow statements: a) Comparative Balance Sheet: Balance sheets at the beginning and at the end of the accounting period indicate the amount of changes that have taken place in assets, liabilities and capital. b) Profit and Loss Account: The P&L a/c of the current period enables to determine the amount of cash provided by or used in operations during the accounting period after making adjustments for non-cash, current assets and current liabilities c) Additional Data: In addition to the above statements, additional data are collected to determine how cash has been provided or used like sale or purchase of assets for cash. Cash Flow Statements (CFS) differ from Funds Flow Statements (FFS) in the following manner: a) b) FFS is based on accrual accounting system while CFS preparation involves all transactions effecting cash or cash equivalents. FFS analyzes sources and application of funds of long-term nature and net increase/decrease I long-term funds will be reflected on the firms working capital. CFS only considers increase/decrease in current assets and liabilities in calculating cash flow of funds from operations FF analysis is useful for long range financial planning while CF analysis identifies and rectifies current liquidity problems of the firm. FFS is a broader concept compared to CFS. CFS is mandatory unlike FFS. FFS tallies funds generated from various sources with various uses to which they are put. CFS starts with opening balance of cash and reach to the closing balance of cash by proceedings through sources and uses of cash.

c) d) e) f)

6.

Write a short note on: Page 46

Sikkim Manipal University

PGDCA Semester 1

Assignment set 1

a) Computation of changes in Working Capital: This statement is a part of a Funds Flow Statement. It follows the Statement of Sources and Applications of Funds. Its primary purpose is to explain the net change in Working Capital, as arrived in the Funds Flow Statement. Here, all Current Assets and Current Liabilities are individually listed. Against each account, the figure pertaining to that account at the beginning and at the end of the accounting period is shown. The net change in its position is also shown. The changes taking place with respect to each account should add up to equal the net change in working capital, as shown by the Funds Flow Statement. b) Funds from operations: During the course of trading activity, a company generates revenue mainly in the form of sale proceeds and pay for costs. The difference between these two items will be the amount of funds generated by trading operations. The funds generated can be calculated either from the operation (depreciation, depletion, dividends etc) of the firm itself or by preparing Adjusted Profit and Loss Account statement. c) Sources and Application of Funds Sources: a) Funds raised from Shares, Debentures and Long-term loans: The longterm funds are injected into the business during the year by issue of shares/debentures and by raising long-term loans. Any premiums collected also are a part of this source. b) Sale of fixed assets and Long term investments: Amounts generated from sale of fixed assets are a source of funds. FFS preparation here involves gross sale proceeds from the sale. This activity doesnt produce fresh funds but it releases funds to finance the assets. Application: a) Repayment of Preference Capital or Debentures or long-term debit: It represents the application of firms funds released from business through redemption of preference shares or debentures, repayment of long-term loans previously made by the firm. A reduction in equity capital is also an application of funds. b) Purchase of fixed assets or long-term investments: Funds used to purchase long-term assets are the most significant application of funds during the year. This includes capital expenditures on land, machinery, furniture etc. c) Distribution of dividends and payment of taxes: Dividends distributed to shareholders and tax paid during the year is application of funds for the firm. d) Loss from operation: Losses in trading activities use up funds. If costs are more than revenue, a cash outflow will be the result. Sikkim Manipal University Page 47

PGDCA Semester 1

Assignment set 1

Illustration:

Following are the summarized Balance Sheet of X Ltd as on 31/12/2004 and 2005. Additional Information: a) Dividend of Rs 11500 was paid, b) Depreciation written off on plant Rs 7000 and on buildings Rs 5000 and c) Provisions for tax was made during the year for Rs 16500. A funds flow statement is to be prepared for 31/12/2005 with the help of the Balance Sheet.
Liabilities Share Capital General Reserve P & L a/c Bank Loan (Longterm) Creditors Provision for Tax Total 2004 10000 0 25000 15250 35000 75000 15000 26525 0 2005 125000 30000 15300 67600 0 17500 255400 Assets Goodwill Building s Plant Stock Debtors Bank Cash 2004 0 100000 75000 50000 40000 0 250 265250 2005 2500 95000 84500 37000 32100 4000 300 255400

Table 1: Summarized Balance Sheet of company for 31/12/2004 and 31/12/2005

Particulars Current Assets Cash Bank Debtors Stock Current Liabilities Creditors Working Capital Net increase in Working Capital Total

2004

2005

Increases (-)

Decreases (+)

250 0 40000 50000 90250 75000 15250 58150 73400

300 4000 32100 37000 73400

50 4000

7900

75000 73400 58150 79050

73400

79050

Table 2: Schedule of changes in working capital (Rs)

Sikkim Manipal University

Page 48

PGDCA Semester 1 Sources Funds from operations Issue of Shares Bank Loan Rs Particulars

Assignment set 1 Rs

45050 25000 32600

Purchase of Plant Income tax paid Dividend Paid Goodwill Paid Net increase in Working capital

16500 14000 11500 2500 58150 102650

Total

102650 Table 3: Funds Flow Statement

7. What is Combined Ratios? Combined Ratios also known as mixed ratios are such ratios which establish relationship between variables picked up from both the statements i.e. balance sheet and final account. For example debtors turnover, assets turnover, return on capital etc. The Inter-Statement Ratios are based on both items or two groups of items of which one is from the Balance Sheet and one is from the revenue statements. e.g fixed asset turnover ratio, Debtors Turnover ratio, Creditors turnover Ratio, Stock turnover Ratio... The a) b) c) d) e) different types of combined ratios are: Return on Capital Employed (ROCE) Return on Proprietors Funds Earnings per share Dividend Payout Ratio and Debtors Turnover Ratio (Debtors Velocity)

8. What is an audit? An audit is the examination and verification of a company's financial and accounting records and supporting documents by a professional, such as a Certified Public Accountant. Also called financial statements, it is the review of the financial statements of a company or any other legal entity (ex: governments), resulting in the publication of an independent opinion on whether or not those financial statements are relevant, accurate, complete, and fairly Sikkim Manipal University Page 49

PGDCA Semester 1

Assignment set 1

presented.The financial report includes a balance sheet, an income statement, a statement of changes in equity, a cash flow statement, and notes comprising a summary of significant accounting policies and other explanatory notes These financial analyses are usually done by certified public accounting firms and forensic accountants who provide an objective view of the true financial integrity of a company. Audits are intended to show whether a company's financial documentation matches its financial claims. The financial audit is one of many assurance or attestation functions provided by accounting and auditing firms, whereby the firm provides an independent opinion on published information.Many organizations separately employ or hire internal auditors who do not attest to financial reports but focus mainly on the internal controls of the organization. It is not uncommon for a business to employee an internal auditor to monitor financial controls of a company in addition to hiring outside auditors, but external auditors may choose to place limited reliance on the work of internal auditors.

Sikkim Manipal University

Page 50

Vous aimerez peut-être aussi