Question: Assume that you correct for minor compile-time errors. This program outputs values in an array that are divisible by one number, but not by another.

Assume that you correct for minor compile-time errors. This program outputs values in an array that are divisible by one number, but not by another. Select the statements that are true about running the following code?

  1. #include
  2. using namespace std;
  3. int main() {
  4. const int TOP = 7;
  5. int foo[TOP] = {15, 47, 23, 45, 10, 19, 36};
  6. int y = 0;
  7. while(y < TOP) {
  8. if(foo[y] % 5 == 0) {
  9. y++;
  10. continue
  11. }
  12. if(!(foo[y] % 2)) {
  13. cout < foo[y] < " ";
  14. }
  15. y++;
  16. }
  17. cout < end1;
  18. return 0
  19. }

Select one or more:

a. The output from this program will be 36

b. The output from this program will be 10 36

c.The while expression on line 8 will be evaluated 8 times

d. The while expression on line 8 will be evaluated 7 times

e. Line 9 should in fact be if(!(foo[y] % 5)) {.

f. Line 13 should in fact be if(foo[y] % 2) {.

Thank you!!

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!