0
Programming in C and Data Structures : Question Paper May 2016 - First Year Engineering (C Cycle) (Semester 1) | Visveswaraya Technological University (VTU)

## Programming in C and Data Structures - May 2016

### First Year Engineering (C Cycle) (Semester 1)

TOTAL MARKS: 100
TOTAL TIME: 3 HOURS
(1) Question 1 is compulsory.
(2) Attempt any four from the remaining questions.
(3) Assume data wherever required.
(4) Figures to the right indicate full marks.
1(a) What is psecudo-code? Compare it with an algorithm.(5 marks) 1(b) Convert the following into ' C ' expression ; $$i) x^{y}{^z}\ \ ii) e^{|\sqrt{x}|}\ \ iii) \dfrac{a\cdot b}{\sqrt{c}\cdot d}\ \ iv) \sqrt{s(s-a)(s-b)(s-c)}.$$(4 marks) 1(c) Write a C program to find largest among three integers using ternary operators.(6 marks) 1(d) Explain formatted input and output statement with examples.(5 marks) 10(a) What is sack? Explain Write its applications.(8 marks) 10(b) Explain queue and write its applications.(8 marks) 10(c) Write a note on trees.(4 marks) 2(a) Write structure of C program. List primitive data types with size and range.(10 marks) 2(b) Define type casting. Explain with an example.(4 marks) 2(c) Evaluate following (where i = 2, j = 3, k = 4 and a = 5) :
i) a = i*( j/=k/i)
ii) a>>i%j
iii) * = a / i % i.
(6 marks)
3(a) Write a C program to grade student result based on following conditions ;
ii) 35≥ Marks <60 grade "Second class"
iii)60≥ marks <70 grade "First class"
iv) 70≥ marks ≤ 100 grade "First class with distinction".
(8 marks)
3(b) Explain switch statement with an example.(7 marks) 3(c) Write a note on goto statement.(5 marks) 4((c) What is dangling else problem? Explain how to handle this in C programming.(4 marks) 4(a) Explain cascade if-else and nested if-else satements.(6 marks) 4(b) Write a C program to implement simple calculator using operators +, - , * and /. Also handle divide by zero error. Use switch statement .(10 marks) 5(a) Define array? How two dimension arrays are declared and initialized ?(6 marks) 5(b) Write C program to genrate Fibonacci numbers using arrays.(6 marks) 5(c) Explain following string function:
i) strlen
ii) strcpy
iii) strcmp
iv) strcat.
(8 marks)
6(a) Explain various ways of passing parameters to the functions.(6 marks) 6(b) Write a C program to find factorial of an integer using recursive function.(8 marks) 6(c) Write a C program to find length of string without using strlcn ( ) recursive function.(6 marks) 7(a) Compare arrays with structures.(6 marks) 7(b) Define structure. Explain it with an example.(5 marks) 7(c) Explain the following :
i) typedef to define structure
ii) Accessing structure members
iii) Initialization of structure.
(9 marks)
8(a) Explain following file handling functions:
i) fopen ( )
ii) fclose ( )
iii) fscanf ( ) iv) fprinff ( )
v) fseek ( )
(10 marks)
8(b) Write a C program to create a integer data file and then segregate odd and even integers into two different files.(10 marks) 9(a) What is pointer ? Explain with program.(6 marks) 9(b) Explain the following :
i) #define
ii) #include
iii) nesting of macro
iv) argumented macro.
(10 marks)
9(c) Explain malloc and calloc functions.(4 marks)

0