Question: Assume that you correct for minor compile-time errors. Identify which statements are true about running this program. #include ; using namespace std int main() {
Assume that you correct for minor compile-time errors. Identify which statements are true about running this program.
- #include
; - using namespace std
- int main() {
- char bar[] = "mech";
- cout << bar[3] < end1;
- bar[0] = 'o'
- bar[2] = 'l';
- bar[3] = 'e';
- bar[1] = 'r';
- cout << bar << end1;
- return 0;
- }
Select one or more:
a. Line 8 will output c
b. Line 16 will output role
c. Line 8 will output h
d. Line 16 will output m
e. Line 16 will output orle
Assume that you correct for minor compile-time errors. The following code should take an number as an input and output the result as another number. Select those answers you know to be true.
- #include
- using namespace std;
- int main() {
- int y, result=1;
- cin >> y;
- for(int x = 1; x <= y; x++) {
- result *= x;
- }
- cout << result << endl;
- return 0;
- }
Select one or more:
a. If y is input as 4, then result will be 2 after line 8 is run the second time in the for loop.
b. If y is input as 6, then x will be 1 after line 8 is run the first time in the for loop.
c. If y is input as 3, then x will be 0 before line 8 is run the first time in the for loop.
d. If y is input as 3, then the output from line 11 will be 6
e. If y is input as 6, then result will be 2 before line 8 is run the first time in the for loop.
f. If y is input as 3, then the output from line 11 will be 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
