M3-R4: Programming & Problem Solving Through 'C' Language January 2019

PART TWO
(Answer any FOUR questions)

5.
(a) Compare the use of switch statements with the use of nested if statements. Which is more convenient?
(b) Explain break, continue and goto statements with example.
(c)  Write a program to print all prime numbers from 1 to 100. Use nested loops, break or continue statement wherever necessary.

6.
(a) Explain the difference between = and == operator with example.
(b) What will be the output of the following program segment?
 main()
 {
     int x=3,y=5;
     if(x==3)
     printf(“\n%d”,x);
     else
     printf(“\n%d”,y);
 }
Answer: 3
(c) Write a program to find the sum of the digits of a number.

7.
(a) What is call by value and call by reference? Write a program to swap two numbers using call by value.
(b) What do you understand by local, global and static variables ? Explain.
(c) Compare the lifetime, Scope, Initial value and storage place of all storage classes.

8.
(a) Write a program to add a new node to the beginning of a linked list and to the end of linked list.
(b) What is a file in C? Discuss various modes in which a file can be opened. Also discuss types of files.

9.
(a) Write a note on pointers and its uses. What do you mean by referencing and de-referencing of a pointer variable?
(b) Explain any five string handling functions in detail with example.
(c) Write a program to reverse an array.

No comments:

Post a Comment