Functions(Engineering > Computer Science And Engineering > C++ Language ) Questions and Answers
Explanation:-
Answer: Option B. -> main function Normally the execution of the program in c++ starts from main only.
Explanation:-
Answer: Option A. -> return type,function name In a function, return type and function name are mandatory all else are just used as a choice.
Explanation:-
Answer: Option C. -> ; ;
Explanation:-
Answer: Option B. -> call by reference In the call by reference, it will just copy the address of the variable to access it, so it will reduce the memory in accessing it.
Explanation:-
Answer: Option D. -> 127 127
Explanation:-
Answer: Option C. -> compile time error We have to use the semicolon to declare the function in line 3. If we did means, the program will execute.
Question 7. What is the output of this program?
#include < iostream >
using namespace std;
void fun(int x, int y)
{
x = 20;
y = 10;
}
int main()
{
int x = 10;
fun(x, x);
cout
- 10
- 20
- compile time error
- none of the mentioned
Explanation:-
Answer: Option A. -> 10 In this program, we called by value so the value will not be changed, So the output is 10
Explanation:-
Answer: Option B. -> 1 The main function is the mandatory part, it is needed for the execution of the program to start.
Explanation:-
Answer: Option B. -> only inside the {} block The variable is valid only in the function block as in other.
Explanation:-
Answer: Option C. -> 3 There are three ways of passing a parameter. They are pass by value,pass by reference and pass by pointer.