51. | When we pass an array as an argument to a function, what actually gets passed ? |
Discuss |
Answer: (c).Base address of the array
|
52. | While (87) printf("computer"); The above C statement will |
Discuss |
Answer: (d).print "computer" infinite times
|
53. | A friend function can be used to |
Discuss |
Answer: (c).allow one class to access an unrelated class
|
54. | What is the size of the following Union ? Assume that the size of int = 2, size of float = 4, size of char = 1 union tag { int a; float b; char c; }; |
Discuss |
Answer: (b).4
|
55. | What is the output of the following program segment? sum(n) { if ( n < 1 ) return n; else return (n + sum(n–1)); } main() { printf(“%d”, sum(5)); } |
Discuss |
Answer: (c).15
|
56. | Assume that x and y are non-zero positive integers. What does the following program segment perform? while (x!=0) { if (x>y) x = x-y else y=y-x; printf(“%d”,x); |
Discuss |
Answer: (b).Computes GCD of two numbers
|
57. | Consider the following program segment: d=0; for(i=1; i<31, ++i) for(j=1; j<31, ++j) for(k=1; k<31, ++k) if ((i+j+k)%3)= = 0); d = d + 1; printf(“%d”, d); The output will be |
Discuss |
Answer: (d).None of the above
|
58. | Consider the following two function declarations : (i) int *f( ) (ii) int (*f)( ) Which of the following is true ? |
Discuss |
Answer: (d).The first declaration is a function returning a pointer to an integer and the second is a pointer to function returning integer.
|
59. | Assume that we have constructor function for both Base and Derived classes. Now consider the declaration : main ( ) Base *p = new Derived; In what sequence, the constructor will be executed ? |
Discuss |
Answer: (b).Base class constructor is followed by Derived class constructor
|
60. | What is the output of the following program ? #include< stdio.h > main( ) { int a, b = 0; static int c[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; for (a=0; a<10;++a); if ((c[a]%2)= =0) b+=c[a]; printf(“%d”,b); } |
Discuss |
Answer: (d).20
|