MORE IN Programming in C and Data Structures
VTU First Year Engineering (C Cycle) (Semester 2)
Programming in C and Data Structures
June 2015
Total marks: --
Total time: --
INSTRUCTIONS
(1) Assume appropriate data and state your reasons
(2) Marks are given to the right of every question
(3) Draw neat diagrams wherever necessary

1 (a) What are the data types? Mention the different data types supported by C language, giving an example to each.
5 M
1 (b) Write a C program which takes as input p,t,r compute the simple interest and display the result.
5 M
1 (c) What is an operator ? List and explain various types of operations
10 M

2 (a) What is a token? What are different types of token available in C language? Explain
5 M
2 (b) Write C expressions corresponding to the following (Assume all quantities are of same type) i) $A=\frac{5x+3y}{a+b}$ ii)$B=\sqrt{s(s-a)(s-b)(s-c)}$ iii) $C=e^{\left | x+y-10 \right |}$
iv) D=x25+y 35 v)$X=\frac{e^{\sqrt{x}}+e^{\sqrt{y}}}{xsin -\sqrt{y}}$ vi) $X=\frac{-b+\sqrt{b^{2}-4ac}}{2a}$
6 M
2 (c) What is the value of 'x' in following code segments? Justify your answer:
i) int a,b;
float x;
a=4;
b=5;
x=b/a;
ii) int a,b;
float x;
a=4;
b=5;
x=(float) b/a;
6 M

3 (a) What are different types of conditional decision making statements? Explain each with examples
10 M
3 (b) Write a C program to simulate simple calculator that perform arithmetic operations using switch statement. Error message should be displayed; if any attempt is made to divide by zero
10 M

4 (a) Explain with examples formatted input output statements in C.
6 M
4 (b) List four differences between while loop and do-while loop along with syntax and example
6 M
4 (c) Design and devlop a C program to reverse a given four digit integer and check whether it is a palindrome or not
8 M

5 (a) What is an array? Explain different methods of initialization of single dimensional arrays
6 M
5 (b) Write a C program to read N integer into A and to
i) Find the sum odd numbers
ii) Find the sum if even number
iii) Find the average of all number
output the result computed with appropriate headings
6 M
5 (c) Hoe string is declared and initialized? Explain any FOUR string manipulator function with example
8 M

6 (a) Explain function cell, function definition and function prototype with example to each
6 M
6 (b) What are actual parameter and formal parameters? Illustrate with example
6 M
6 (c) What is recursion? Write a C program to compute the factors of given number 'n' using recursion
8 M

7 (a) How structure is different from an array? Explain declaration of a structure with an example
6 M
7 (b) Explain with an example, how to create a structure using 'typedef'.
4 M
7 (c) Write a C program to input the following details of 'N' student using structure:
Roll No: integer, Name : String , Marks :float, Grade: char
Print the name of the students with marks $\geq$ 70.0%
10 M

8 (a) Explain following file operations along with syntax and examples:
i) fopen ii) fclose iii) fscanf() iv) fprint() v) fgets()
10 M
8 (b) Write a C program to read the contents from the file called abc.txt, count the number of characters, number of lines and number of while spaces and output the same
10 M

9 (a) Define point variable. Explain with an example, the declaration and initialization of pointer variable.
6 M
9 (b) Explain following C function along with syntax and example to each:
i) malloc() ii) calloc() iii) realloc() iv) free()
8 M
9 (c) Develop a C program to read two number and function to swap these number using pointers
6 M

10 Write short notes on following
a) Preprocessor directives
b) Primitive and primitive data types
c) Stack operation
d) Types of queues
20 M

More question papers from Programming in C and Data Structures