MCQs
Total Questions : 9
Answer: Option C. -> compile time error
We can't use the user argument infront of the default argument.
Answer: Option B. -> void
None.
Answer: Option C. -> default arguments
As a rule, the default argument must be followed by default arguments only.
Answer: Option B. -> default arguments
None.
Answer: Option B. -> default arguments
Answer: (a)
Explanation: In this program, We are passing the values as by default values rules it is working.
Output:
$ g++ def2.cpp
$ a.out
1st value: 1
2nd value: 10
1st value: 3
2nd value: 4
Answer: Option C. -> the number you entered
In this program, we are getting a number and printing it.
Output:
$ g++ def1.cpp
$ a.out
Please enter a number:
5
Here is your number:5
Answer: Option A. -> default value
If the user didn’t supply the value means, the compiler will take the given value in the argument list.
Answer: Option B. -> rightmost
None.
Answer: Option C. -> Flag is false. a = 200
In this program, we are passing the value, as it evaluates to false, it produces the output as following.
Output:
$ g++ def.cpp
$ a.out
Flag is false. a = 200