Question1)a) Write a program that fills a matrix as follows:
• Both diagonal elements as 1’s .
• Rest of the elements as 0’s
The program should display the contents of the matrix using not more than two printf statements.
b) Define a structure called "Cricket" that will describe the following information:
Player _name,
DOB,
Team_name,
Batting_average
where DOB is itself another structure which have the members Date, Month, Year. Using cricket declare an array “player” with 10 elements and write a program to read the information about all the 10 players and print a team-wise list containing names of players, their DOB and batting average.
Question2)a) If m and n have been declared as integers and p1 and p2 as pointers to integers, then state errors, if any, in the following statements:
i) p1=&m;
ii) p2=n;
iii) *p1=&n;
iv) p2=&*&m;
v) m=p2*p1;
vi) p1=&p2;
vii) m=p1*+p2*++;
b) Write a program that reads a file containing integers and appends at its end the sum of all the integers. The file name is supplied in the command line.
Question3)a) How will you represent the following arrays as a sparse array using vector representation?
0 2 0 0 0 0 0
4 0 0 0 0 0 1
0 0 0 0 0 5 0
0 0 0 1 3 0 0
0 8 0 0 0 0 0
7 0 0 0 0 0 0
0 0 6 0 0 2 0
b) Convert the expression 2+3-5/7 * 8+4/5 into RPN . Evaluate it in RPN notation.
Question4)a) Modify the function “ add _term” given at page 35 of Block 3 so that after adding a term to the existing polynomials no term have zero coefficient.
b) Traverse the tree given below in preorder, inorder and postorder.
c) Check whether the following tree is complete or not.