1. A
possible output of the following program fragment is
for (i=getchar();; i=get.char())
if (i==‘x’) break;
else putchar(i);
(A) mi
(B) mix
(C) mixx
(D) none of the above
Answer: D
Explanation:
None of the above as it is wrong syntax.
2.
int
**ptr; is
(A)
Invalid declaration
(B)
Pointer to pointer
(C)
Pointer to integer
(D)
none of the above
Answer: B
3.
The
address of a variable temp of type float is
(A)
*temp
(B)
&temp
(C)
float& temp
(D)
float temp&
Answer: B
4.
What
is the output of the following code
char
symbol[3]={‘a’,‘b’,‘c’};
for
(int index=0; index<3; index++)
cout
<< symbol [index];
(A)
a b c
(B)
“abc”
(C)
abc
(D)
‘abc’
Answer: C
5.
The
process of building new classes from existing one is called .............
(A)
Polymorphism
(B)
Structure
(C)
Inheritance
(D)
Cascading
Answer: C
6.
If
a class C is derived from class B, which is derived from class A, all through
public
inheritance,
then a class C member function can access
(A)
protected and public data only in C and B.
(B)
protected and public data only in C.
(C)
private data in A and B.
(D)
protected data in A and B.
Answer: D
7.
If
the variable count exceeds 100, a single statement that prints “Too many” is
(A)
if (count<100) cout << “Too many”;
(B)
if (count>100) cout >> “Too many”;
(C)
if (count>100) cout << “Too many”;
(D)
None of these.
Answer: C
8.
Usually
a pure virtual function
(A)
has complete function body.
(B)
will never be called.
(C)
will be called only to delete an object.
(D)
is defined only in derived class.
Answer: D
9.
The
output of the following will be
for
(x=1, y=5; x+y<=10; x++)
{
printf(“%d%d”,
x,y);
y++;
}
(A) 1 5
2 6
3
7
(B) 1 5
2
6
3
7
4
8
(C) 1 5
1
6
1
7
1
8
1
9
(D) 1 5
2
5
3
5
4
5
5
5
Answer: A
10.
The
................... statement causes immediate exit from the loop overriding
the condition test
(A)
Exit
(B)
Break
(C)
Goto
(D)
None of the above
Answer: B
0 Comments