Placement Papers: CDAC Paper 2006 Part 2

Examrace Placement Series prepares you for the toughest placement exams to top companies.

  1. The statement that prints out the character set from A-Z, is for (a = ‘z’ a < ‘a’ a = a − 1) printf ( “%c” &a); for (a = ‘a’ a ⇐ ‘z’ a = a + 1) printf ( “%c” &a); for (a = ‘A’ a ⇐ ‘Z’ a = a + 1) < printf ( “%c” a); ____Ans for (a = ‘Z’ a ⇐ ‘A’ a = a + 1) printf ( “%c” a)

  2. The statement which prints out the values 1 to 10 on separate lines, is for (count = 1; count ⇐ 10; count = count + 1) printf ( “%d\n” count); for (count = 1; count < 10; count = count + 1) printf ( “%d\n” count); ____ans for (count = 0; count ⇐ 9; count = count + 1) printf ( “%d” count); for (count = 1; count <> 10; count = count + 1) printf ( “%d\n” count)

  3. What does the term ‘call-by-reference’ refer to? Passing a copy of a variable into a function. Passing a pointer to a variable into a function. ____ans Choosing a random value for a variable. A function that does not return any values.

  4. What is the output of the following code? #include void swap (int& int&); void main () { int a = 10, b = 20; swap (a + +, b + + ); printf ( “\n%d\t%d\t” a, b); } void swap (int& x, int& y) { x + = 2; y + = 3; } 14, 24 11, 21____ans 10, 20 Error

  5. What is the output of the following program code #include void abc (int a[]) { a + +; a[1] = 612; } main () { char a[5]; abc (a); printf ( “%d” a[4]); } 100 612 Error<____ans None of these options

  6. which of the following is true about recursive function

    1. it is also called circular definition

    2. it occurs when a function calls another function more than once

    3. it occurs when a statement within the function calls the function itself

    4. a recursive function cannot have a return statement within it

    Which is correct?

    i and iii____ans

    i and ii

    ii and iv

    i, iii and iv

  7. What will happen if you assign a value to an element of an array whose subscript exceeds the size of the array? The element will be set to 0 Nothing, its done all the time Other data may be overwritten Error message from the compiler

  8. What is the output of the following code? #include void main () { int arr[2][3][2] = { { { 2, 4}, { 7, 8}, { 3, 4}, }, { { 2, 2}, { 2, 3}, { 3, 4}, }}; printf ( “\n%d” * * ( * arr + 1) + 2 + 7); } 16____ans 7 11 Error

  9. If int s[5] is a one dimensional array of integers, which of the following refers to the third element in the array? * (s + 2) ____ans * (s + 3) s + 3 s + 2

  10. #include “stdio. h” main () { int * p1, i = 25; void * p2; p1 = &i; p2 = &i; p1 = p2; p2 = p1; printf ( “%d” i); } The output of the above code is: Program will not compile____ans 25 Garbage value Address of I

  11. What is the output of the following code? void main () { int i = 100, j = 200; const int * p = &i; p = &j; printf ( “%d” * p); } 100 200____ans 300 None of the above

  12. void main () { int i = 3; int * j = &i; clrscr (); printf ( “%d%d” + + * j, * (&i) ); } What is the output of this program? 3 3 4 3____ans 4, address of i printed Error: Lvalue required

  13. What is the output of the following code? #include void main () { int arr[] = { 10, 20, 30, 40, 50}; int * ptr = arr; printf ( “\n %d\t%d\t” * ptr + +, * ptr); } 10 20 10 10____ans 20 20 20 10

  14. Which of these are reasons for using pointers?

    1. To manipulate parts of an array

    2. To refer to keywords such as for and if

    3. To return more than one value from a function

    4. To refer to particular programs more conveniently

    Which is correct?

    1. 1 & 3____ans

    2. Only 1

    3. Only 3

    4. All of the above

  15. struct number { int no; char name[25]; }; void main () { struct number n1[] = { { 25, “rose” }, { 20, “gulmohar” }, { 8, “geranium” }, { 11, “dahalia” }}; printf ( “%d%d” n1[2]. No ( * &n1 + 2), → no + 1); } What is the output of this program? 8 8 8 9____ans 9 8 8, unpredictable

  16. During initializing a union Only one member can be initialised. All the members will be initialised. Initialisation of a union is not possible. ____ans None of these options

  17. Self referential structure is one

    1. Consisting the structure in the parent structure

    2. Consisting the pointer of the structure in the parent structure

    Whichc is correct?

    Only a

    Only b

    Both a and b

    Neither a nor b

  18. Individual structure member can be initialized in the structure itself True False Compiler dependent None of these options

  19. Which of the following is the feature of stack? All operations are at one end It cannot reuse its memory All elements are of different data types Any element can be accessed from it directly____ans

  20. When stacks are created

Are initially empty____ans

Are initialized to zero

Are considered full

None of these options

Sign In