Structured Programming Approach - Dec 2012
First Year Engineering (Semester 2)
TOTAL MARKS: 80
TOTAL TIME: 3 HOURS (1) Question 1 is compulsory.
(2) Attempt any three from the remaining questions.
(3) Assume data if required.
(4) Figures to the right indicate full marks. 1 (a)(i) Explain inline function? (2 marks) 1 (a)(ii) Explain why break and continue statements are used in program.(2 marks) 1 (a)(iii) Explain the basic difference between a structure and a union with an example.(2 marks) 1 (a)(iv) What is a constructor? Explain in brief.(2 marks) 1 (a)(v) What will be the output of the following program code:-
for(int i = 0; i < 10; i++)
cout << Hello World << endl;
cout << i = << i ;
}</iostream.h>(2 marks) 1 (b) What is OOP? Explain its features.(5 marks) 1 (c) Explain data types in C with respect to their keyword, memory requirement and range.(5 marks) 2 (a) Write a program to print the Pascal triangle.
14641(10 marks) 2 (b) Explain storage classes with suitable example.(10 marks) 3 (a) Explain bitwise operators. (5 marks) 3 (b) Write a recursive program to calculate the factorial of a given number.(5 marks) 3 (c) Write a program to read two matrices and perform multiplication on them. Display the resultant matrix.(5 marks) 3 (d) Differentiate between while and do-while.(5 marks) 4 (a) Explain call-by-value and call by reference with example.(10 marks) 4 (b) Define a structure Employer with the following variables:-
(i) Employee code
(ii) Employee name
(iii) Employee salary
(iv) Employee designation
Write a program to read the structure for 10 employees and display record in sorted order of employee code.(10 marks) 5 (a) What is operator Overloading? Overload operator += on complex number.(10 marks) 5 (b) What is virtual function? What is its need? (5 marks) 5 (c) What is abstract class? Give one example. (5 marks) 6 (a) What is inheritance? Explain its types.(5 marks) 6 (b) Explain logical operators. Write a C program to show the same.(10 marks) 6 (c) What is dynamic binding? Write a program to implement it.(5 marks)
Write short notes on any four.
7 (a) This pointer(5 marks) 7 (b) Function overloading(5 marks) 7 (c) Data abstraction and encapsulation(5 marks) 7 (d) Access Specifiers(5 marks) 7 (e) Friend Function(5 marks)