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 -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-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 -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()  …

  • C++ MCQ-15

    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…

  • C++ MCQ-11

    Q.31  Use of virtual functions implies (A)  overloading.  (B)  overriding. (C)  static binding.  (D)  dynamic binding. Ans: D   Q.32   this pointer      (A)  implicitly points to an object.    (B)  can be explicitly used in a class. (C)  can be used to return an object.   (D)  All of the above.    Ans: D…

  • C++ MCQ -9

    Question 1: A function can not be overloaded only by its return type. a. True b. False   Question 2: A function can be overloaded with a different return type if it has all the parameters same. a. True b. False   Question 3: Inline functions involves some additional overhead in running time. a. True…

Leave a Reply

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