adplus-dvertising
71. Trace the error:

void main( )
{
int *b, &a;
*b = 20
printf(“%d, %d”, a, *b)
}
a. No error
b. Logical error
c. Syntax error
d. Semantic error
Discuss
Answer: (c).Syntax error

72. Match the following:

a. calloc( )         i. Frees previously allocated space
b. free( )             ii. Modifies previously allocated space
c. malloc( )        iii. Allocates space for array
d. realloc( )        iv. Allocates requested size of space

Codes:
      a   b   c   d
a. iii   i    iv   ii
b. iii   ii    i   iv
c. iii   iv   i   ii
d. iv   ii   iii   i
Discuss
Answer: (a).iii   i    iv   ii

73. printf(“%c”, 100);
a. prints 100
b. prints ASCII equivalent of 100
c. prints garbage
d. none of the above
Discuss
Answer: (b).prints ASCII equivalent of 100

74. The ………….. memory allocation function modifies the previous allocated space.
a. calloc( )
b. free( )
c. malloc( )
d. realloc( )
Discuss
Answer: (d).realloc( )

75. The goal of operator overloading is
a. to help the user of a class
b. to help the developer of a class
c. to help define friend function
d. None of the above
Discuss
Answer: (a).to help the user of a class

76. How many of the following declarations are correct?

int z = 7.0;
double void = 0.000;
short array [2] = {0, 1, 2};
char c = “\n”;
a. None
b. One is correct
c. Two are correct
d. All four are correct
Discuss
Answer: (c).Two are correct

77. Which one of the following sentences is true?
a. The body of a while loop is executed at least once.
b. The body of a do … while loop is executed at least once.
c. The body of a do … while loop is executed zero or more times.
d. A for loop can never be used in place of a while loop.
Discuss
Answer: (b).The body of a do … while loop is executed at least once.

78. The statement

print f (“ % d”, 10 ? 0 ? 5 : 1 : 12);

will print
a. 10
b. 0
c. 12
d. 1
Discuss
Answer: (d).1

79. What will be the output of the following c-code?

void main ( )
{
char *P = "ayqm" ;
char c;
c = ++*p ;
printf ("%c", c);
}
a. a
b. c
c. b
d. q
Discuss
Answer: (c).b

80. Member of a class specified as …………… are accessible only to method of the class.
a. private
b. public
c. protected
d. derive
Discuss
Answer: (a).private