Solution to Mca Sem 1 Assignments

Embed Size (px)

Citation preview

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    1/48

    Name: SAMUEL TETTEH-NARTEY

    Roll Number: .................................................

    Learning Centre: 02544

    Course & Semester: MScCS SEMESTER 1

    Subject: COMPUTER PROGRAMMING C LANGUAGE Assignment No.: 2

    Subject Code: MC0061Date of Submission at the Learning Centre: 20TH FEBRUARY, 2012

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    2/48

    1. Describe the following:

    a. Function Prototypesb. Recursion

    ANSWER

    a. Function Prototype

    In modern C programming, it is considered good practice to use prototype declarations for allfunctions that you call. prototypes help to ensure that the compiler can generate correct code forcalling the functions, as well as allowing the compiler to catch certain mistakes that may exist inthe program.

    Generally, a function prototype can be written asdata-type name(type1, type2, , type n)

    Examples:int sample(int, int) or int sample(int a, int b);float fun(int, float) or float fun( int a, float b);

    void demo(void); Here void indicates function neither return any value to the caller nor ithas any arguments.

    If the function definition comes after the definition of its caller function, then the prototype isrequired in the caller, but the prototype is optional if the function definition precedes thedefinition of the caller function. But it is good programming practice to include the functionprototype wherever it is defined.

    It should be noted that unlike variables, the defining instance'' of a function is the function,including its body (that is, the brace-enclosed list of declarations and statements implementingthe function). An external declaration of a function, even without the keyword extern, looksnothing like a function declaration. Therefore, the keyword extern is optional in function

    prototype declarations. If you wish, you can writeint multbyfour(int);and this is just like an external function prototype declaration as

    extern int multbyfour(int);

    Example Program to illustrate that the function prototype is optional in the caller function

    #include

    char lower_to_upper(char ch) /* Function definition precedes main()*/{

    char c;c=(ch>=a && ch

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    3/48

    b. Recursion

    Recursion is a process by which a function calls itself repeatedly, until some specified conditionhas been met. The process is used for repetitive computations in which each action is stated interms of a previous result. Many repetitive problems can be written in this form.

    In order to solve a problem recursively, two conditions must be satisfied. First, the problem mustbe written in a recursive form, and the second, the problem statement must include a stoppingcondition.

    Example: The Towers of Hanoi.The Towers of Hanoi is a game played with three poles and anumber of different sized disks. Each disk has a hole in the center, allowing it to be stackedaround any of the poles. Initially, the disks are stacked on the leftmost pole in the order ofdecreasing size, i.e, the largest on the bottom, and the smallest on the top.

    The aim of the game is to transfer the disks from the leftmost pole to the rightmost pole, withoutever placing a larger disk on top of a smaller disk. Only one disk may be moved at a time, andeach disk must always be placed around one of the poles.

    The general strategy is to consider one of the poles to be the origin, and another to be thedestination. The third pole will be used for intermediate storage, thus allowing the disks to be

    moved without placing a larger disk over a smaller one. Assume there are n disks, numberedfrom smallest to largest, if the disks are initially stacked on the left pole, the problem of movingall n disks to the right pole can be stated in the following recursive manner:

    1. Move the top n-1 disks from the left pole to the center pole.2. Move the nth disk( the largest disk) to the right pole.3. Move the n-1 disks on the center pole to the right pole.

    The problem can be solved for any value of n greater than 0(n=0 represents a stoppingcondition).

    In order to program this game, we first label the poles, so that the left pole is represented as L,

    the center pole as C and the right pole as R. Let us refer the individual poles with the char-typevariables from, to and temp for the origin, destination and temporary storage respectively.

    #includemain(){

    void Recursive_Hanoi(int, char, char, char);int n;printf( Towers of Hanoi\n\n);printf( How many disks?);scanf(%d, &n);printf(\n);Recusrive_Hanoi(n, L, R, C);

    }

    void Recursive_Hanoi(int n, char from, char to, char temp){/* Transfer n disks from one pole to another *//* n= number of disksfrom=originto=destinationtemp=temporary storage */{

    If (n>0) {

    /* move n-1 disks from origin to temporary */Recursive_Hanoi(n-1, from, temp, to);

    /* move nth disk from origin to destination */printf( Move disk %d from %c to %c\n, n, from, to);

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    4/48

    /* move n-1 disks from temporary to destination */Recursive_Hanoi(n-1, temp, to, from);

    }return;

    }

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    5/48

    2. Explain the following looping structures with suitable code examples:

    While Loop

    DoWhile loop

    Simple For loop

    ANSWER

    While Loop

    A while loop has one control expression, and executes as long as that expression is true. Herebefore executing the body of the loop, the condition is tested. Therefore it is called an entry-controlled loop.

    The following example repeatedly doubles the number 2 (2, 4, 8, 16, ...) and prints the resultingnumbers as long as they are less than 1000:

    int x = 2;while(x < 1000){

    printf("%d\n", x);

    x = x * 2;}

    DoWhile Loop

    The dowhile loop is used in a situation where we need to execute the body of the loop beforethe test is performed. Therefore, the body of the loop may not be executed at all if the conditionis not satisfied at the very first attempt. Where as while loop makes a test of condition before thebody of the loop is executed.

    For above reasons while loop is called an entry-controlled loop and do..while loop is calledan exit-controlled loop.

    do while loop takes the following form:

    do{

    Body of the loop}While ( expression);

    On reaching the do statement , the program proceeds to evaluate the body of the loop first. Atthe end of the loop, the conditional expression in the while statement is evaluated. If theexpression is true, the program continues to evaluate the body of the loop once again. Thisprocess continues as long as the expression is true. When the expression becomes false, the

    loop will be terminated and the control goes to the statement that appears immediately after thewhile statement.

    On using the do loop, the body of the loop is always executed at least once irrespective of theexpression.

    Example: Program to print Multiplication Table

    main(){

    int rowmax=10,colmax=10,row,col,x;printf(" Multiplication table\n");printf("......................................\n");

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    6/48

    row=1;do{

    col=1;do{

    x=row*col;printf(%4d, x);

    col=col+1;}

    while (col

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    7/48

    3. With the help of a recursive function, write a program to find the factorial of anumber between 1 and 1000.

    ANSWER

    #includemain(){

    int n;

    long int fact(int);

    /* Read in the integer quantity*/scanf(%d, &n);

    /*calculate and display the factorial*/If (n

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    8/48

    6. Describe the following with the help of suitable programming examples:

    a. Abstract Data Types

    b. Stack as an Abstract Data Type

    c. Queue as an Abstract Data Type

    ANSWER

    Abstract Data Types

    An Abstract Data Type(ADT) is a data type that is organized in such a way that the specificationof the objects and the specification of the operations on the objects is separated from therepresentation of the objects and implementation of the operations.

    Some programming languages provide explicit mechanisms to support the distinction betweenspecification and implementation. Although C does not have an explicit mechanism forimplementing ADTs, it is still possible and desirable to design your data types using the samenotion.

    How does the specification of the operations of an ADT differ from the implementation of the

    operations? The specification consists of the names of every function, the type of its arguments,and the type of its result. There should also be a description of what the function does, butwithout appealing to internal representation or implementation details. This requirement isquite important, and it implies that an abstract data type is implementation independent.Furthermore, it is possible to classify the functions of a data type into several categories:

    1) Creator/constructor: These functions create a new instance of the designated type.2) Transformers: These functions also create an instance of the designated type, generally byusing one or more other instances.3) Observers/reporters: These functions provide information about an instance of the type, butthey do not change the instance.

    Typically, an ADT definition will include at least one function from each of these threecategories.

    Stack as an Abstract Data Type

    A stack is simply a list of elements with insertions and deletions permitted at one end calledthe stack top. That means that it is possible to remove elements from a stack in reverse orderfrom the insertion of elements into the stack. Thus, a stack data structure exhibits the LIFO (lastin first out) property. Push and pop are the operations that are provided for insertion of anelement into the stack and the removal of an element from the stack, respectively. Shown in thefigure below are the effects of push and pop operations on the stack.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    9/48

    Since a stack is basically a list, it can be implemented by using an array or by using a linkedrepresentation.

    Program to implement a stack using an array

    #include #define MAX 10 /* The maximum size of the stack */#include

    void push(int stack[], int *top, int value){

    if(*top < MAX ){

    *top = *top + 1;stack[*top] = value;

    }else{

    printf("The stack is full can not push a value\n");exit(0);

    }}void pop(int stack[], int *top, int * value){

    if(*top >= 0 ){

    *value = stack[*top];*top = *top - 1;

    }else{

    printf("The stack is empty can not pop a value\n");exit(0);

    }}void main(){

    int stack[MAX];int top = -1;

    int n,value;do{

    do{

    printf("Enter the element to be pushed\n");scanf("%d",&value);push(stack,&top,value);printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);printf("Enter 1 to pop an element\n");scanf("%d",&n);while( n == 1){

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    10/48

    pop(stack,&top,&value);printf("The value popped is %d\n",value);printf("Enter 1 to pop an element\n");scanf("%d",&n);

    }printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);}

    Program to implementa stack using Linked List

    # include # include struct node{

    int data;struct node *link;

    };struct node *push(struct node *p, int value){

    struct node *temp;temp=(struct node *)malloc(sizeof(struct node));/* creates new node

    using data valuepassed as parameter */if(temp==NULL){

    printf("No Memory available Error\n");exit(0);

    }temp->data = value;temp->link = p;p = temp;return(p);

    }struct node *pop(struct node *p, int *value){

    struct node *temp;

    if(p==NULL){printf(" The stack is empty can not pop Error\n");exit(0);

    }*value = p->data;temp = p;p = p->link;free(temp);return(p);

    }void main(){

    struct node *top = NULL;int n,value;

    do{do{

    printf("Enter the element to be pushed\n");scanf("%d",&value);top = push(top,value);printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);printf("Enter 1 to pop an element\n");scanf("%d",&n);while( n == 1){

    top = pop(top,&value);

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    11/48

    printf("The value popped is %d\n",value);printf("Enter 1 to pop an element\n");scanf("%d",&n);

    }printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);}

    Applications

    One of the applications of the stack is in expression evaluation. A complex assignmentstatement such as a = b + c*d/ef may be interpreted in many different ways. Therefore, to givea unique meaning, the precedence and associativity rules are used. But still it is difficult toevaluate an expression by computer in its present form, called the infix notation. In infixnotation, the binary operator comes in between the operands. A unary operator comes beforethe operand. To get it evaluated, it is first converted to the postfix form, where the operatorcomes after the operands. For example, the postfix form for the expression a*(bc)/d is abc*d/.

    A good thing about postfix expressions is that they do not require any precedence rules orparentheses for unique definition. So, evaluation of a postfix expression is possible using astack-based algorithm.

    Queue as an Abstract Data Type

    A queue is also a list of elements with insertions permitted at one endcalled the rear, anddeletions permitted from the other endcalled the front. This means that the removal ofelements from a queue is possible in the same order in which the insertion of elements is madeinto the queue. Thus, a queue data structure exhibits the FIFO (first in first out) property. Insertand delete are the operations that are provided for insertion of elements into the queue and theremoval of elements from the queue, respectively shown in the figure below Initially both frontand rear are initialized to -1.

    Program to implement a queue using an array

    #include #define MAX 10 /* The maximum size of the queue */

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    12/48

    #include void insert(int queue[], int *rear, int value){

    if(*rear < MAX-1){

    *rear= *rear +1;queue[*rear] = value;

    }else{

    printf(The queue is full can not insert a value\n);exit(0);

    }}void delete(int queue[], int *front, int rear, int * value){

    if(*front == rear){

    printf(The queue is empty cannot delete a value\n);exit(0);

    }*front = *front + 1;*value = queue[*front];

    }void main(){

    int queue[MAX];

    int front,rear;int n,value;front=rear=(-1);do{

    do{

    printf(Enter the element to be inserted\n);scanf(%d,&value);insert(queue,&rear,value);printf(Enter 1 to continue\n);scanf(%d,&n);

    } while(n == 1);printf(Enter 1 to delete an element\n);scanf(%d,&n);

    while( n == 1){

    delete(queue,&front,rear,&value);printf(The value deleted is %d\n,value);printf(Enter 1 to delete an element\n);scanf(%d,&n);

    }printf(Enter 1 to continue\n);scanf(%d,&n);

    } while(n == 1);}

    Program to implementaqueue using Linked List

    #include # include

    struct node{

    int data;struct node *link;

    };void insert(struct node **front, struct node **rear, int value){

    struct node *temp;temp=(struct node *)malloc(sizeof(struct node));/* creates new node using data value passed as parameter */if(temp==NULL){

    printf("No Memory available Error\n");

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    13/48

    exit(0);}temp->data = value;temp->link=NULL;if(*rear == NULL){

    *rear = temp;*front = *rear;

    }else{

    (*rear)->link = temp;*rear = temp;

    }}void delete(struct node **front, struct node **rear, int *value){

    struct node *temp;if((*front == *rear) && (*rear == NULL)){

    printf(" The queue is empty cannot delete Error\n");exit(0);

    }*value = (*front)->data;temp = *front;*front = (*front)->link;

    if(*rear == temp)*rear = (*rear)->link;

    free(temp);}void main(){

    struct node *front=NULL,*rear = NULL;int n,value;do{

    do{

    printf("Enter the element to be inserted\n");scanf("%d",&value);insert(&front,&rear,value);

    printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);printf("Enter 1 to delete an element\n");scanf("%d",&n);while( n == 1){

    delete(&front,&rear,&value);printf("The value deleted is %d\n",value);printf("Enter 1 to delete an element\n");scanf("%d",&n);

    }printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);

    }

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    14/48

    7. Describe with the help of suitable coding example, the implementation ofcircular queues.

    ANSWER

    The problem with the previous implementation of a queue is that the insert function gives aqueue-full signal even if a considerable portion is free. This happens because the queue has atendency to move to the right unless the front catches up with the rear and both are reset to 0

    again (in the delete procedure). To overcome this problem, the elements of the array arerequired to shift one position left whenever a deletion is made. But this will make the deletionprocess inefficient. Therefore, an efficient way of overcoming this problem is to consider thearray to be circular, as shown in the figure. Initially both front and rear are intitialized to 0.

    Program for implementation of circularqueue.

    #include #define MAX 10 /* The maximum size of the queue */#include void insert(int queue[], int *rear, int front, int value){

    *rear= (*rear +1) % MAX;if(*rear == front){

    printf("The queue is full can not insert a value\n");exit(0);

    }queue[*rear] = value;

    }void delete(int queue[], int *front, int rear, int * value){

    if(*front == rear){

    printf("The queue is empty can not delete a value\n");exit(0);

    }

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    15/48

    *front = (*front + 1) % MAX;*value = queue[*front];

    }void main(){

    int queue[MAX];int front,rear;int n,value;front=0; rear=0;do{

    do{

    printf("Enter the element to be inserted\n");scanf("%d",&value);insert(queue,&rear,front,value);printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);printf("Enter 1 to delete an element\n");scanf("%d",&n);while( n == 1){

    delete(queue,&front,rear,&value);printf("The value deleted is %d\n",value);printf("Enter 1 to delete an element\n");

    scanf("%d",&n);}printf("Enter 1 to continue\n");scanf("%d",&n);

    } while(n == 1);}

    Application

    One application of the queue data structure is in the implementation of priority queues requiredto be maintained by the scheduler of an operating system. It is a queue in which each elementhas a priority value and the elements are required to be inserted in the queue in decreasingorder of priority. This requires a change in the function that is used for insertion of an element

    into the queue. No change is required in the delete function.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    16/48

    8. Explain with suitable code examples, various possible file operations in Clanguage

    ANSWER

    Input/Output operations on files

    For each of the I/O library functions weve been using so far, theres a companion function

    which accepts an additional file pointer argument telling it where to read from or write to. Thecompanion function to printf is fprintf, and the file pointer argument comes first. To print a stringto the output.dat file we opened in the previous section, we might call

    fprintf(ofp, "Hello, world!\n");

    The companion function to getchar is getc, and the file pointer is its only argument. To read acharacter from the input.dat file we opened in the previous section, we might call

    int c;c = getc(ifp);

    The companion function to putchar is putc, and the file pointer argument comes last. To write acharacter to output.dat, we could call

    putc(c, ofp);

    Our own getline function calls getchar and so always reads the standard input. We could write acompanion fgetline function which reads from an arbitrary file pointer:

    #include /* Read one line from fp, *//* copying it to line array (but no more than max chars). *//* Does not place terminating \n in line array. */

    /* Returns line length, or 0 for empty line, or EOF for end-of-file. */int fgetline(FILE *fp, char line[], int max){

    int nch = 0;int c;max = max - 1; /* leave room for '\0' */while((c = getc(fp)) != EOF){

    if(c == '\n')break;

    if(nch < max){

    line[nch] = c;nch = nch + 1;

    }

    }if(c == EOF && nch == 0)return EOF;

    line[nch] = '\0';return nch;

    }

    Now we could read one line from ifp by calling

    char line[MAXLINE];...fgetline(ifp, line, MAXLINE);

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    17/48

    Predefined Streams

    Besides the file pointers which we explicitly open by calling fopen, there are also threepredefined streams. stdin is a constant file pointer corresponding to standard input, and stdoutis a constant file pointer corresponding to standard output. Both of these can be used anywherea file pointer is called for; for example, getchar() is the same as getc(stdin) and putchar(c) is thesame as putc(c, stdout). The third predefined stream is stderr. Like stdout, stderr is typicallyconnected to the screen by default. The difference is that stderr is not redirected when thestandard output is redirected. For example, under Unix or MS-DOS, when you invoke

    program > filename

    Anything printed to stdout is redirected to the file filename, but anything printed to stderr stillgoes to the screen. The intention behind stderr is that it is the standard error output; errormessages printed to it will not disappear into an output file. For example, a more realistic way toprint an error message when a file cant be opened would be

    if((ifp = fopen(filename, "r")) == NULL){

    fprintf(stderr, "can't open file %s\n", filename);exit or return

    }

    where filename is a string avalchanda indicating the file name to be opened. Not only is theerror message printed to stderr, but it is also more informative in that it mentions the name ofthe file that couldnt be opened.

    Error handling during I/O operations

    The standard I/O functions maintain two indicators with 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:

    #include void clearerr(FILE *stream);int feof(FILE *stream);int ferror(FILE *stream);void perror(const char *s);

    clearerrclears the error and EOF indicators for the stream.feofreturns non-zero if the streams EOF indicator is set, zero otherwise.ferrorreturns non-zero if the streams error indicator is set, zero otherwise.perror prints a single-line error message on the programs standard output, prefixed by thestring pointed to by s, with a colon and a space appended.

    The error message is determined by the value of errno and is intended to give some explanationof the condition causing the error. For example, this program produces the error messageshown:

    #include #include main(){

    fclose(stdout);if(fgetc(stdout) >= 0){

    fprintf(stderr, What no error!\n);exit(EXIT_FAILURE);

    }perror(fgetc);exit(EXIT_SUCCESS);

    }/* Result */fgetc: Bad file number

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    18/48

    Random access to files

    The file I/O routines all work in the same way; unless the user takes explicit steps to change thefile position indicator, files will be read and written sequentially. A read followed by a writefollowed by a read (if the file was opened in a mode to permit that) will cause the second read tostart immediately following the end of the DATA just written. (Remember that stdio insists on theuser inserting a buffer-flushing operation between each element of a read-write-read cycle.) Tocontrol 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 indicatesthe 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.Their declarations and descriptions follow.

    #include /* return file position indicator */long ftell(FILE *stream);int fgetpos(FILE *stream, fpos_t *pos);/* set file position indicator to zero */void rewind(FILE *stream);/* set file position indicator */

    int fseek(FILE *stream, long offset, int ptrname);int fsetpos(FILE *stream, const fpos_t *pos);

    ftell returns the current value (measured in characters) of the file position indicator if streamrefers to a binary file. For a text file, a magic number is returned, which may only be used on asubsequent call to fseek to reposition to the current file position indicator. On failure, -1L isreturned and errno is set.

    rewind sets the current file position indicator to the start of the file indicated by stream. Thefiles error indicator is reset by a call of rewind. No value is returned.

    fseek allows the file position indicator for stream to be set to an arbitrary value (for binary files),or for text files, only to a position obtained from ftell, as follows:

    y In the general case, the file position indicator is set to offset bytes (characters) from apoint in the file determined by the value of ptrname. Offset may be negative. The valuesof ptrname may be SEEK_SET, which sets the file position indicator relative to thebeginning of the file, SEEK_CUR, which sets the file position indicator relative to itscurrent value, and SEEK_END, which sets the file position indicator relative to the end ofthe file. The latter is not necessarily guaranteed to work properly on binary streams.

    y For text files, offset must either be zero or a value returned from a previous call to ftellfor the same stream, and the value of ptrname must be SEEK_SET.

    y fseek clears the end of file indicator for the given stream and erases the memory of anyungetc. It works for both input and output.

    y Zero is returned for success, non-zero for a forbidden request.

    Note that for ftell and fseek it must be possible to encode the value of the file position indicatorinto a long. This may not work for very long files, so the Standard introduces fgetpos andfsetpos which have been specified in a way that removes the problem. fgetpos stores thecurrent file position indicator for stream in the object pointed to by pos. The value stored ismagic and only used to return to the specified position for the same stream using fsetpos.

    fsetpos works as described above, also clearing the streams end-of-file indicator and forgettingthe effects of any ungetc operations.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    19/48

    For both functions, on success, zero is returned; on failure, non-zero is returned and errno isset.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    20/48

    Name: SAMUEL TETTEH-NARTEY

    Roll Number: .................................................

    Learning Centre: 02544

    Course & Semester: MScCS SEMESTER 1

    Subject: BASIC WEB DEVELOPMENT Assignment No.: 2

    Subject Code: MC0064

    Date of Submission at the Learning Centre: 20TH FEBRUARY, 2012

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    21/48

    1. Describe the tags involved in creation of lines and paragraphs in a HTML

    page. Write HTML code to demonstrate the usage of at least 5 tags pertaining

    to these.

    ANSWER

    Paragraphs: the P element9FL!5#!5#9FL3FRJ5FWFLWFUM

    *]UQFSFYNTS

    y9MJUFWFLWFUMJQJRJSYX!5#YFLRFWPXYMJGJLNSSNSLTKFUFWFLWFUM9MJJSI

    TKF

    UFWFLWFUMHFSGJRFWPJI\NYM!5#.YNXFGQTHPQJ[JQJQJRJSY

    &YYWNGZYJX&1.,3"1*+9(*39*77.,-9/:89.+>

    9MJ5JQJRJSYWJUWJXJSYXFUFWFLWFUM.YHFSSTYHTSYFNSGQTHPQJ[JQJQJRJSYX

    NSHQZINSL5NYXJQK

    (TSYWTQQNSLQNSJGWJFPX& QNSJ GWJFP NX IJKNSJI YT GJ F HFWWNFLJ WJYZWS ]) F QNSJ KJJI

    ]&TW

    FHFWWNFLJWJYZWSQNSJKJJIUFNW&QQQNSJGWJFPXHTSXYNYZYJ\MNYJXUFHJ

    +TWHNSLFQNSJGWJFPYMJ'7JQJRJSY

    9MJ'7JQJRJSYKTWHNGQ^GWJFPXJSIXYMJHZWWJSYQNSJTKYJ]Y

    9FL!'7#

    9FL3FRJ1NSJ'WJFP

    *]UQFSFYNTS

    y.Y NXF YJ]YQJ[JQ JQJRJSY FS JRUY^JQJRJSYHTSXNXYNSLTKYMJ !'7# YFL

    \MNHM

    KTWHJXFQNSJGWJFPNS-921YJ]Y

    &YYWNGZYJX(1*&7"1*+9&QQ7.,-9343*

    y1*+9 NSXJWYX XUFHJ YMFY FQNLSX YMJ KTQQT\NSL YJ]Y \NYM YMJ QJKY RFWLNS

    INWJHYQ^GJQT\F

    QJKYFQNLSJIKQTFYNSLNRFLJ

    y&QQUQFHJXYMJKTQQT\NSLYJ]YUFWYFQQKQTFYNSLNRFLJX

    y7.,-9 NSXJWYX XUFHJ YMFY FQNLSX YMJ KTQQT\NSL YJ]Y \NYM YMJ WNLMY RFWLNS

    INWJHYQ^

    GJQT\FWNLMYFQNLSJIKQTFYNSLNRFLJ

    y343*NXYMJIJKFZQY\MNHMITJXSTYMNSL

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    22/48

    JL-JQQT!'7#

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    23/48

    9MJKTQQT\NSLJ]FRUQJXMT\XFUWJKTWRFYYJI[JWXJKWTR8MJQQ^XUTJR

    9TF8P^QFWP

    !57*#

    -NLMJWXYNQQFSIMNLMJW

    +WTRYMJJFWYMYMTZXUWNSLJXY

    1NPJFHQTZITKKNWJ

    9MJGQZJIJJUYMTZ\NSLJXY

    &SIXNSLNSLXYNQQITXYXTFWFSIXTFWNSLJ[JWXNSLJXY

    !57*#

    -JWJNXMT\YMNXNXY^UNHFQQ^WJSIJWJI

    -NLMJWXYNQQFSIMNLMJW

    +WTRYMJJFWYMYMTZXUWNSLJXY

    1NPJFHQTZITKKNWJ9MJGQZJIJJUYMTZ\NSLJXY

    &SIXNSLNSLXYNQQITXYXTFWFSIXTFWNSLJ[JWXNSLJXY

    (.9*

    9FL!(.9*#!(.9*#

    9FL3FRJ8MTWY(NYFYNTS

    y .Y NX F YJ]YQJ[JQ JQJRJSY ZXJI YT NSINHFYJ YMFY JSHQTXJI YJ]Y NX F

    HNYFYNTSYNYQJXTKJ]HJWUYXVZTYJXWJKJWJSHJXKWTRFSTYMJWXTZWHJ

    y 9J]Y\NYMNS!(.9*#FSI!(.9*#NXZXZFQQ^WJSIJWJINSNYFQNHXJL!5#.

    MF[JWJFIFSIWJWJFI

    !(.9*#2TG^)NHP!(.9*#GZY.XYNQQHFSSTYRFPJMJFIXSTWYFNQXTKNY!5#

    (4)*

    9FL!(4)*#!(4)*#

    9FL3FRJ(TIJ

    y .YNXFYJ]YQJ[JQJQJRJSYZXJIYTJSHQTXJUWTLWFRXTWXFRUQJXTKHTIJYT

    TKKXJYYMJRKWTRSTWRFQYJ]YFSINXZXZFQQ^INXUQF^JINSFRTSTXUFHJI

    KTSYJL!5#9TZXJYMJFZYTRFYNHIFYJKJFYZWJNS*]HJQOZXYJSYJW

    !(4)*#")FYJ!(4)*#NSYTFHJQQ!5#

    9FL!)*1#!)*1#

    9FL3FRJ)JQJYJ8JHYNTS

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    24/48

    y .YRFWPXYJ]YYMFYMFXGJJSIJQJYJIKWTRFUWJ[NTZX[JWXNTSTKYMJ>>>22))9MMRRXX9?)

    y 2FWPXYMJ YNRJ\MJS^TZ HMFSLJI YMJ ITHZRJSY 9MJ FYYWNGZYJX[FQZJ

    HTSKNWRXYTYMJYNRJIFYJXUJHNKNHFYNTS9MJFGGWJ[NFYNTSXXMT\SFGT[J

    WJKJWYTYMJKTQQT\NSLIFYJFSIYNRJNSKTWRFYNTS

    ^^^^"9MJ^JFW

    22"9MJY\TINLNYRTSYMKTWJ]FRUQJKTW2FWHM

    ))"9MJIF^

    9"9MJGJLNSSNSLTKYMJYNRJXJHYNTS

    MM"9MJMTZWNSRNQNYFW^YNRJMTZWX\NYMTZYURXUJHNKNHFYNTS

    RR"9MJRNSZYJ

    XX"9MJXJHTSI

    9?)"9MJYNRJ?TSJ

    ?"9MJ(TTWINSFYJI:SN[JWXFQ9NRJ(:9

    MMRR"9MJQTHFQYNRJYMFYNXMTZWXMMFSIRNSZYJXRRFMJFITK

    YMJ(:9

    MMRR"9MJ1THFQYNRJYMFYNXMTZWXMMFSIRNSZYJXRRGJMNSIYMJ

    (:9

    9FL!.38#!.38#

    9FL3FRJ.SXJWYJI8JHYNTS

    *]UQFSFYNTS

    .IJSYNKNJXXJHYNTSXTKF

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    25/48

    y 'TYMYMJXJJQJRJSYXFWJXUJHNFQM^GWNIJQJRJSYX9MJ^FWJZSNVZJNSYMNX

    WJXUJHYYMJ^ FWJ YMJ TSQ^ Y\T JQJRJSYXZXJI NS YMJGTI^ TK FS -921

    ITHZRJSYYMFYFWJSTYYJ]YQJ[JQTWGQTHPQJ[JQJQJRJSYX

    *]FRUQJ!-#1FYJXY3J\X!-#

    !.38)&9*9.2*"9

    (.9*"MYYU\\\YTWNHTRZUIFYJQTLMYR#

    !5#

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    26/48

    *]UQFSFYNTS

    y .YNXFYJ]YQJ[JQJQJRJSYYMFYRFWPXYJ]YYTGJJSYJWJIG^YMJZXJWFY

    YMJPJ^GTFWI

    y .YHMFSLJX YMJ Y^UJXY^QJ KTW FQQ YMJ YJ]Y NYHTSYFNSX Y^UNHFQQ^ NSYTF

    RTSTXUFHJI KTSY QNPJ YMTXJ ZXJI NS HMFWFHYJW RTIJ HTRUZYJW YJWRNSFQ

    INXUQF^X

    JL!5#9TXYFWYYMJUWTLWFRMNYYMJ!0')#8!0')#PJ^FSIUWJXXYMJ

    !0')#(FWWNFLJ7JYZWS!0')#YMJSMTQITSYT^TZWMFY!5#

    9FL!8&25#!8&25#

    9FL3FRJ8FRUQJ9J]Y

    9MNXYJ]YQJ[JQJQJRJSYZXJXYMJ!8&25#FSI!8&25#YFLXYTNSINHFYJXFRUQJ

    TZYUZYYJ]YKWTRFHTRUZYJWUWTLWFR1NPJYMJPJ^GTFWIJQJRJSYYMJXFRUQJ

    JQJRJSYXYJ]YNXTKYJSWJSIJWJINSFRTSTXUFHJIKTSYFSIRZQYNUQJXUFHJXFWJHTQQFUXJI 9MJ PJ^GTFWI JQJRJSY NX ZXJI KTW YJ]Y YMFY F ZXJW RZXY JSYJW

    \MJWJFX YMJ XFRUQJ JQJRJSY NX ZXJI KTW YJ]Y YMFY F HTRUZYJW LJSJWFYJX NS

    WJXUTSXJYTFZXJWXFHYNTS

    JL ! 5# .SXYJFI TK LN[NSL RJ YMJ J]UJHYJI WJXZQYX YMJ HTRUZYJW PJUY

    UWNSYNSLN

    !8&25#&QQ\TWPFSISTUQF^RFPJX/FHPFIZQQGT^!8&25#T[JWFSIO

    T[JWFLFNS.FRSTYXZWJ\MFYNYRJFSX!5#

    9FL!89743,#!89743,#

    9FL3FRJ8YWTSL*RUMFXNX

    .Y NX F YJ]YQJ[JQ JQJRJSY YMFY UWT[NIJX XYWTSL JRUMFXNX KTW PJ^ \TWIX TW

    UMWFXJX\NYMNS

    STWRFQGTI YJ]Y QNXYX FSITYMJWGQTHPQJ[JQJQJRJSYX9J]Y\NYMNS FXYWTSL

    JQJRJSYNX

    ZXZFQQ^WJSIJWJIFXGTQITWLN[JSFXYWNIJSYUWTSZSHNFYNTSG^FYJ]YYTXUJJHM

    WJFIJW

    JL !5# .X\JFW NK YMJ^ IT STYLN[J RJ YMFY WFNXJ!89743,#YTRTWWT\

    !89743,#.VZNY!5#

    9FL!;&7#!3&7#

    9FL3FRJ;FWNFGQJYJ]Y

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    27/48

    y 9MNX YJ]YQJ[JQ JQJRJSY RFWPX ZU YMJ F[FQHMFSIFX ZXJI NS HTRUZYJW

    UWTLWFRXTWYMJUFWYXTKFHTRUZYJWHTRRFSIHMTXJSG^YMJZXJW

    y 9MJ YJ]Y NX ZXZFQQ^ WJSIJWJI FX RTSTXUFHJI FSI QNPJ YMJ PJ^GTFWI

    JQJRJSYRZQYNUQJXUFHJXFWJHTQQFUXJI

    JL !U#9MJ KTWRZQF KTW YMJ !;&7#INXYFSHJYWF[JQQJI !3&7# NSRNQJX NX

    !;&7#8UJJI!3&7#NSRNQJXUJWMTZWRZQYNUQNJIG^!;&7#YNRJ!;&7#NS

    MTZWX!U#

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    28/48

    2. Write a note on elements of Multimedia

    ANSWERCapture devices-Video Camera, Video Recorder, Audio Microphone, Keyboards, Mice, graphics tablets,3D input devices, tactile sensors, VR devices. Digitising/Sampling Hardware

    Storage Devices

    - Hard disks, CD-ROMs, Jazz/Zip drives, DVD, etc

    Communication Networks- Ethernet, Token Ring, FDDI, ATM, Intranets, Internets.

    Computer Systems- Multimedia Desktop machines, Workstations, MPEG/VIDEO/DSP Hardware

    Display Devices- CD-quality speakers, HDTV,SVGA, Hi-Res monitors, Colour printers etc.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    29/48

    3. Explain the various tags that are used in HTML.

    ANSWER

    BASIC HTML Tags

    HTMLYour HTML document should always start with "" and end with"."

    HEADInside your HTML tags, you should have the HEAD element: ..... The HEADelement contains information about the document. For example, the HE AD element maycontain the TITLE element, as well as other types of tags that provide more description aboutthe site that may be used bysearch engines.

    TITLEThe TITLE element is nested inside of the HEAD tags. It looks somethinglike this:This is the title of a page.

    Titles should be descriptive! In fact, many search engines place a high ranking on how

    "relevant" your title is compared to the rest of the content onyour page. So instead of:Introduction

    A better title would be:Introduction to Australian Shepherds

    BODYThe BODY element usually comes after the HEAD element, and containseverything that willshow up in the browser window.

    Paragraphs, Headings, Line Breaks, and DividersH1, H2, H3, H4, H5, H6

    H1, H2, H3, H4, H5, and H6 are "Heading" elements.

    The H1 element isthe most important heading. H2, H3, ... H6 can then be used to showsubheadings.

    Most web browsers display headings in bold text, and display H1 at a large text size,H2 at aslightly smaller text size, and so on. They also put "blank lines" before and after the heading, sothat it is separate from the rest of the content. However, the size, color, and othervisual displayoptions can be controlled with style sheets. Each heading element does have the ALIGNattribute described below.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    30/48

    P

    Use the

    ...

    tags to show that a section of text is a paragraph.Most web browsers willput an extra "blank line" before and after the paragraph to separate it from other paragraphs.This can be controlled with style sheets aswell. Similar to headings, the P element also acceptsthe ALIGN attribute,although this is also deprecate

    BR

    If the Paragraph element usually has white space around it, how do you "carriage return" onlyone line? The BR element inserts a "line break" in the text.

    This is the first line.
    This is a new line from the line above, but is not a new paragraph.

    Looks like:This is the first line.This is a new line from the line above, but is not a new paragraph.

    HR

    The HR element inserts a "horizontal rule" on your page to help separate content.Most webbrowsers also put space before and after the rule. A BASIC horizontal rule lookslike this: TheHR element has several deprecated attributes that change the width, height, color,or look of thehorizontal rule. These can also be set by using style sheets.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    31/48

    4. Explain the applications of style sheets in web pages with coding examples.

    ANSWER

    Purpose of Style Sheets

    The purpose of style sheets is to separate the content of the HTMLdocuments from their style.This makes control over the style much easier and group efforts easier since content of an

    entire set of HTML pages can be easilycontrolled using one or more style sheets.STYLE sheets or the inline STYLE element will allow you to set custommargin sizes, and thetext font, color and sizes of various elements that are usedon your web page. Size of marginscan be set in inches (in), pixels(px),percentages (%), centimeters (cm) or the (em). The unit ofem is the em is theheight of the font. Two em units is twice the height of the font. When the emunits are used, everything is scaled relative to the font so the scaling will remain the sameregardless of the font used.

    Methods of Including Style

    Methods of including style content in an HTML document:

    y Embedding - Use the STYLE element in the HE AD element to create a stylesheet that is embedded in the header. Example:

    y Linking - Use the link element in the HTML header to link an external text filestyle sheet to the HTML document. Example:

    y Importing - One style sheet may be imported from another by using the"@import" command in the style sheet that is performing the import.

    y Inline - Style information may be included with each individual element using theSTYLE attribute which is common to all elements.

    Example Embedded Style Sheet

    When setting document style, place the STYLE element with the beginning tag and ending tag between the HEAD and the BODY elements.Therefore placement wouldbe as follows:

    Example Style Settings

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    32/48

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    33/48

    "PRE.center { text-align: center }".

    Using the ID Attribute

    The ID attribute is useful since it allows you to specify exactly which element will have thedesired style. This is done with a line like the following asshown in the style sheet exampleabove.

    hr#firsthr { color: #80b0ff; height: 15; width: 100% }

    When the first horizontal line is declared on the HTML page it is declaredas follows:

    The line for the code in this example is at the top of this page. All otherlines on the page appearas defined by the following entry from the above stylesheet:

    hr { color: #80b0ff; height: 5; width: 50%; text-align: center }

    The line appears below and in several other places on this page.

    Context Selection

    Allows elements containing inline elements to have special assignedvalues as in the followingexample:

    table b ( color: red }

    This example sets the color of any bold text in a table to red.

    Grouping Elements for Style Characteristics

    The example above contains the following line:

    h1, h2 { text-align: center }

    This line allows style characteristics to be assigned to both elements H1and H2 at the sametime. The elements are separated by commas.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    34/48

    Name: SAMUEL TETTEH-NARTEY

    Roll Number: .................................................

    Learning Centre: 02544

    Course & Semester: MScCS SEMESTER 1

    Subject: DIGITAL SYSTEMS, COMPUTER ORGANIZATION AND ARCHITECTURE

    Assignment No.: 1

    Subject Code: MC0062

    Date of Submission at the Learning Centre: 20TH FEBRUARY, 2012

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    35/48

    1. Convert the following binary numbers to decimala. 11.001 (2)b. 1100(2)c. 1111 (2)d. 1011.101 (2)

    ANSWER

    a. 11.001 (2) = (1 x 20)+(1 x 21)+(0 x 2-1)+(0 x 2-2)+(1 x 2-3)

    = 1 + 2 + 0 + 0 + 0.125= 3.125 (10)

    b. 1100 (2) = (0 x 20)+(0 x 21)+(1 x 22)+(1 x 23)

    = 0 + 0 + 4 + 8= 12(10)

    c. 1111 (2) = (1 x 20)+(1 x 21)+(1 x 22)+(1 x 23)

    = 1 + 2 + 4 + 8= 15(10)

    d. 1011.101 (2) = (1 x 20)+(1 x 21)+(0 x 22)+(1 x 23)+(1 x 2-1)+(0 x 2-2)+(1 x 2-3)

    = 1 + 2 + 0 + 8 + 0.5 + 0 + 0.125= 11.625(10)

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    36/48

    2. Use Boolean algebra to simplify the logic function and realize the given function and

    minimized function using discrete gates. babdcbaf !

    ANSWER

    Realization of the given function

    a

    b

    c

    d

    f

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    37/48

    Minimizing the function

    a

    c

    bf

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    38/48

    3. Simplify the given logic expressions with the given three inputs.

    !!mm

    ,,,fand,,,,,f 654276521021

    ANSWER

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    39/48

    4.Explain the following for Instructions:

    A). Data processing

    B).Data storage

    C). Data movement

    D). Control

    ANSWER

    Data Processing

    Data transfer s the most fundamental type of machine instruction. The data transfer mustspecify

    1 the location of the source and destination each location can be memory, register or topof stack

    2 the length of the data to be transferred3 The mode of addressing for each operand

    If both the operands are CPU registers, then the CPU simply causes data to be transferred fromone register to another. This operation is internal to the CPU. If one or both operands are inmemory, then the CPU must perform some or all of the following actions:

    y Calculate the memory address, based on the address mode.y If the address refers to virtual memory, translate from virtual to actual memory address.y Determine whether addressed item is in cache.y If not issue command to memory module.

    For example: Move, Store, Load (Fetch), Exchange, Clear (Reset), set, Push, Pop

    Arithmetic: Most machines provide basic arithmetic functions like Add, Subtract, Multiply,Divide. They are invariably provided for signed integer numbers. Often they are also providedfor floating point and packed decimal numbers. Also some operations include only a singleoperand like Absolute that takes only absolute value of the operand, Negate that takes thecompliment of the operands, Increment that increments the value of operand by 1, Decrementthat decrements the value of operand by 1.

    LogicalMachines also provide a variety of operations for manipulating individual bits of a wordOften referred to as bit twiddling. They are based on Boolean operations like AND, OR, NOT,XOR, Test, Compare, Shift, Rotate, Set control variables.

    Data Storage

    Computer data storage, often called storageor memory, refers to computer components andrecording mediathat retain digital dataused for computing for some interval of time. Computerdata storage provides one of the core functions of the modern computer, that of informationretention. It is one of the fundamental components of all modern computers, and coupled with acentral processing unit (CPU, a processor), implements the basic computer model used sincethe 1940s.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    40/48

    Primary storage (ormain memory orinternal memory), often referred to simply as memory,is the only one directly accessible to the CPU. The CPU continuously reads instructions storedthere and executes them as required. Any data actively operated on is also stored there inuniform manner.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    41/48

    Secondary storage (also known as external memory or auxiliary storage), differs from primarystorage in that it is not directly accessible by the CPU. The computer usually uses itsinput/output channels to access secondary storage and transfers the desired data usingintermediate area in primary storage. Secondary storage does not lose the data when thedevice is powered downit is non-volatile. Per unit, it is typically also two orders of magnitudeless expensive than primary storage. Consequently, modern computer systems typically havetwo orders of magnitude more secondary storage than primary storage and data is kept for alonger time there.

    Tertiary storage or tertiary memory,provides a third level of storage. Typically it involves arobotic mechanism which will mount(insert) and dismountremovable mass storage media intoa storage device according to the system's demands; this data is often copied to secondarystorage before use. It is primarily used for archiving rarely accessed information since it is muchslower than secondary storage (e.g. 560 seconds vs. 1-10 milliseconds). This is primarilyuseful for extraordinarily large data stores, accessed without human operators. Typicalexamples include tape librariesand optical jukeboxes.

    Data Movement

    Instructions to copy data and perform arithmetic operations reference two operands. The first

    called the "source" (abbreviated as src) describes an operand (a variable) from which data isonly obtained, and the second operand, called the destination (dst or dest) describes a variableto whom the operation is applied. By default, two-operand instructions operate on words (2-bytes=16 bits) at a time. This default option can be explicitly specified by a ".w" suffix. Tooperate on bytes, a ".b" suffix can be specified instead.

    For example,

    mov.b &0x1000, &1002 ; move 1 byte from 0x1000 to 0x1002

    Is a "byte move" instruction, which implements an assignment operator (=). This instructioncopies one byte from from (source) address 0x1000 to the (destination) address 0x1002. The

    ampersand (&) is required.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    42/48

    Control

    The control unit is the part of a computerthat controls the computer's operation. Basically, each

    part of the computer requires control signals to arrive at particular times for each instruction ofthe computer's software. The control unit provides those control signals. The control system'sfunction is as followsnote that this is a simplified description, and some of these steps may beperformed concurrently or in a different order depending on the type of CPU:

    1 Read the code for the next instruction from the cell indicated by the program counter.2 Decode the numerical code for the instruction into a set of commands or signals for each

    of the other systems.3 Increment the program counter so it points to the next instruction.4 Read whatever data the instruction requires from cells in memory (or perhaps from an

    input device). The location of this required data is typically stored within the instructioncode.

    5 Provide the necessary data to an ALU or register.

    6 If the instruction requires an ALU or specialized hardware to complete, instruct thehardware to perform the requested operation.7 Write the result from the ALU back to a memory location or to a register or perhaps an

    output device.8 Jump back to step (1).

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    43/48

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    44/48

    Virtual memory increases the effective size of the main memory. Only the active space of thevirtual address space is mapped onto locations in the physical main memory, whereas theremaining virtual addresses are mapped onto the bulk storage devices used. During a memorycycle the addressing spacing mechanism (hardware or software) determines whether theaddressed information is in the physical main memory unit. If it is, the proper information isaccessed and the execution proceeds. If it is not, a contiguous block of words containing thedesired information are transferred from the bulk storage to main memory displacing some blockthat is currently inactive.

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    45/48

    6.Explain the addition of a two floating point numbers with examples.

    ANSWER

    The steps (or stages) of a floating-point addition:

    1 The exponents of the two floating-point numbers to be added are compared to find thenumber with the smallest magnitude

    2 The significand of the number with the smaller magnitude is shifted so that theexponents of the two numbers agree3 The significands are added4 The result of the addition is normalized5 Checks are made to see if any floating-point exceptions occurred during the addition,

    such as overflow6 Rounding occurs

    Example: s = x+ yy numbers to be added are x= 1234.00and y = -567.8y these are represented in decimal notation with a mantissa (significand) of four digitsy six stages (A - F) are required to complete the addition

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    46/48

    Name: SAMUEL TETTEH-NARTEY

    Roll Number: .................................................

    Learning Centre: 02544

    Course & Semester: MScCS SEMESTER 1

    Subject: DISCRETE MATHEMATICS

    Assignment No.: 1

    Subject Code: MC0063

    Date of Submission at the Learning Centre: 20TH FEBRUARY, 2012

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    47/48

  • 8/2/2019 Solution to Mca Sem 1 Assignments

    48/48

    1. If },,{},,{},,,{},,,,,{ ecbCedBdcaAedcbaU !!!! then evaluate the following

    a) (AB) v (BC)

    b) (BC)dvA

    c) (BA)vCd

    d) Adv (BC)

    e) (AB)dv (BC)