Question
I have an examination on Tuesday This is part of an examination paper. 11. A function prototype can always be omitted when: a. A function
I have an examination on Tuesday This is part of an examination paper.
11. A function prototype can always be omitted when:
a. A function is defined before it is first invoked.
b. A function is invoked before it is first defined.
c. A function takes no arguments.
d. A function does not return a value.
12. What is the output of this program?
#include using namespace std; int main() { int x = 5, y = 5; cout<< ++x << y-- ;
}
a. 55
b. 65
c. 64
d. 45
13. What is the output from the following C++ program?
#include
using namespace std;
int fun(int = 0, int = 0);
int main()
{ cout << fun(5);
return 0;
}
int fun(int x, int y) {
return (x+y);
}
a. Compiler error
b. 5
c. 0
d. 10
14. What is the output from the following C++ program?
#include
using namespace std;
int array1[] = {200, 400, 300, 600, 500};
int array2[] = {10, 20, 30, 40, 50};
int temp, result = 0;
int main() {
for (temp = 0; temp < 5; temp++) {
result += array1[temp];
}
for (temp = 0; temp < 4; temp++) {
result += array2[temp];
}
cout << result;
return 0;
}
a. 2500
b. 2100
c. Error
d. 1650
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started