C++ MCQ-16

Q.91   What will be the result of the expression 13 & 25?
(A) 38  (B)  25
(C)  9  (D)  12
 
   Ans:C

 Q.92   Which of the following operator can be overloaded through friend function?
(A)  ->  
(B)  =
(C)  ( )  
(D)  *      

 Ans:D
 
Q.93  To access the public function fbase() in the base class, a statement in a derived class function fder() uses the statement.fbase();
 
(A) fbase();  
(B)  fder();  
(C)  base::fbase();  
(D)  der::fder();
 
  Ans:A
 
Q.94 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.
 
  Ans:D
 
Q.95 Maximum number of template arguments in a function template is

(A)  one  
(B)  two
(C)  three  
(D)  many
 
 Ans:D

Q 96  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.
 
  Ans:C
 
Q 97  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.
   Ans:D
 
Q.98   What will be the output of the following program?
#include<iostream.h>
void main()
{
float x=5,y=2;
int result;
result=x % y;
cout<<result;
}

   (A) 1                (B)  1.0
   (C)   Error message  (D)  2.5
 
  Ans:C
 
Q.99 Which can be passed as an argument to a function?

(A)  constant          (B)  expression
(C)  another function  (D)  all of the above.
 
  Ans:A
 
Q.100 Member functions, when defined within the class specification:

(A)  are always inline.  
(B)  are not inline.
(C)  are inline by default, unless they are too big or too complicated.
(D)  are not inline by default.
 
  Ans:A

Similar Posts

  • C++ MCQ-12

    Q.1   The address of a variable temp of type float is          (A) *temp  (B) &temp     (C) float& temp  (D) float temp&     Ans: B   Q.2   What is the output of the following code           char symbol[3]={ΓÇÿaΓÇÖ,ΓÇÿbΓÇÖ,ΓÇÿcΓÇÖ};            for (int index=0; index<3; index++)         cout << symbol…

  • C++ MCQ-10

    Q.16   If we create a file by ΓÇÿifstreamΓÇÖ, then the default mode of the file is _________    (A)  ios :: out  (B)  ios :: in (C)  ios :: app  (D)  ios :: binary     Ans: B   Q.17   A variable defined within a block is visible        (A) from the point of…

  • C++ MCQ -5

    Question 1 Streams are a.       Abstraction to perform input and output operations in sequential media b.      Abstraction to perform input and output operations in direct access media c.       Objects  where a program can either insert or extract characters to and from it d.      Both a and c   Question 2 Which of the following is…

  • C++ MCQ-14

    Q.61  An array element is accessed using (A)  a FIFO approach  (B)  an index number (C)  the operator  (D)  a member name     Ans:B   Q.62   If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain…

  • C++ MCQ -4

    Question 1:   cin extraction stops execution as soon as it finds any blank space character   a.       true b.      false   Question 2:   Observe the following statements and decide what do they do.   string mystring;   getline(cin, mystring);   a.       reads a line of string from cin into mystring b.      reads a…

  • C++ MCQ -1

    Question 1. What is the correct value to return to the operating system upon the successful completion of a program? A. -1 B. 1 C. 0 D. Programs do not return a value.   Question 2. What is the only function all C++ programs must contain? A. start() B. system() C. main() D. program()  …

Leave a Reply

Your email address will not be published. Required fields are marked *