Programming - C++ Language
You Are Here :: Home > C++ Language > Functions - General Questions
19. |
Which of the following statement is incorrect?
|
A. |
Default arguments can be provided for pointers to functions. |
B.
|
A function can have all its arguments as default. |
C.
|
Default argument cannot be provided for pointers to functions.
|
D.
|
A default argument cannot be redefined in later declaration.
|
|
Answer: Option C
Explanation:
|
20. |
Which of the following statement is correct?
|
A. |
Constructors can have default parameters. |
B.
|
Constructors cannot have default parameters. |
C.
|
Constructors cannot have more than one default parameter.
|
D.
|
Constructors can have at most five default parameters.
|
|
Answer: Option A
Explanation:
|
21. |
Which of the following function / type of function cannot be overloaded?
|
A. |
Member function |
B.
|
Static function |
C.
|
Virtual function
|
D.
|
Both B and C
|
|
Answer: Option C
Explanation:
|
22. |
Which of the following function declaration is/are incorrect?
|
A. |
int Sum(int a, int b = 2, int c = 3); |
B.
|
int Sum(int a = 5, int b); |
C.
|
int Sum(int a = 0, int b, int c = 3);
|
D.
|
Both B and C are incorrect.
|
|
Answer: Option D
Explanation:
|
23. |
Which of the following statement is incorrect?
|
A. |
The default value for an argument can be a global constant. |
B.
|
The default arguments are given in the function prototype. |
C.
|
Compiler uses the prototype information to build a call, not the function definition.
|
D.
|
The default arguments are given in the function prototype and should be repeated in the function definition.
|
|
Answer: Option D
Explanation:
|
24. |
Where the default value of parameter have to be specified?
|
A. |
Function call |
B.
|
Function definition |
C.
|
Function prototype
|
D.
|
Both B or C
|
|
Answer: Option C
Explanation:
|
« prev
next »