Top Banner

of 50

AssFinal_set1

Apr 03, 2018

Download

Documents

Potey Desmanois
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/29/2019 AssFinal_set1

    1/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 ternaryoperators since they are neither unary or binary and take three operands. Infact 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 returnedvalue will be expression 2, otherwise the returned value will be expression 3.It's not mandatory that the conditional operator must be used only witharithmetic 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 operatorsThe 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 limitednumber of types: int and char. Bitwise operators fall into two categories:binary bitwise operators and unary bitwise operators. Binary operators taketwo operands, while unary operators only take one. The operators are:

    & bitwise AND | bitwise OR^ bitwise exclusive OR ~ one's complement> shift right

    Truth Table for logical Bitwise Operations

    Operand 1x

    Operand 2y

    X & y X | y X ^ y

    1100

    1010

    1000

    1110

    0110

    Bitwise complement OR operator is represented by a tilde (~) and is alsoknown 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

  • 7/29/2019 AssFinal_set1

    2/50

    PGDCA Semester 1 Assignment set 1

    Bitwise shift operator s are used to push the bit patterns to the right or left bythe number of bits given by their right operand.

    Syntax: Expression >> n (where n is the number of bits to be shifted)

    Example:#includemain(){

    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);getch();return;}

    Output: Enter two integers 24 9

    w = -1 One's compliment= ~W= 0x & y = 8x | y = 25x ^ y = 17x > 2 = 6

    c. gets() and puts() functions

    These functions are considered as input/output functions, since theyallow to transfer information between the computer and the peripheralsdevices.

    gets() function is used to get data from the user. It gets an entire stringof characters and stores them in a set of consecutive memory locations calledarray. The string of characters is passed into the function as a singleargument. So basically this function allows the interaction between the useran the running program, since value is entered using keyboard and acceptedwhen return key is pressed. If there was no error in the input process, itreturns 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

  • 7/29/2019 AssFinal_set1

    3/50

    PGDCA Semester 1 Assignment set 1

    puts() function is used to display a string of character to the outputdevice. puts() function can be considered as a simplified version of theprintf() function. But unlike printf it doesn't requires any formating case likequotes "" 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:#includemain( ){

    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 structuresArrays 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 itemsto 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 beused to store informations regarding ID, name and marks obtained in varioussubject by a given student.

    However when the same set of information has to be stored for a wholeclass of students, then an array of shuch stucture need to created.

    Example:

    #includestruct stden

    {char name[25];int mark1;int mark2;int mark3;int total;

    };

    main(){

    Sikkim Manipal University Page 3

  • 7/29/2019 AssFinal_set1

    4/50

    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

  • 7/29/2019 AssFinal_set1

    5/50

    PGDCA Semester 1 Assignment set 1

    Unions are useful for applications involving multiple members, where valuesneeded to be assigned to all the members at any instant. Each member of theunion is stored in the same address. The compiler allocates a piece of storagelarge enough to hold the largest variable type in the union.

    Therefore union helps to make an efficient usage of memory.

    Example:#includemain(){

    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 = 512key.ch[0] = 0

    key.ch[1] = 2

    In this example the union occupies only 2 bytes of memory. key.ch[0] andkey.ch[1] are using the same memory location used by key.num

    3. Write a program demonstrating the usage of pointers with onedimensional and two dimensional arrays.

    #include

    #includeVoid 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

  • 7/29/2019 AssFinal_set1

    6/50

    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 acompanion function which accepts an additional file pointer argument tellingit where to read from and write to. In case of printf, companion function isfprintf and the file pointer argument comes first.

    To print a string to the output.datfile, a function like fprintf (Hello); canbe called. For getchar, the companion function is getc where the file pointeris its only argument. To read a character from an input.datfile, int c; c = getc(ifp); may be called.

    Similarly, putc is the companion to putchar and file pointer argumentcomes last.

    Example: Writing a data to the file

    #includeVoid main (){FILE *fp;Char stuff [25];Int index;Fp =fopen (TENLINES.TXT,w);Strcpy (stuff, This is example line.);

    For (index = 1; index filename invocation ensures that anything printed tostdout is redirected to the file but anything printed to stderr still goes to thescreen. The intention behind stderr is that it is the standard error outputerror messages printed to it will not disappear into an output file.

    Example: To read a data file input.dat consisting of rows and columns ofnumbers

    #define MAXLINE 100#define MAXROWS 10

    Sikkim Manipal University Page 6

  • 7/29/2019 AssFinal_set1

    7/50

    PGDCA Semester 1 Assignment set 1

    #define MAXCOLS 10#include#include{

    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 ++;

    }}

    c) Error handling during I/O operationsThe 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 interrogatedand set by the following functions namely:

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

    . Ferror (returns non-zero if the streams error indicator is set, zerootherwise) and

    .Perror (prints a single-line error message on the programs standardoutput) prefixed by a string pointed to bys with a colon and a spaceappended.

    The error message is determined by the value of the error and is

    Sikkim Manipal University Page 7

  • 7/29/2019 AssFinal_set1

    8/50

    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#include#includeVoid main (){

    Fclose (stdout);If (fgetc (stdout) > = 0){

    Fprintf (stderr, What No Error!);Exit (EXIT_FAILURE);

    }Perror (fgetc);Exit (EXIT_SUCCESS);}

    d) Random access to filesRandom 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 canaccess 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 justwritten. For controlling this, the Random Access functions allow control overthe implied read/write position in the file. The file position indicator is movedwithout the need for a read or a write and indicates the byte to be the subjectof the next operation on the file. Three types of function exist which allow thefile position indicator to be examined or changed. They are:

    i) Ftell: This function return the current position of the file positionpointer. The value is counted from the beginning of the file.Returns thecurrent value measured in characters of the file position indicator if thestream 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 thecurrent file position indicator. So it gives the current position in the file Onfailure, -1L is returned and errno is set.

    ii) Rewind: It sets the current file position indicator to the start of the fileindicated 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 desiredlocation 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

  • 7/29/2019 AssFinal_set1

    9/50

    PGDCA Semester 1 Assignment set 1

    number or variable of type long, and position in an integer number. Offsetspecifies the number of positions (bytes) to be moved from the locationspecified bt the position. The position can take the 3 values: 0,1 or 2

    General format is: fseek(file pointer,offset, position);

    Example:#include

    #include#includestruct 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

  • 7/29/2019 AssFinal_set1

    10/50

    PGDCA Semester 1 Assignment set 1

    Book ID: B0680

    1. Describe the following:

    a. Binary Number systemThe 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 atthe bit level of data. However Bit is an abbreviation for binary digits, thus eachof the binary digits 0 and 1 are called bits.

    A binary number is a weighted number. The right most bit is the leastsignificant bit (LSB) and has a weight of 20=1 . The weight increase from rightto left by a power of two for each bit. The left most bit is the Most SignificantBit (MSB) and it's weight depands on the size of the binary number. If thereare 'n' bits, then weight of MSB will be 2n-1.

    Fractional numbers can also be represented in binary by placing bits tothe right of the binary point. The left most bit in the frational number has aweight of 2-1 =0.5. The fractional weights decrases from left to right by anegative 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 systemThe 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 thenumber. It provides a convenient way to express binary numbers and codes.with 0 having the least value and seven having the greatest value . Columnsare used in the same way as in the decimal system, in that the left mostcolumn is used to represent the greatest value.

    Octal number can be obtained by making a successive division by 8 of adecimal number. Each resulting quotient is divided by 8 until there is a '0'whole number quotient. The remainders generated by each division form awhole 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 MostSignificant 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

  • 7/29/2019 AssFinal_set1

    11/50

    PGDCA Semester 1 Assignment set 1

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

    c. Hexadecimal number systemNumbers in hexadecimal system are generally used in computers and

    microprocessors. They are much shorter than binary numbers as four binarydigits can be represented by a single hexadecimal digit. They can easily beconverted to binary whenever necessary.

    Hexadecimal number system has a base (radix) of 16. It is composed ofnumbers 0 to 9 and alphabets A to F, whose values range from 10 to 15respectively. Mostly digital systems process binary data in groups that aremultiplies of four bits, making the hexadecimal representation very convenientas each group of four bits can be represented by one hexadecimal digit.

    Hexadecimal number can be obtained by making a successive divisionby 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 withinthe 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 ORfunction. Therefore AND and OR functions are defined with two or more inputgate circuitries. Sum of Products (SOP) expressions is two or more AND and ORfunctions expressed together. The AND terms are known as miniterms.

    A popular method of representation of SOP form is with miniterms. Sincethe miniterms are OR functions, a summation notation with the prefix m isused 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 passfrom a maximum of 2 gates from the input to the output.

    Example: f = abc + abc + abc + abc

    In the above case, the function fhas 4 miniterms. Each miniterms has 3variables. Hence the miniterms can be represented with the associated 3-bitrepresentation. Representation of miniterms with 3-bit binary and equivalentdecimal number can be noted.

    Sikkim Manipal University Page 11

  • 7/29/2019 AssFinal_set1

    12/50

    PGDCA Semester 1 Assignment set 1

    Hence abc = 101 (2) = 5, abc = 011 (2) = 3, abc = 110 (2) = 6 and abc = 111 (2)= 7.

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

    m b) Product of Sums Form

    Product of Sum (POS) expression is the AND representation of two or moreOR functions The OR terms are known as maxterms. POS is also useful as itcan be implemented easily with logic gates. Such implementations are always2-level gate network meaning a signal will pass from a maximum of 2 gatesfrom the input to the output.

    Similar to SOP, a popular method of representation of POS form is withmaxterms. Since the maxterms are ANDed a product notation with the prefixM is used. If n is number of variables used then the maxterms are notedwith 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 maxtermscan be represented with the associated 3-bit representation. Representation ofmaxterms 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 the universal NAND and NOR gates with suitableexamples.

    The concept of the universal gate is that the given gate should be able togenerate all the basic gate functions/logics (AND, NOT and OR). NAND andNOR gates are universal as they can realize all basic gates. They are explainedbelow 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

    a f

  • 7/29/2019 AssFinal_set1

    13/50

    PGDCA Semester 1 Assignment set 1

    b) AND realization using NAND: f = a.b = a.b

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

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

    Sikkim Manipal University Page 13

    a

    f

    b

    a

    f

    b

    a

    b

    f

    af

  • 7/29/2019 AssFinal_set1

    14/50

    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.

    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 itemsto the selected processing hardware at the right time. Its a nerve center forother units. It decodes and translates the instructions and generates the

    necessary signals for other units.

    Sikkim Manipal University Page 14

    a

    b

    f

    b

    fa

  • 7/29/2019 AssFinal_set1

    15/50

    PGDCA Semester 1 Assignment set 1

    This unit a) interprets instructions and b) sequences the instructions. Ininstruction interpretation, the unit reads instructions from the memory andrecognizes the instruction type, gets necessary operand and sends them tocorrect functional unit.

    Signal needed to perform desired operation is taken to processing unitand results are sent to the correct section. In instruction sequencing, itdetermines the address of the next instruction to be executed and loads it intoprogram counter. Control circuits govern the transfer of signals and datatransfer 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 thebus. 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 ismore than one wire. The dash is labeled with number of wires and designationof those wires. A bus allows any number of devices to hook up with it. Devicesshare the bus. Only one device can use it at a time. Most devices have acertain number of connections and do not permit dedicated connections toother devices.

    A bus doesnt have this problem. A bus diagram is presented below. Aslant slash goes across a horizontal line meaning more than 1 wire. The slantdash is labeled 32 meaning there are 32 wires and A31-0 signifies individual 32wires from A0to A31.

    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 tothe type of data contained there. Execution occurs in a sequential fashion unless explicitly modified fromone instruction to the next.

    Sikkim Manipal University Page 15

    Bu

    s

    A31-0

    32

  • 7/29/2019 AssFinal_set1

    16/50

    PGDCA Semester 1 Assignment set 1

    The Von-Neumann architecture consists of

    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 causesthem to be executed.

    Input and Output (I/O) equipment operated by the control unit.

    Representation based on Von-Neumann architecture

    5. Discuss the different types of Addressing Modes with suitableexamples

    The different types of addressing modes are as follows:

    Direct Addressing Mode: Here EA (effective or actual address of thelocation containing the referenced operand) = A (contents of an address fieldin the instruction) meaning address field contains address of the operand.

    Example: ADD A means add contents of cell A to accumulator. Look inmemory at address A for operand. Memory is referred to once for accessingdata.

    Sikkim Manipal University Page 16

    MainMemory

    I/ODevices

    Arithmetic Logic Unit (ALU)

    Program Control Unit (CU)

  • 7/29/2019 AssFinal_set1

    17/50

    PGDCA Semester 1 Assignment set 1

    Immediate Addressing Mode: The operand is actually present in theinstruction. The operand can be used to define and use constants and setinitial values. The operand is part of the instruction and is same as theaddress field.

    Example: ADD 5 means add 5 to the contents of the accumulator where 5 isthe operand. Memory is not referred to fetch data.

    Indirect Addressing Mode: Here the memory cell is pointed to by theaddress field. It contains the address of the operand. Here EA = A. Hence theprocessor 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 toaccumulator. 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 registernamed in the address field. EA = R. Here very small address fields areneeded; shorter instructions needed and they are fetched faster; memoryaccess is not required. It requires good assembly programming.

    Example: In C programming say register int a. The operand a is held in theregister named in the address field.

    Register Indirect Addressing Mode: Here EA = R. the operand is inthe memory cell pointed to by contents of register R. The address space is

    large (equal to 2n). Needs fewer memories access than indirect addressingmode. This is same as indirect addressing mode.

    Displacement addressing mode: Here EA = A + R. The address fieldholds two values namely A (base value) and R (register that holdsdisplacement) or vice versa.

    Relative addressing mode: its a version of displacement addressingwhere R = PC (program counter). EA = A + PC meaning operand A is obtainedfrom the current location pointed to by PC.

    Base-Register addressing mode: A holds displacement and R holdspointer to base address. R may be implicit or explicit. Segment registers in80*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. ADDmeans pop two items from stack and add.

    Auto increment mode: This mode is useful for accessing data items in

    Sikkim Manipal University Page 17

  • 7/29/2019 AssFinal_set1

    18/50

    PGDCA Semester 1 Assignment set 1

    successive locations in the memory. The EA of the operand is the contents ofa register specified in the instruction. After accessing the operand, thecontents of this register are automatically incremented to point to the nextitem 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 indicatingthat the same are to be incremented after the operand is accessed. Hencethis 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/Omodule. With this technique, the I/O module will perform the requestedaction and then set appropriate bits in the status register. The I/O moduledoes 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 itfinds 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 CPUdoesnt need to check on the I/O module and it saves time. Interrupts enabletransfer of control from program to program to be initiated by an event that isexternal to the computer. Execution of interrupted program resumes postcompletion of execution of interrupted service routine. This concept is usefulin operating systems and in many control applications where processing ofcertain 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

  • 7/29/2019 AssFinal_set1

    19/50

    PGDCA Semester 1 Assignment set 1

    I/O module transfers data.

    CPU reads data and stores in main memory.

    Book ID: B0676

    Sikkim Manipal University Page 19

  • 7/29/2019 AssFinal_set1

    20/50

    PGDCA Semester 1 Assignment set 1

    1. A computer company wants to hire 25 programmers to handlesystems programming and 40 programmers for applicationsprogramming. 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 onapplications programming. Of the hired programmers, 10 will do bothtypes 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 meanscommutative. If we can prove that regarding multiplication R obeys closed,associative, identity and inverse properties, R can be termed as Abelian. Inorder 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 thata * 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, wecan say that c R. Hence R is closed w.r.t multiplication.

    Sikkim Manipal University Page 20

  • 7/29/2019 AssFinal_set1

    21/50

    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 isknown as identity. Also e * a = a implies e = 1. Again 1 is a real numberbelonging 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 tomultiplication.

    Book ID: B0677

    4. Prove that a given connected graph G is Euler graph if and only ifall vertices of G are of even degree.

    Proof: Lets assume that G is an Euler graph meaning G contains an Eulerline. Hence a closed walk exists running through all the edges of G exactlyonce. Let v V be a vertex of G. tracing the walk sees it going through twoincident edges on v with one entered v and the other exited.

    This is true for intermediate vertices of the walk and terminal vertexbecause 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 toconstruct a closed walk starting at an arbitrary vertex v and running throughall the edges of G exactly once.

    To find a closed walk, lets start from the vertex v. Since every vertex is ofeven degree, we can exit from every vertex we entered. The tracing cannotstop at any vertex but at v. Since v is also of even degree, we shalleventually 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 theclosed walk h doesnt include all the edges.

    Sikkim Manipal University Page 21

    V

  • 7/29/2019 AssFinal_set1

    22/50

    PGDCA Semester 1 Assignment set 1

    Then the remaining edges form a subgraph h1 of G. Since G and h havetheir 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 athis walk h1 combined with h forms a new walk which starts and ends at vertexv and has more edges than those are in h.

    This process is repeated until we obtain a closed walk travelling throughall the edges of G. in this way we can get an Euler line. Thus G is an Eulergraph.

    5. Prove that a connected planar graph with n vertices and e edgeshas e n + 2 regions.

    Let G be a connected graph where n, e and f are the number of vertices, edgesand 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 allconnected 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 ifevery edge of G is a bridge).

    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

    K

    F2

    F1

  • 7/29/2019 AssFinal_set1

    23/50

    PGDCA Semester 1 Assignment set 1

    graph is also a plane graph, we have that G k is also a plane graph. Since kisnot a bridge, we have that k is a part of a cycle (since an edge e of G is abridge if and only if e is not a part of any cycle in G). So it separates two facesF1 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 ofG k respectively.

    Now we have n (G k) = n, e (G k) = e 1 andf (G k) = f 1.

    By our induction hypothesis, we have that n(G k) e(G - k) + f(G k) = 2 orn (e -1) + (f-1)=2 orn - e + f = 2 implyingf = e - n +2

    Hence by mathematical induction e conclude that the statement is true for allconnected planar graphs.

    6. Find the values of the Boolean function f=(xy ')z'

    Let's build the truth table for the given function

    x y z x y z (xy ') f=(xy ')z'

    0 0 0 1 1 1 0 1

    0 0 1 1 1 0 0 0

    0 1 0 1 0 1 0 1

    0 1 1 1 0 0 0 0

    1 0 0 0 1 1 1 1

    1 0 1 0 1 0 1 1

    1 1 0 0 0 1 1 1

    1 1 1 0 0 0 1 1

    Book ID: B0703

    Sikkim Manipal University Page 23

  • 7/29/2019 AssFinal_set1

    24/50

    PGDCA Semester 1 Assignment set 1

    1. Describe the following:

    a. Internet technologiesAs internet is becoming more and more integrated to every people life,

    various technologies are created to make internet more reliable, capable ofoffering new services, and applications of quality everyday. So there are manytechnologies available like:

    - VOIP stands for Voice Over Internet Protocol (also called IP Telephony,Internet telephony, and Digital Phone). VoIP is basically a telephoneconnection over the Internet. The data is sent digitally, using the InternetProtocol (IP) instead of analogue telephone lines. This allows people to talk toone another long-distance and around the world without having to pay longdistance or international phone charges. Technically speaking VOIP is therouting of voice conversations over the Internet or any other IP-basednetwork.

    In order to use VoIP, you need a computer, an Internet connection, andVoIP software. You also need either a microphone, analog telephone adapter,or VoIP telephone. The largest provider of VoIP services is Vonage, but thereare several other companies that offer similar services. While Vonage chargesa monthly service fee, programs like Skype and PeerMe allow users to connectto each other and talk for free.

    - Flash technology is mainly present on internet and its relatedapplications. So the word Flash on internet refers mainly to Adobe flash, which

    is a multimedia technology. Flash allows Web developers to incorporateanimations 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 thatevery web browser need. It supports bidirectional streaming of audio andvideo, and it can capture user input via mouse, keyboard, microphone, andcamera. Flash contains an object-oriented language called ActionScript andsupports automation via the Javascript Flash language (JSFL).

    This technology is so revolutionary that it has enabled video distributionplatforms such as youtube to be leaders in their field, by the method ofcompressing 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 plug-in must be installed. While Flash is automatically installed with most browserstoday, some animations may require an updated version of Flash to run.

    - Wireless Technology is actually one of the most innovativetechnology brought with the usage of internet. With now the constantincreasing number of people using internet service such as mail, telephony,multimedia contents the wireless technology makes this all easy to use forclients.

    Technically speaking wireless medium is an unguided form oftransmission medium. Signals are transmitted through air and space usingradio and satellite networks. Satellite communication network transmit and

    Sikkim Manipal University Page 24

  • 7/29/2019 AssFinal_set1

    25/50

    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 theuse 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 vastgeographical locations.

    Mobile communication, which involves wireless communication of data,allows users to do their work at any location. Users can do their job usingbluetooth or radio frequencies with help of devices such as cell phones,handled PCs, notebooks and require sometimes internal or external wirelessnetwork 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 SunMicrosystems' Java platform.

    Java is a general-purpose, concurrent, class-based, object-orientedlanguage that is specifically designed to have as few implementationdependencies as possible. It is intended to let application developers "writeonce, run anywhere.", meaning that code that runs on Windows does notneed to be edited to run on a Mac. Java is currently one of the most popularprogramming languages in use, particularly for client-server web applications.

    The syntax of Java is much like that of C/C++, but it is object-orientedand structured around "classes" instead of functions. Java can also be used forprogramming applets -- small programs that can be embedded in Web sites.

    The language is becoming increasingly popular among both Web and softwaredevelopers since it is efficient and easy-to-use.

    Java is developed specifically for network-heavy environment such asinternet and enterprise Intranet, it is a major part of the informationsinfrastructure being developed all over the world. Like the C++ language (onwhich it is based) Java is object oriented: meaning its programs are built with'modules' of code which can be employed in building new programs withoutrewriting the same code. However (unlike C++) it is an interpreted languageand therefore has longer execution time than the compiled languages,although the gap has considerably narrowed over the last few years.

    b. NetworksA network can be defined as a collection of computers connected to each

    others through a cable or a media. Basically it allows the computers tocommunicate 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

    http://www.businessdictionary.com/definition/developed.htmlhttp://www.businessdictionary.com/definition/internet.htmlhttp://www.businessdictionary.com/definition/developed.htmlhttp://www.businessdictionary.com/definition/internet.html
  • 7/29/2019 AssFinal_set1

    26/50

    PGDCA Semester 1 Assignment set 1

    Area Network (LAN), Campus Area Network (CAN), Metropolitan AreaNetwork (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 withoutintermediate nodes. P packet going from source to destination may have to gothrough an intermediate node. As a rule, large networks use this network butthere are exceptions.

    - LAN is a computer network that span over a small area. It connectscomputers and workstations to share data and resources such as printers,faxes. LAN is restricted to small area like school, office,home. It covers a localarea of 1 Km.

    - CAN is a computer network which is made up of two or more LANswithin a limited area. It can cover many buildings in a area. The main featureof a CAN is that all the computers which are connected have somerelationship to each other. For example, different buildings in a campus can beconnected 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 notowned by a single organisation. It acts as a high speed network to allowsharing resources within a city. MAN can also be formed by connecting remote

    LANs through telephone lines or radio links. This type of network support dataand voice transmission. It covers area of 2 to 100 Km.

    - WAN covers a wide geographical area which includes multiplecomputers or LANs. It connects computers though computer network, liketelephone system, microwave or satellite link or lease lines. Most of the WANuse leases lines for internet access as they provides faster data transfer. So itenables 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 balancebetween speed, price and ease of installation. Its speeds varies from 10million bits/second or 100 million bits/second. The advanced version ethernetis known as Fast Ethernet. It employs CSMACD using all nodes which listen tothe traffic on the network and try to send data only when its quiet. If twonodes transmit data at same time, collisions are detected and the nodes goquiet 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

  • 7/29/2019 AssFinal_set1

    27/50

    PGDCA Semester 1 Assignment set 1

    Media Access Control (MAC) is a technology which provides uniqueidentification and access control for computers on an Internet Protocol (IP)network. In wireless networking, MAC is the radio control protocol on thewireless 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 networkadapter called the MAC address. A MAC address is 48 bits long assigned bythe network adapter manufacturer. The MAC address is commonly written as asequence of 12 hexadecimal digits as follows: 87-3F-5A-61-55-BC

    Token Ring is one if not the best alternative to Ethernet. It avoidscollisions all together. The key is in token ring passing. Here only one stationtransmits data at one time. Prior actual information is sent, a packet (token) issent from one station to another. When sender gets the token back, actualinformation packet is sent. It travels in one direction around the ring, passingall other stations. The receiving station copies it but the packet continuesaround the ring returning to the sender. The latter removes the former andsends a free token to the next station around the ring. Hen ce a message intoken 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 thelast network node, which acknowledges that the intended receiver has seenthe message

    2. Explain various mails protocols

    - SMTP Stands for "Simple Mail Transfer Protocol." This is the protocolused 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 receivingmail server. Basically, SMTP is a set of commands that authenticate and directthe transfer of electronic mail. When configuring the settings for your e-mailprogram, you usually need to set the SMTP server to your local InternetService Provider's SMTP settings (i.e. "smtp.yourisp.com"). However, theincoming 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 port587 instead. SMTP connections secured by SSL are known by the shorthandSMTPS, though SMTPS is not a protocol in its own right.While electronic mail servers and other mail transfer agents use SMTP to sendand receive mail messages, user-level client mail applications typically onlyuse SMTP for sending messages to a mail server for relaying.

    In the sending process a User Agent establishes a connexion with a MailTrafer 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

  • 7/29/2019 AssFinal_set1

    28/50

    PGDCA Semester 1 Assignment set 1

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

    - POP Stands for "Post Office Protocol." POP3, sometimes referred to as

    just "POP," is a simple, standardized method of delivering e-mail messages. APOP3 mail server receives e-mails and filters them into the appropriate userfolders. When a user connects to the mail server to retrieve his mail, themessages 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 accountuses. Technically, the Post Office Protocol (POP) is an application-layerInternet standard protocol used by local e-mail clients to retrieve e-mail froma 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 isassumed to be done via SMTP or some other method.POP is useful for computers, e.g. mobile or home computers, without apermanent network connection which therefore require a "post office" (thePOP server) to hold their mail until they can retrieve it.

    Still, most mail servers use the POP3 mail protocol because it is simpleand well-supported. You may have to check with your ISP or whoevermanages your mail account to find out what settings to use for configuringyour mail program. If your e-mail account is on a POP3 mail server, you willneed to enter the correct POP3 server address in your e-mail programsettings. Typically, this is something like "mail.servername.com" or

    "pop.servername.com." Of course, to successfully retrieve your mail, you willhave to enter a valid username and password too.

    - IMAP is a protocol allowing a client to access and manipulate electronicmail 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; andselective fetching of message attributes, texts, and portions thereof. It doesnot specify a means of posting mail; this function is handled by a mail transferprotocol such as SMTP.

    IMAP (Internet Message Access Protocol): IMAP is gradually replacing POPas the main protocol used by email clients in communicating with emailservers. Using IMAP an email client program can not only retrieve email butcan also manipulate message stored on the server, without having to actuallyretrieve the messages. So messages can be deleted, have their statuschanged, multiple mail boxes can be managed

    IMAP offers access to the mail storage. Clients may store local copies ofthe messages, but these are considered to be a temporary cache.Incoming e-mail messages are sent to an e-mail server that stores messagesin the recipient's email box. The user retrieves the messages with an e-mailclient that uses one of a number of e-mail retrieval protocols. Some clientsand servers preferentially use vendor-specific, proprietary protocols, but most

    Sikkim Manipal University Page 28

  • 7/29/2019 AssFinal_set1

    29/50

    PGDCA Semester 1 Assignment set 1

    support the Internet standard protocols, SMTP for sending e-mail and POP andIMAP for retrieving e-mail, allowing interoperability with other servers andclients. For example, Microsoft's Outlook client uses a proprietary protocol tocommunicate with a Microsoft Exchange Server server as does IBM's Notes

    client when communicating with a Domino server, but all of these productsalso support POP, IMAP, and outgoing SMTP.

    - MIME and S/MIME: SMTP can handle text only containing 7-bit ASCIItext. It cannot handle binary data and other multimedia formats that we nowsend as attachments. Hence Multipurpose Internet Mail Extensions (MIME)that packs data in other format into a format that SMTP can handle. SMIMEstands for Secure MIME. This allows addition of security to MIME messages.Security services allowed are authentication and privacy. SMIME is not specificto internet and can be used in any electronic mail environment.

    UUCP: This is a UNIX based network. Its built in to machinesoperating on UNIX. It connects UNIX based machines but less powerful than

    TCP/IP. UUCP doesnt allow remote login, mail is slower and more awkwardthan TCP/IP. It is cheap and reliable over dial-up or hardwired connections. Itsa standard part of UNIX. It allows UNIX systems to connect together forming achain. Internet and UUCP connections cannot be compared if we consider allconnections in internet as permanent and messages are transmitted quickly.

    To send mail to UUCP address, the route to be taken by the message must bespecified. Post creation of message, the user system will start the messageuntil a contact is established and within seconds the message will betransmitted. 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 addresssimilar to an internet address.

    3. Explain various HTML tags associated with creation of lists on aweb page

    Lists commonly are found in web pages. As they help to itemize suchthings as elements, components, or ingredients. So it helps to presentinformations in better way.

    There are three types of lists: ordered lists, unordered lists, anddefinition lists. Basically, an empty tag called a list tag is used toemphasize with a bullet, words or phrases which need to be set apart fromthe rest of the body of text

    : creates a bullet in front of text which is to be set apart foremphasis and causes all text after it to be indented, either until anotherlist tag is detected or until the end of the list is reached. It is used toitemize elements of unordered and ordered lists.

    Since a list tag is an emptytag it indents the text following so, it cannot bealone; otherwise, the entire remainder of the document would be indented.

    Therefore, list tags () must be incorporated between two non-empty

    Sikkim Manipal University Page 29

  • 7/29/2019 AssFinal_set1

    30/50

    PGDCA Semester 1 Assignment set 1

    tags. One such pair of tags is called unordered list tags:

    unordered list: is a bulleted list that uses and tags. The items are generally of equal importance and do not need to goin any particular order. Each item begins with a tag. Unorderedlists may be nested inside unordered lists or inside any other types oflists (one list inside of another list inside of another list). A line spaceautomatically is inserted before and after an unordered list (that is, anentire line is skipped between an unordered list and any text before andafter it), exceptfor (on most browsers) a list nested within another list.

    The initial tag may contain within it this parameter as part of thecommand:

    TYPE="DISC"|"SQUARE"|"CIRCLE": designates the appearance of thebullets 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. Exampleof format:

    Item

    Item

    Item

    ordered list: delineates a list, where the items are insequential, numerical order. Each item begins with a tag. Orderedlists 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, anentire line is skipped between an ordered list and any text before andafter it), exceptfor (on most browsers) a list nested within another list.

    The initial tag may contain within it this parameter as part of thecommand:

    TYPE="I"|"A"|"1"|"a"|"i": designates the appearance of the numberspreceding the items in the list and, therefore, is conducive to building anoutline 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

  • 7/29/2019 AssFinal_set1

    31/50

    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 () tag may contain within it this parameter:

    VALUE="1"|"2"|"3"|...|"N": immediately changes the number of thatitem 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:

    First item

    Second item

    Third item

    definition list: delineates a list, where the items areindividual terms paired with their definitions, and each definition isindented and placed one line down from each term. Definition lists maybe nested inside definition lists or inside any other types of lists (one listinside of another list inside of another list). A line space automatically isinserted before and after a definition list (that is, an entire line isskipped between a definition list and any text before and after it),excluding a list nested within another list.

    definition list: same as & ,except each definition is placed on the same line as each term.

    Within the definition list are terms, each marked with an emptydefinition-listterm tag, as well as the actual definitions of the terms, each marked with anemptydefinition-list definition tag:

    : creates (but does not place bullets in front of) terms included in aglossary or definition list.

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

    Sikkim Manipal University Page 31

  • 7/29/2019 AssFinal_set1

    32/50

    PGDCA Semester 1 Assignment set 1

    terms in a glossary or definition list.

    directory list: creates a directory listing where eachentry is indented . Directory lists may be nested inside directory lists orinside any other types of lists. On most browsers, a line spaceautomatically is inserted before and after a directory list (that is, anentire line is skipped between a directory list and any text before andafter it), exceptfor (on many browsers) a list nested within another list.

    EXAMPLE OF APPLICATION TO DEMONSTRATE USAGE OF LISTS

    CODE:

    DEMO FOR LISTS IN HTML

    UNORDERED LIST

    Objectives

    Acquire a comprehensive collection of

    multimedia materials

    Develop appropriate user education and

    training packages

    ORDERED LIST

    Library Resources

    Library Collections

    Library Catalog

    Electronic Resources

    NESTED LISTS

    Library Collections

    Sikkim Manipal University Page 32

  • 7/29/2019 AssFinal_set1

    33/50

    PGDCA Semester 1 Assignment set 1

    Books

    Journals

    Library Catalog

    Electronic Resources

    CD-ROMs

    Abstracts & Indexes

    LIST ATTRIBUTES

    Library Collections

    Books

    Journals

    Library Catalog

    Electronic Resources

    CD-ROMs

    Abstracts & Indexes

    DEFINITION LIST

    Definition Term Definition

    Membership Card

    Users of the library must present their membership card at thereception for services and privileges.

    Sikkim Manipal University Page 33

  • 7/29/2019 AssFinal_set1

    34/50

    PGDCA Semester 1 Assignment set 1

    SCREENSHOT:

    4. Describe the following with respect to Form Controls:

    Sikkim Manipal University Page 34

  • 7/29/2019 AssFinal_set1

    35/50

    PGDCA Semester 1 Assignment set 1

    a. Form Controls

    A form in a web page is user by a computer user to enter data that will besent to a web server for processing. So it can be consider as a paper or adatabase form, because internet users fill out the forms using elements suchas checkboxes,radio button, or text fields. For example, webforms can beused to enter user details or credit card data to make a reservation of aservice or can be used to retrieve data.

    User interact with forms through controls. So we have the followingcontrols:

    - 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 theyhave entered. The form is sent to the server. Once it is clicked, there is nopossiblity of going back. The "submit" input displays the text that youspecify in the value attribute, but if no value is specified, the button facewill 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, andaccepts no data from the user. However, a resetcontrol is a very destructivecontrol to introduce to a web page, as pressing it will clear all the data alreadyentered into the form in which the resetbutton resides and set them to

    their initial value. . Push button: This type of input doesn't have a predefined behavior likesubmit or reset button. Generally it contains only some script which isexecuted 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 ayes 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. Whenthe form is submitted, the server will be interested in the value attributeattached to the control, and the state of the checkbox (checked orunchecked). When youre specifying a checkbox input, the control shouldcome first, and be followed by the associated text. Checkboxes allows user toselect several values from the same property. The input element is used tocreate 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

  • 7/29/2019 AssFinal_set1

    36/50

    PGDCA Semester 1 Assignment set 1

    origin of its name. In old-fashioned radio sets, tuning between stations wasntachieved 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 stationscould 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 controlcan be selected from a range, and if you select another, the previouslyselected input is deselected. For this control to work, though, each radiobutton in the range that you want users to choose from must have the samename attribute.

    So radio button is a little bit like checkbox, but here the difference iswhen 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.

    - MenusA 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 becombined with the OPTGROUP and OPTIONelements.

    - Text This is the most common kind ofinput 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 cantype any character in most of the cases.

    However a TEXTAREA element can be created, but unlike the INPUTelement, 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 selectGenerally 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 atext input, and a button control thats labelled Browse. The text thatappears on this button cant be changed, and a file upload control is generallydifficult 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. TheINPUT element is used to create a file select control.

    - Hidden Controls A hidden form inputis one that, though it doesnt appear on the page, canbe used for storing a value. The valuein a hidden field may be set at page-load time (it may be written using server-side scripting, as in the examplebelow), or it may be entered or changed dynamically, via JavaScript. Authorsgenerally use this control type to store information between client/serverexchanges that would otherwise be lost due to the stateless nature of HTTPprotocol.

    - Object Controls

    Sikkim Manipal University Page 36

  • 7/29/2019 AssFinal_set1

    37/50

    PGDCA Semester 1 Assignment set 1

    This type of control is used by the programmer to create some kind ofcontrol that are present most of the time inside a form element, but sometimethey can also be outside the FORM element declaration in the cas of buildinguser interface.

    b. The FORM elementThe tag is used to create an HTML form for user input.

    The element can contain one or more of the following form elements:

    This element has a number of attributes which specify actions to beperformed 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 acceptedby the server processing this form.

    Accept: specifies a comma-separated list of content types that a serverprocessing this form will handle correctly.

    Name: It names the element so that it may be referred to from style sheets orscripts.

    c) The INPUT elementThe 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

  • 7/29/2019 AssFinal_set1

    38/50

    PGDCA Semester 1 Assignment set 1

    Size: Tells the user agent the initial width of the control. Width is in pixels ingeneral.

    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 specifiesthat the button is on.

    SRC: When this has image value it specifies the location of the image to beused to decorate the graphical submit button.

    d) The BUTTON elementButtons created with this element function same as those created by INPUT

    element but offer richer rendering possibilities. This element may havecontent. Visual user agents may render BUTTON buttons with relief and anup/down motion when clicked, while they may render INPUT buttons as flatimages. 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 aboveconcepts and show the appropriate web page output as a screenshot.

    Form Control

    DEMONSTRATE USAGE OF FORMS CONTROLS

    Personal InformationLast Name: First Name: Address: Please specify picture file:

    Sikkim Manipal University Page 38

  • 7/29/2019 AssFinal_set1

    39/50

    PGDCA Semester 1 Assignment set 1

    Medical History

    Smallpox

    Mumps

    Dizziness

    Sneezing

    . . .

    More

    HypertensionTachicardyHypertrophy

    LatexGlucose

    Current MedicationAre you currently taking any medication?YesNo

    If you are currently taking medication, please indicateit in the space below:

    Sikkim Manipal University Page 39

  • 7/29/2019 AssFinal_set1

    40/50

    PGDCA Semester 1 Assignment set 1

    Send

    Reset

    SCREENSHOT:

    Sikkim Manipal University Page 40

  • 7/29/2019 AssFinal_set1

    41/50

    PGDCA Semester 1 Assignment set 1

    Book ID: B0724

    Sikkim Manipal University Page 41

  • 7/29/2019 AssFinal_set1

    42/50

    PGDCA Semester 1 Assignment set 1

    1. What is Depreciation?

    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 assetswill eventually lose all their economic value due to a combination ofaging,wear and tear, deterioration and/or obsolescence.

    Generally it is used to spread the cost of an asset over the span ofseveral years. In simple words we can say that depreciation is the reductionin 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 ofattributing the historical or purchase cost of an asset across its useful life,roughly corresponding to normal wear and tear. Depreciation is oftenmistakenly seen as a basis for recognizing impairment of an asset, butunexpected changes in value, where seen as significant enough to accountfor, are handled through write-downs or similar techniques which adjust thebook value of the asset to reflect its current value.

    Therefore, it is important to recognize that depreciation, when used as atechnical accounting term, is the allocation of the historical cost of an assetacross 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 inrecording accounting transactions. Different professional bodies across theworld have made recommendations on accounting principles in recent years.

    The principles are collectively known as GAAP (Generally AcceptedAccounting Principles). Accounting principles are classified intoa) Accounting Concepts andb) Accounting Conventions.

    Accounting Concepts:

    They are postulates, assumptions or conditions upon which accountingrecords and statements are based. They are developed to convey the samemeaning to everyone. Some of the major concepts are:

    a) Entity Conceptb) Dual Aspect Conceptc) Going Concern Conceptd) Money measurement Concepte) Cost Conceptf) Cost-attach conceptg) Accounting Period Concepth) Accrual Concept

    Sikkim Manipal University Page 42

  • 7/29/2019 AssFinal_set1

    43/50

    PGDCA Semester 1 Assignment set 1

    i) Periodic Matching of Cost and Revenue Conceptj) Realization Concept andk) Verifiable Objective Evidence Concept

    Accounting Conventions:

    Conventions are the customs or traditions guiding the preparation ofaccounting statements. They are adapted to make financial statements clearand meaningful. The major conventions are:

    a) Convention of Disclosureb) Convention of Materialityc) Convention of Consistency andd) Convention of Conservatism.

    3. How do you prepare Flexible Budget?

    The following illustration represents how a flexible budget can beprepared. A budget is to be prepared for 6000 and 8000 units production.Administrative expenses are fixed for all levels of production. The expensesbudget for production of 10000 units in a factory is displayed below:

    Details Per units (Rs)

    Materials 70

    Labor 25Variable overheads 20

    Fixed overheads (Rs 100000) 10

    Variable Expenses (Direct) 5

    Selling Expenses (10% fixed)13 13

    Distribution Expenses (20% fixed) 7

    Administration Expenses (Rs 50000) 5

    Total 155

    Table 1 : Expenses budget for 10000 units production for company ABC

    Solution:

    a) Materials, labor, direct expenses and variable overheads are variablecosts. Hence cost/unit will be the same in all production levels.

    b) Fixed overheads are constant for all production levels.c) 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.

    Sikkim Manipal University Page 43

  • 7/29/2019 AssFinal_set1

    44/50

    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.70The 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 Rs13000.Hence total selling expenses for 6000 units = Rs 83000.Similarly, distribution expenses are calculated.

    Cost 6000 units 8000 units 10000 unitsPerunit Total

    Perunit Total

    Perunit Total

    Materials 70 420000 70560000 70 700000

    Labor 25 150000 25200000 25 250000

    DirectExpenses 5 30000 5 40000 5 50000

    Prime Costs

    100 600000 100

    800000 100 1000000

    Factory

    overheads

    Fixed 16.67 100000 12.5100000 10 100000

    Variable 20 120000 20160000 20 200000

    Factory Cost 136.67 820000 132.51060000 130 1300000

    Administrative 8.33 50000 6.25 50000 5 50000

    Expenses 145 870000 138.751110000 135 1350000

    Selling

    &DistributionExpenses

    Selling 13.87 83200 13.32106600 13 130000

    Distribution 7.93 47600 7.35 58800 7 70000

    Total Cost 166.8 1000800 159.351275400 155 1550000

    Table 2 : Flexible budget calculations for 6000 and 8000 units production

    4. Briefly explain concept of Profit/Volume Ratio.

    Sikkim Manipal University Page 44

  • 7/29/2019 AssFinal_set1

    45/50

    PGDCA Semester 1 Assignment set 1

    This is popularly known as P/V Ratio. It expresses the relationshipsbetween contribution and sales. Its expressed in percentage. P/V ratio can becalculated in either of the following ways:

    (1)OR

    Where C = Contribution (difference between sales and variable costs),S = Sales andV = Variable Costs.

    P/V ratio can be determined by expressing change in profit or loss inrelation to change in sales. P/V ratio indicates the relative profitability ofdifferent products, processes and departments. If information about twoperiods is given, P/V ratio is calculated as:

    P/V ratio is more important to watch in business. Its the indicator of therate at which the organization is earning profit. A high ratio indicates high

    profitability and a low one indicates low profitability. Its useful to calculateBreak Even Point and at a given level of sales, what sales are required to earna certain amount of profit etc. Higher P/V indicates that a firm is in goodfinancial health. P/V ratio can be improved by taking the following steps:

    a) Sales increaseb) Reduction in marginal costs andc) Concentration on sales of profitable product.

    Limitations:

    a) Depends heavily on contributionb) Indicates only relative profitability.c) Over simplification may lead to wrong conclusions.d) Higher ratio shows the most profitable item only when other conditions

    are constant.e) Fails to consider the capital outlays required by additional productive

    capacity.

    Factors affecting P/V Ratio:

    Sikkim Manipal University Page 45

  • 7/29/2019 AssFinal_set1

    46/50

    PGDCA Semester 1 Assignment set 1

    a) Fixed Costb) Sales Volumec) Selling Price and

    d) Variable Cost/Unit.

    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 theend of the accounting period indicate the amount of changes that havetaken place in assets, liabilities and capital.

    b) Profit and Loss Account: The P&L a/c of the current period enables todetermine the amount of cash provided by or used in operations duringthe accounting period after making adjustments for non-cash, currentassets and current liabilities

    c) Additional Data: In addition to the above statements, additional data arecollected to determine how cash has been provided or used like sale orpurchase of assets for cash.

    Cash Flow Statements (CFS) differ from Funds Flow Statements (FFS) in the

    following manner:

    a) FFS is based on accrual accounting system while CFS preparationinvolves all transactions effecting cash or cash equivalents.

    b) FFS analyzes sources and application of funds of long-term nature andnet increase/decrease I long-term funds will be reflected on the firmsworking capital. CFS only considers increase/decrease in current assetsand liabilities in calculating cash flow of funds from operations

    c) FF analysis is useful for long range financial planning while CF analysisidentifies and rectifies current liquidity problems of the firm.

    d) FFS is a broader concept compared to CFS.

    e) CFS is mandatory unlike FFS.f) FFS tallies funds generated from various sources with various uses to

    which they are put. CFS starts with opening balance of cash and reachto the closing balance of cash by proceedings through sources and usesof cash.

    6. Write a short note on:

    Sikkim Manipal University Page 46

  • 7/29/2019 AssFinal_set1

    47/50

    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 FlowStatement. Here, all Current Assets and Current Liabilities are individuallylisted. Against each account, the figure pertaining to that account at thebeginning and at the end of the accounting period is shown. The net changein its position is also shown. The changes taking place with respect to eachaccount should add up to equal the net change in working capital, as shownby 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 betweenthese 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 preparingAdjusted Profit and Loss Account statement.

    c) Sources and Application of Funds

    Sources:

    a) Funds raised from Shares, Debentures and Long-term loans: The long-term funds are injected into the business during the year by issue ofshares/debentures and by raising long-term loans. Any premiums collectedalso are a part of this source.b) Sale of fixed assets and Long term investments: Amounts generated fromsale of fixed assets are a source of funds. FFS preparation here involves grosssale proceeds from the sale. This activity doesnt produce fresh funds but itreleases funds to finance the assets.

    Application:

    a) Repayment of Preference Capital or Debentures or long-term debit: Itrepresents the application of firms funds released from business throughredemption of preference shares or debentures, repayment of long-term loanspreviously made by the firm. A reduction in equity capital is also anapplication of funds.b) Purchase of fixed assets or long-term investments: Funds used topurchase long-term assets are the most significant application of funds duringthe year. This includes capital expenditures on land, machinery, furniture etc.c) Distribution of dividends and payment of taxes: Dividends distributed toshareholders 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 aremore than revenue, a cash outflow will be the result.

    Sikkim Manipal University Page 47

  • 7/29/2019 AssFinal_set1

    48/50

    PGDCA Semester 1 Assignment set 1

    ) Illustration:

    Following are the summarized Balance Sheet of X Ltd as on 31/12/2004and 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 flowstatement is to be prepared for 31/12/2005 with the help of the BalanceSheet.

    Liabilities 2004 2005 Assets 2004 2005

    Share Capital100000 125000 Goodwill 0 2500

    General Reserve 25000 30000Buildings 100000 95000

    P & L a/c 15250 15300 Plant 75000 84500Bank Loan (Long-term) 35000 67600 Stock 50000 37000Creditors 75000 0 Debtors 40000 32100Provision for Tax 15000 17500 Bank 0 4000

    Cash 250 300

    Total265250 255400 265250 255400

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

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

    Sikkim Manipal University Page 48

    Particulars 2004 2005Increases

    (-)Decreases

    (+)

    Current Assets

    Cash 250 300 50

    Bank 0 4000 4000 7900

    Debtors 40000 32100

    Stock 50000 37000

    90250 73400

    Current Liabilities

    Creditors 75000 75000

    Working Capital 15250 73400Net increase in WorkingCapital 58150 58150

    Total 73400 73400 79050 79050

  • 7/29/2019 AssFinal_set1

    49/50

    PGDCA Semester 1 Assignment set 1

    Sources Rs Particulars Rs

    Funds fromoperations 45050 Purchase of Plant 16500

    Issue of Shares 25000 Income tax paid 14000

    Bank Loan 32600 Dividend Paid 11500

    Goodwill Paid 2500Net increase in Workingcapital 58150

    Total 102650 102650

    Table 3: Funds Flow Statement

    7. What is Combined Ratios?

    Combined Ratios also known as mixed ratios are such ratios which establishrelationship between variables picked up from both the statements i.e.balance sheet and final account. For example debtors turnover, assetsturnover, 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 revenuestatements. e.g fixed asset turnover ratio, Debtors Turnover ratio, Creditorsturnover Ratio, Stock turnover Ratio...

    The different types of combined ratios are:a) Return on Capital Employed (ROCE)b) Return on Proprietors Fundsc) Earnings per shared) Dividend Payout Ratio ande) Debtors Turnover Ratio (Debtors Velocity)

    8. What is an audit?

    An audit is the examination and verification of a company's financial andaccounting records and supporting documents by a professional, such as aCertified Public Accountant.

    Also called financial statements , it is the review of the financialstatements 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

  • 7/29/2019 AssFinal_set1

    50/50

    PGDCA Semester 1 Assignment set 1

    presented.The financial report includes a balance sheet, an incomestatement, a statement of changes in equity, a cash flow statement, andnotes comprising a summary of significant accounting policies and otherexplanatory notes

    These financial analyses are usually done by certified public accountingfirms and forensic accountants who provide an objective view of the truefinancial integrity of a company. Audits are intended to show whether acompany's financial documentation matches its financial claims.

    The financial audit is one of many assurance or attestation functionsprovided by accounting and auditing firms, whereby the firm provides anindependent opinion on published information.Many organizations separatelyemploy or hire internal auditors who do not attest to financial reports butfocus mainly on the internal controls of the organization.

    It is not uncommon for a business to employee an internal auditor tomonitor financial controls of a company in addition to hiring outside auditors,but external auditors may choose to place limited reliance on the work ofinternal auditors.