Structured Programming Approach - May 2013
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) Explain the purpose of the following standard library functions:-
(iii)sqrt()(3 marks) 1 (b) Explain how a problem is defined with a suitable example.(4 marks) 1 (c) Explain the difference between for, while and do..while loops.(3 marks) 1 (d) Explain the difference between call by value and call by reference.(4 marks) 1 (e) Explain any three string standard library functions.(3 marks) 1 (f) Explain reference and de-reference operators with examples.(3 marks) 2 (a) Explain various storage classes used in C with examples.(5 marks) 2 (b) Write a program to calculate the sum of a list by passing array to a function.(5 marks) 2 (c) Write a C program to create an array of structure to store the details of almost 100 employees. Sort it according to employee ID. Employee details are Employee name, Employee ID and salary. (10 marks) 3 (a) Write an algorithm and draw a flowchart to calculate the roots of quadratic equation.(6 marks) 3 (b) Write a program to display Pascal triangle.
A B C
A B C D
A B C D E(6 marks) 3 (c) Explain Recursion concept. Write a program to display Fibonacci Series using recursion.(8 marks) 4 (a) Write an algorithm to sort a set of numbers in ascending order.
For above problem in which cases time complexity is calculated?(6 marks) 4 (b) Write a program to display Armstrong numbers between 1 to 1000.(6 marks) 4 (c) Write a program to calculate matrix multiplication and transpose for a matrix.(8 marks) 5 (a) Write the output for the following program:-
int x = 10, y, z;
z = y = x;
y -= --x;
z -= x--;
x -= --x x--;
printf( x = %d y = %d z = %d , x, y, z);
}</stdio.h>(6 marks) 5 (b) Write a program to calculate the sum of the series1/2 + 3/4 + 5/6+ .. + n terms(6 marks) 5 (c) Write a program to sort given numbers in descending order.(8 marks) 6 (a) Explain the difference between the switch statement, ladder of if-else and nested if-else.(6 marks) 6 (b) Write a recursive program to calculate the factorial of accepted number.(6 marks) 6 (c) Write a program to validate whether accepted string is palindrome or not.(5 marks) 6 (d) Explain how to read the contents of file and write into the file with syntax.(3 marks)