C++ Programming
DEFAULT ARGUMENTS MCQs
Total Questions : 9
Answer is Option C. -> compile time error
We can't use the user argument infront of the default argument.
Answer is Option B. -> void
None.
Answer is Option C. -> default arguments
As a rule, the default argument must be followed by default arguments only.
Answer is Option B. -> default arguments
None.
Answer is 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 is 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 is 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 is Option B. -> rightmost
None.
Answer is 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
Recent Questions
Q. The Most Important Consideration In Power Amplifier Is _____....
Q. Choose The Odd One Out.
Q. AirAsia Group Of Which Country Has Changed The Name Of Its L....
Q. Direction Of Twist 'Z' Is
Q. .................. Is Your Problem?
Q. Nyquist Plot Provides Information About Absolute Stability A....
Q. International Women's Day Is Being Celebrated On Which Date?....
Q. A) D
Q. Two Students Measure A Particular Length Using The Same Inst....
Q. Light Or Heat Is Required For Which Step In The Halogenatio....
Q. In India, The Temperate Forest Research Centre Is In Which C....
Q. Electrophoresis Of Histones And Myoglobin Under Non-denaturi....
Q. The Units Of Polarization Of Dielectric Are
Q. Choose The Alternative Which Is Closely Resembles The Water-....
Q. The Impulse Turbine Rotor Efficiency Will Have A Maximum Val....
Q. How Much A Month Are You Paid ?
Q. Who Has Been Awarded The Top EU Human Rights Prize- The Sakh....
Q. Identify The Programmable Interval Timer From The Following
Q. In Nature, Magnesium Oxide (MgO) Is
Q. A Person Bought Two Articles A And B For Rs.5,000. He Sold A....