Sail E0 Webinar

MCQs

Total Questions : 40 | Page 4 of 4 pages
Question 31.

Which of the following statement is incorrect?


  1.    The default value for an argument can be a global constant.
  2.    The default arguments are given in the function prototype.
  3.    Compiler uses the prototype information to build a call, not the function definition.
  4.    The default arguments are given in the function prototype and should be repeated in the function definition.
 Discuss Question
Answer: Option D. -> The default arguments are given in the function prototype and should be repeated in the function definition.


Question 32.

Which of the following function / type of function cannot be overloaded?


  1.    Member function
  2.    Static function
  3.    Virtual function
  4.    Both B and C
 Discuss Question
Answer: Option C. -> Virtual function


Question 33.

Which of the following function declaration is/are incorrect?


  1.    int Sum(int a, int b = 2, int c = 3);
  2.    int Sum(int a = 5, int b);
  3.    int Sum(int a = 0, int b, int c = 3);
  4.    Both B and C are incorrect.
  5.    All are correct.
 Discuss Question
Answer: Option D. -> Both B and C are incorrect.


Question 34.

Which of the following statement is incorrect?


  1.    Default arguments can be provided for pointers to functions.
  2.    A function can have all its arguments as default.
  3.    Default argument cannot be provided for pointers to functions.
  4.    A default argument cannot be redefined in later declaration.
 Discuss Question
Answer: Option C. -> Default argument cannot be provided for pointers to functions.


Question 35.

Which of the following statement is correct?


  1.    Constructors can have default parameters.
  2.    Constructors cannot have default parameters.
  3.    Constructors cannot have more than one default parameter.
  4.    Constructors can have at most five default parameters.
 Discuss Question
Answer: Option A. -> Constructors can have default parameters.


Question 36.


Which of the following statement is correct?


  1.    Two functions having same number of argument, order and type of argument can be overloaded if both functions do not have any default argument.
  2.    Overloaded function must have default arguments.
  3.    Overloaded function must have default arguments starting from the left of argument list.
  4.    A function can be overloaded more than once.
 Discuss Question
Answer: Option D. -> A function can be overloaded more than once.


Question 37.

Which of the following statement is correct?


  1.    Overloaded functions can have at most one default argument.
  2.    An overloaded function cannot have default argument.
  3.    All arguments of an overloaded function can be default.
  4.    A function if overloaded more than once cannot have default argument.
 Discuss Question
Answer: Option C. -> All arguments of an overloaded function can be default.


Question 38.

Which of the following statement is correct?


  1.    C++ enables to define functions that take constants as an argument.
  2.    We cannot change the argument of the function that that are declared as constant.
  3.    Both A and B.
  4.    We cannot use the constant while defining the function.
 Discuss Question
Answer: Option C. -> Both A and B.


Question 39.

Which of the following function prototype is perfectly acceptable?


  1.    int Function(int Tmp = Show());
  2.    float Function(int Tmp = Show(int, float));
  3.    Both A and B.
  4.    float = Show(int, float) Function(Tmp);
 Discuss Question
Answer: Option A. -> int Function(int Tmp = Show());


Question 40.

Which of the following statement will be correct if the function has three arguments passed to it?


  1.    The trailing argument will be the default argument.
  2.    The first argument will be the default argument.
  3.    The middle argument will be the default argument.
  4.    All the argument will be the default argument.
 Discuss Question
Answer: Option A. -> The trailing argument will be the default argument.


Latest Videos

Latest Test Papers