Vidyalelo
C++ Programming · Q101

Functions and Procedures in C++

Programming · C++ Programming · question 101

Q101

What will be the output of the following C++ code? #include using namespace std; void Values(int n1, int n2 = 10) using namespace std; cout << "1st value: " << n1; cout << "2nd value: " << n2; int main() Values(1); Values(3, 4); return 0;

A.
1st value: 1
10
3
4
Answer
B.
1st value: 1
10
3
10
C.
compile time error
D.
runtime error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board