Material Content for PROGRAMMING AND PROBLEM SOLVING THROUGH C LANGUAGE January 2016

1. Each question below gives a multiple choice of answers. Choose the most appropriate one and enter in the “OMR” answer sheet supplied with the question paper, following instructions therein.(1x10)

1.1 Function of a compiler is to

A) put together the file and functions that are required by the program

B) translate the instructions into a form suitable for execution by the program

C) load the executable code into the memory and execute them

D) allow the user to type the program

1.2 The preprocessor directives start with

A) //

B) /

C) #

D) /*

1.3 Which of the following defines a variable ‘a’ as an array of pointers to integers?

A) int *b[10], a[10];

B) int *b, a[10];

C) int b, *a[10];

D) int b, (*a)[10];

1.4 Which of the following is not an infinite loop?

A) for (i = 1; i < 10; i--)

        printf("%d", i);  

B) while (i <= 10) {                // Assume i is initialized to 1

        printf("%d", i);

            if (i = = 3)

                continue;

            if (i = = 6)

                break; i++;

    }

C) do {                          // Assume i is initialized to 1

        printf("%d", i);

            if (i = = 3)

                continue;

            if (i = = 6)

                break;

            i++;

    }

D) while (i <= 10) {                // Assume i is initialized to 1

         printf("%d", i);

            if (i = = 6)

                continue;

            if (i = = 3)

                break; i++;

    }

1.5 Which of the following is the correct way to define a self-referential structure named ‘test’?

A) struct test {

           int              a;

           struct test     p;

    };

B) struct test {

           int             a;

           struct test    *p;

    };

C) struct test {

           int         a;

    }*t;

D) struct *test {

           int              a;

           struct test    p;

    };

1.6 What is the output of the following code segment?

     void fn() {

         int a = 10;

         static int b = 20;

         printf("a = %d b = %d ", ++a, ++b);

     }

     int main()   {

         fn();

         fn();

         return 0;

     }

A) a = 11 b = 21 a = 11 b = 21

B) a = 11 b = 21 a = 12 b = 21

C) a = 11 b = 21 a = 11 b = 22

D) a = 11 b = 21 a = 12 b = 22

1.7 Consider a structure defined as follows:

     struct student {

            int rollNo, marks;

            char name[30], course[30];

     } s, *sp;

Which of the following is the correct way to access the members of the structure?

A) sp.marks

B) sp -> rollNo

C) student.course

D) s -> name

1.8 Which of the following statements will not dynamically allocate space to store 10 integers?

A) int a[10];

B) int *p = (int *) malloc(10 * sizeof(int));

C) int *p = (int *) calloc(10, sizeof(int));

D) none of the above

1.9 What will be the output of the following code segment?

               int a = 100, b = 74;

               if (a++ > 100 && b++ > 200)

                   printf("High values with a = %d b = %d\n", a, b);

               if (a++ < 100 || b++ < 200)

                   printf("Low values with a = %d b = %d\n", a, b);

A) High values with a = 101 b = 74

B) Low values with a = 102 b = 75

C) High values with a = 102 b = 75

D) Low values with a = 101 b = 74

1.10 Which of the following can be used as a variable name?

A) no of students

B) char

C) 7th

D) myName

2. Each statement below is either TRUE or FALSE. Choose the most appropriate one and ENTER in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

2.1 Comments in the program make debugging of the program easier.

2.2 There is no difference between '\0' and '0'.

2.3 The fprintf() function can be used to display the output on the screen.

2.4 A float constant cannot be used as a case constant in a switch statement.

2.5 The statement void p; is valid.

2.6 while (0); is an infinite loop.

2.7 If char *p = "Structured Programming", then p[5] is 'c'.

2.8 A function can have any number of return statements.

2.9 In a union, space is allocated to every member individually.

2.10 An algorithm is a graphical representation of the logic of a program.

3. Match words and phrases in column X with the closest related meaning/ word(s)/phrase(s) in column Y. Enter your selection in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

question option
3.1 A necessary function  A. ++x
3.2 Pre-decrement  B. Node points to the next
3.3 Typecasting  C. test(a, test(a + b))
3.4 Call by reference  D. remove()
3.5 Linked list  E. fscanf()
3.6 Recursion  F. ~
3.7 Bitwise operator  G. fn(&a)
3.8 Removes dynamically allocated space  H. (float)
3.9 Function to read the contents of a file  I. --m
3.10 Comparing contents of two character arrays str1 and str2  J. main()
   K. delete()
   L. strcmp(str1, str2)
   M. fn(a)

4. Each statement below has a blank space to fit one of the word(s) or phrase(s) in the list below. Enter your choice in the “OMR” answer sheet supplied with the question paper, following instructions therein. (1x10)

4.1 A file can be opened for both reading and writing using ________ mode.

4.2 The preferred storage class if fast access is required for a variable is ________.

4.3 A function call for a function with the declaration void fn(int x, char c); is ________.

4.4 ________ is the file automatically connected to the keyboard for every program.

4.5 ________ is the character stored in the pointer value of the last node of a linked list.

4.6 The ________ operators are used to compare the values of integers.

4.7 If *pf is a pointer to float, then ++pf will increment its value by ________.

4.8 The brackets used to mark the boundaries of a block are ________.

4.9 Relevant ________ files have to be included in a program for library functions to work.

4.10 p -> name can be written as ________.

A. a+ B. stdin C. sizeof(float) D. '\0' E. "\0" F. (*p).name G. fn(int q, char c) H. register I. fn(12, 'n') J. {} K. logical L. Header M. relational

View More Material

Share