C++ Programming - Functions - Discussion

Discussion Forum : Functions - Programs (Q.No. 9)
9.
Which of the following statement is correct about the program given below?
#include<iostream.h>
int BixTest(int x, int y);
int BixTest(int x, int y, int z = 5);
int main()
{
    cout<< BixTest(2, 4) << endl; 
    return 0;
}
int BixTest(int x, int y)
{
    return x * y;
}
int BixTest(int x, int y, int z = 5)
{
    return x * y * z; 
}
The program will print the output 5.
The program will print the output 8.
The program will print the output 40.
The program will report compile time error.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
13 comments Page 2 of 2.

Gajala washington dc said:   4 years ago
This is actually a linking Error the compilation consists of two stages one is a compilation and another is linking so the linker will be confused to attach which function.
(1)

Nandana said:   2 years ago
To use cout and endl, you need to specify the namespace std.

std::cout << BixTest(2, 4) << std::endl;
(1)

Samratsinh said:   11 months ago
Error in overloading: You cannot overload a function by differing only in default arguments!


Post your comments here:

Your comments will be displayed after verification.