PROBLEM SOLVING THROUGH C
· Question 1 is compulsory and carries 28 marks. Answer any FOUR questions from the rest. Marks are indicated against each question.
· Parts of a question should be answered at the same place.
Q.1 a. What is meant by compilation? What is meant by interpretation? How do these two processes differ?
b. To free we only pass the pointer to the block of memory that we want to deallocate. Then how does free( ) function know how many bytes it should deallocate?
c. What is meant by associativity? Discuss the associativity of arithmetic operators.
d. If a[i] = i++ is undefined, then by the same reason i = i+1 should be undefined. But it is not so. Why?
e. Discuss the characteristics of (i) extern variable (ii) automatic variable.
f. What are the two ways of opening a file? Explain with example.
g. If a = 7, b = 5, c = 3, what is output of (a>b?(a>c?3:4):(b>c?6:8)) (74)
Q.2 a. What are the rules for naming identifiers?
b. Using functions, write a program to find the scalar product of two vectors. (8+10)
Q.3 a. What is the difference between a keyword and an identifier?
b. Write a function, to insert a node at the end of a singly linked list. (8+10)
Q.4 a. What types of error generally occur while programming? Explain with examples.
b. Write a program to find maximum values stored in 2D array. (8+10)
Q.5 a. What is the purpose of typedef feature?
b. Write a recursive Program to generate Fibonacci series. (8+10)
Q.6 a. What is a structure? How structure elements can be accessed through (i) a
structure variable (ii) a pointer to a structure. Explain with examples.
b. Write a program to add two polynomials. (8+10)
Q.7 a. Write inorder and postorder traversal of the following graph.
A F L K C B D G E J H
b. Write a program for insertion sort. (8+10)