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.

101. Which of the following ways are legal to access a class data member using this pointer?
a. this.x
b. *this.x
c. *(this.x)
d. (*this).x
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).(*this).x

102. If we store the address of a derived class object into a variable whose type is a pointer to the base class, then the object, when accessed using this pointer.
a. continues to act like a derived class object
b. continues to act like a derived class object if virtual functions are called
c. Acts like a base class object
d. Acts like a base class, if virtual functions are called
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).continues to act like a derived class object if virtual functions are called

103. Which of the following declarations are illegal?
a. void *ptr;
b. char *str = “hello”;
c. char str = “hello”;
d. const *int p1;
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).char str = “hello”;

104. What will be the result of the expression 13 & 25?
a. 38
b. 25
c. 9
d. 12
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).9

105. Which of the following operator can be overloaded through friend function?
a. ->
b. =
c. ( )
d. *
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).*

106. To access the public function fbase() in the base class, a statement in a derived class function fder() uses the statement
a. fbase();
b. fder();
c. base::fbase();
d. der::fder();
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).fbase();

107. If a base class destructor is not virtual, then
a. It can not have a function body
b. It can not be called
c. It can not be called when accessed from pointer
d. Destructor in derived class can not be called when accessed through a pointer to the base class
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).Destructor in derived class can not be called when accessed through a pointer to the base class

108. Maximum number of template arguments in a function template is
a. one
b. two
c. three
d. many
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).many

109. In access control in a protected derivation, visibility modes will change as follows:
a. private, public and protected become protected
b. only public becomes protected
c. public and protected become protected
d. only private becomes protected
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).public and protected become protected

110. Which of the following statement is valid?
a. We can create new C++ operators
b. We can change the precedence of the C++ operators
c. We can change the associativity of the C++ operators
d. We can not change operator templates
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).We can not change operator templates