Question: 6 -
Which is more effective while calling the functions?
-
call by reference
-
call by value
-
call by object
-
call by pointer
Answer:
call by reference
Solution:
In the call by reference, it will just passes the reference of the memory addresses of passed values rather than copying the value to new memories which reduces the overall time and memory use.
In the call by reference, it will just passes the reference of the memory addresses of passed values rather than copying the value to new memories which reduces the overall time and memory use.
Question: 7 -
How many can max number of arguments present in function in the c99 compiler?
-
127
-
102
-
99
-
90
Answer:
127
Solution:
C99 allows to pass a maximum of 127 arguments in a function.
C99 allows to pass a maximum of 127 arguments in a function.
Question: 8 -
What will be the output of the following C++ code?#include <iostream>
using namespace std;
void car{
cout << "Audi R8";
}
int main() {
car();
return 0;
}
-
compile time error
-
runtime error
-
Audi R8
-
Audi R8Audi R8
Answer:
compile time error
Solution:
We have to use the semicolon to declare the function in line 3. This is called a function declaration and a function declaration ends with a semicolon.
We have to use the semicolon to declare the function in line 3. This is called a function declaration and a function declaration ends with a semicolon.
Question: 9 -
which of the following is used to terminate the function declaration?
-
)
-
;
-
:
-
]
Answer:
;
Solution:
; semicolon is used to terminate a function declaration statement in C++.
; semicolon is used to terminate a function declaration statement in C++.
Question: 10 -
What are mandatory parts in the function declaration?
-
parameters, variables
-
return type, function name, parameters
-
parameters, function name
-
return type, function name
Answer:
return type, function name
Solution:
In a function, return type and function name are mandatory all else are just used as a choice.
In a function, return type and function name are mandatory all else are just used as a choice.