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.

  1. #include ;
  2. using namespace std
  3. int main() {
  4. char bar[] = "mech";
  5. cout << bar[3] < end1;
  6. bar[0] = 'o'
  7. bar[2] = 'l';
  8. bar[3] = 'e';
  9. bar[1] = 'r';
  10. cout << bar << end1;
  11. return 0;
  12. }

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.

  1. #include
  2. using namespace std;
  3. int main() {
  4. int y, result=1;
  5. cin >> y;
  6. for(int x = 1; x <= y; x++) {
  7. result *= x;
  8. }
  9. cout << result << endl;
  10. return 0;
  11. }

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!