Default Arguments

1

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    int func(int m = 10, int n)
4.    
    {
5.    
        int c;
6.        
        c = m + n;
7.        
        return c;
8.        
    }
9.    
    int main()
10.    
    {
11.    
        cout << func(5);
12.        
        return 0;
13.        
    }
A. 15
B. 10
C. compile time error
D. none of the mentioned

2

What is the default return type of a function ?

A. int
B. void
C. float
D. char

3

If we start our function call with default arguments means, what will be proceeding arguments?

A. user argument
B. empty arguments
C. default arguments
D. none of the mentioned

4

What we can’t place followed by the non-default arguments?

A. trailing arguments
B. default arguments
C. both a & b
D. none of the mentioned

5

What is the output of this program?

1.
    #include 
2.    
    using namespace std;
3.    
    void Values(int n1, int n2 = 10)
4.    
    {
5.    
        using namespace std;
6.        
        cout << "1st value: " << n1;
7.        
        cout << "2nd value: " << n2;
8.        
    }
9.    
    int main()
10.    
    {
11.    
        Values(1);
12.        
        Values(3, 4);
14.        
        return 0;
15.        
    }
    

a) 1st value: 1

2nd value: 10

1st value: 3

2nd value: 4

b) 1st value: 1

2nd value: 10

1st value: 3

2nd value: 10

c) compile time error

d) none of the mentioned