Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions