written 8.5 years ago by |
Programming in C and Data Structures - Jun 2015
First Year Engineering (C Cycle) (Semester 2)
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 are the data types? Mention the different data types supported by C language, giving an example to each.(5 marks)
1 (b) Write a C program which takes as input p,t,r compute the simple interest and display the result.(5 marks)
1 (c) What is an operator ? List and explain various types of operations(10 marks)
10 Write short notes on following
a) Preprocessor directives
b) Primitive and primitive data types
c) Stack operation
d) Types of queues(20 marks)
2 (a) What is a token? What are different types of token available in C language? Explain(5 marks)
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 marks)
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 marks)
3 (a) What are different types of conditional decision making statements? Explain each with examples(10 marks)
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 marks)
4 (a) Explain with examples formatted input output statements in C.(6 marks)
4 (b) List four differences between while loop and do-while loop along with syntax and example(6 marks)
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 marks)
5 (a) What is an array? Explain different methods of initialization of single dimensional arrays(6 marks)
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 marks)
5 (c) Hoe string is declared and initialized? Explain any FOUR string manipulator function with example(8 marks)
6 (a) Explain function cell, function definition and function prototype with example to each(6 marks)
6 (b) What are actual parameter and formal parameters? Illustrate with example(6 marks)
6 (c) What is recursion? Write a C program to compute the factors of given number 'n' using recursion(8 marks)
7 (a) How structure is different from an array? Explain declaration of a structure with an example(6 marks)
7 (b) Explain with an example, how to create a structure using 'typedef'.(4 marks)
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 marks)
8 (a) Explain following file operations along with syntax and examples:
i) fopen ii) fclose iii) fscanf() iv) fprint() v) fgets()(10 marks)
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 marks)
9 (a) Define point variable. Explain with an example, the declaration and initialization of pointer variable.(6 marks)
9 (b) Explain following C function along with syntax and example to each:
i) malloc() ii) calloc() iii) realloc() iv) free()(8 marks)
9 (c) Develop a C program to read two number and function to swap these number using pointers(6 marks)