Q.76 Which of the following expressions is illegal?
(A) ( ) 6 10 . (B) (false && true)
(C) bool (x) = (bool)10; (D) float y = 12.67;
Ans:C
Q.77 The actual source code for implementing a template function is created when
(A) The declaration of function appears.
(B) The function is invoked.
(C) The definition of the function appears.
(D) None of the above.
Ans:B
Q.78 An exception is caused by
(A) a runtime error.
(B) a syntax error.
(C) a problem in the operating system.
(D) a hardware problem.
Ans:A
Q.79 Which of the following statements are true in c++?
(A) Classes can not have data as public members.
(B) Structures can not have functions as members.
(C) Class members are public by default.
(D) None of these.
Ans:B
Q.80 What would be the output of the following program?
int main()
{
int x,y=10,z=10;
x = (y = =z);
cout<<x;
return 0;
}
(A) 1 (B) 0
(C) 10 (D) Error
Ans:A
Q.81 What is the error in the following code?
class t
{
virtual void print();
}
(A) No error.
(B) Function print() should be declared as static.
(C) Function print() should be defined.
(D) Class t should contain data members.
Ans:A
Q.82 What will be the output of following program?
#include<iostream.h>
void main()
{
float x;
x=(float)9/2;
cout<<x;
}
(A) 4.5 (B) 4.0
(C) 4 (D) 5
Ans:A
Q.83 A white space is :
(A) blank space (B) new line
(C) tab (D) all of the above
Ans:D
Q.84 The following can be declared as friend in a class
(A) an object (B) a class
(C) a public data member (D) a private data member
Ans:B
Q.85 What would be the output of the following?
#include<iostream.h>
void main()
{
char *ptr=“abcd”
char ch;
ch = ++*ptr++;
ut<<ch;
}
(A) a (B) b
(C) c (D) d
Ans:B
Q.86 A copy constructor takes
(A) no argument (B) one argument
(C) two arguments (D) arbitrary no. of arguments
Ans:B
Q87 Overloading a postfix increment operator by means of a member function takes
(A) no argument (B) one argument
(C) two arguments (D) three arguments
Ans:A
Q88 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
Ans:D
Q.89 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.
Ans:B
Q.90 Which of the following declarations are illegal?
(A) void *ptr; (B) char *str = “hello”;
(C) char str = “hello”; (D) const *int p1;
Ans:C