Sail E0 Webinar

MCQs

Total Questions : 40 | Page 3 of 4 pages
Question 21.

Which of the following statement is correct?


  1.    The order of the default argument will be right to left.
  2.    The order of the default argument will be left to right.
  3.    The order of the default argument will be alternate.
  4.    The order of the default argument will be random.
 Discuss Question
Answer: Option A. -> The order of the default argument will be right to left.


Question 22.


What will be the output of the following program?


#include
long BixFunction(int x, int y = 5, float z = 5)
{
return(++x * ++y + (int)++z);
}
int main()
{
cout
  1.    237
  2.    242
  3.    240
  4.    35
  5.    The program will report error on compilation.
 Discuss Question
Answer: Option A. -> 237


Question 23.


What will be the output of the following program?


#include
int BixFunction(int a, int b = 3, int c = 3)
{
cout
  1.    8
  2.    6
  3.    -6
  4.    -8
 Discuss Question
Answer: Option C. -> -6


Question 24.


What will be the output of the following program?


#include
void MyFunction(int a, int b = 40)
{
cout
  1.    a = 20 b = 40
  2.    a = 20 b = 30
  3.    a = 20 b = Garbage
  4.    a = Garbage b = 40
 Discuss Question
Answer: Option B. -> a = 20 b = 30


Question 25.

Which of the following function / types of function cannot have default parameters?


  1.    Member function of class
  2.    main()
  3.    Member function of structure
  4.    Both B and C
 Discuss Question
Answer: Option B. -> main()


Question 26.

Which of the following statement is correct?


  1.    Overloaded functions can accept same number of arguments.
  2.    Overloaded functions always return value of same data type.
  3.    Overloaded functions can accept only same number and same type of arguments.
  4.    Overloaded functions can accept only different number and different type of arguments.
 Discuss Question
Answer: Option A. -> Overloaded functions can accept same number of arguments.


Question 27.

Which of the following statement is correct? 


  1.    The default value for an argument cannot be function call.
  2.    C++ allows the redefinition of a default parameter.
  3.    Both A and B.
  4.    C++ does not allow the redefinition of a default parameter.
 Discuss Question
Answer: Option D. -> C++ does not allow the redefinition of a default parameter.


Question 28.

Which of the following statement is incorrect?


  1.    A default argument is checked for type at the time of declaration and evaluated at the time of call.
  2.    We can provide a default value to a particular argument in the middle of an argument list.
  3.    We cannot provide a default value to a particular argument in the middle of an argument list.
  4.    Default arguments are useful in situations where some arguments always have the same value.
 Discuss Question
Answer: Option B. -> We can provide a default value to a particular argument in the middle of an argument list.


Question 29.

Where the default value of parameter have to be specified?


  1.    Function call
  2.    Function definition
  3.    Function prototype
  4.    Both B or C
 Discuss Question
Answer: Option C. -> Function prototype


Question 30.

Which of the following statement is correct?


  1.    Only one parameter of a function can be a default parameter.
  2.    Minimum one parameter of a function must be a default parameter.
  3.    All the parameters of a function can be default parameters.
  4.    No parameter of a function can be default.
 Discuss Question
Answer: Option C. -> All the parameters of a function can be default parameters.


Latest Videos

Latest Test Papers