Professional Documents
Culture Documents
2.
3.
4.
5.
6.
P a g e |1
7.
Using separate functions show: i. Access directly a value in an array for given the indices i, j without using A[i][j] but using the information from 4(iii) ii. Using pointer to functions, show how identical statement can be used to do different tasks Demonstrate: i. For a structure S that has two real number members x and y of which A, B and C are instances, functions that: a. Add corresponding elements of structure S where the structure are two real numbers x and y (as if C=A+B and S is a 2x1 matrix) b. Subtract the corresponding elements of the first with the second (C=A-B) c. Multiple the corresponding elements of the first with the second (C.x=A.x * B.x and C.y=A.y * B.y) ii. For a union U with variables of type int, float and a string of size 10 with instances I, F and S, that they can be used for completely different purposes which are data type dependent iii. Demonstrate various bitwise operations Write a function that for a given filename: i. Prints the contents of the file ii. Creates a file with content being its file name iii. Appends into the file its file name iv. Prints directly some content in a binary file
8.
9.
10. Write a program that uses set of programs (also to be written) as given below, which, when compiled together, work to serve various tasks. No extra functions should be used. i. fact.cpp: a function that gives the factorial of an integer ii. pi_fib.cpp: a function that gives pi times Fibonacci number iii. head.h: a header file with value defined for pi to 6 decimal places and a declaration mean that returns the average of two numbers iv. Outputs "Identical" if two files, named through command line, are identical 11. Demonstrate a function that: i. Inserts a given number into a linked list such that all numbers in the list remain sorted. Assume that the list, if not empty, is initially sorted. ii. For a structure that has two elements that are numbers, write a function that can traverse a doubly linked list in either direction.
P a g e |2