A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

91. How many constructors can a class have ?
a. zero
b. 1
c. 2
d. any number
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).any number

92. What is the effect of the following C code?

for(int i=1; i≤5; i=i+½)
printf(“%d,”,i);
a. It prints 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, and stops
b. It prints 1, 2, 3, 4, 5, and stops
c. It prints 1, 2, 3, 4, 5, and repeats forever
d. It prints 1, 1, 1, 1, 1, and repeats forever
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).It prints 1, 1, 1, 1, 1, and repeats forever

93. Consider the following declaration in C:

char a[];
char *p;

Which of the following statement is not a valid statement?
a. p=a;
b. p=a+2;
c. a=p;
d. p=&a[2];
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).a=p;

94. Consider the following C code:

{ int a=5, b=9;
float r;
r=b/a; }

What is the value of r ?
a. 1.8
b. 1.0
c. 2.0
d. 0.0
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).1.0

95. Function overloading is a concept in which:
a. a function is used to implement lots of tasks at the same time.
b. a function is called too many number of times by another function.
c. a function provides common interface to the user to carry out possibly different functions in each call.
d. a function is computationally too expensive for the system to handle.
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).a function provides common interface to the user to carry out possibly different functions in each call.

96. Which of the following is true?
a. A “static” member of a class cannot be inherited by its derived class.
b. A “static” member of a class can be initialized only within the class it is a member  of.
c. A “static” member of a class can be initialized before an object of that class is created.
d. Since “static” member of a class is actually a global element, it does not require a class/object qualifier to access it independently of class/object.
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).A “static” member of a class can be initialized before an object of that class is created.

97. What cannot replace ‘?’ in the following C code to print all odd numbers less than 100?

for(i=1;?;i+2)
printf(“%d\n”,i);
a. i≤100
b. i≤101
c. i<100
d. i<101
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).i≤101

98. Which of the following is not true in C++ ?
a. “Private” elements of a base class are not accessible by members of its derived class.
b. “Protected” elements of base class are not accessible by members of its derived class.
c. When  base  class  access  specified  is  “Public”,  public  elements  of  the  base class become public members of its derived class.
d. When base class access specified is “Public”, protected elements of a base class become protected members of its derived class.
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).“Protected” elements of base class are not accessible by members of its derived class.

99. Which of the following is true of constructor function in C++ ?
a. A class must have at least one constructor.
b. A constructor is a unique function which cannot be overloaded.
c. A constructor function must be invoked with the object name.
d. A constructor function is automatically invoked when an object is created.
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).A constructor function is automatically invoked when an object is created.

100. The following loop in ‘C’:

int i=0;
While(i++<0)i--;
a. will terminate
b. will go into an infinite loop
c. will give compilation error
d. will never be executed
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).will go into an infinite loop