26. What is printed in the following code segment?

I = 1;
      I = I + 25;
      while ( I > 50 );
      cout << I + 50;

a) 50
b) 51
c) 75
d) 76

Start putting some effort in, and not dumping sequential numbered multiple choice quiz questions.
8 Years
Discussion Span
Last Post by Ancient Dragon

do is the top of a loop

do {
  // something here
} while ( <some condition here that stops the loop> );

I'm not going to answer the question you posted -- write a small test program and see for yourself what the answer is. Just post that code in a main() function and you have it done.


; it will print out "76"
; do means an action will happen and then it will check if the while ;statement is true, if so again it will go to do or else it will exit from ;do while loop
I = I + 25; // it will add 25 to I
while ( I > 50 ); // then it will check if I is more than 50, if so it will again add 25 to I
it will print I out.


umm no i'm trying to study for my exam tom. and i just wanted to justify that i'm doing this right....this is my practice exam she gave us to study with thanks...


Practice problems mean you type them into your compiler, compile them, and see how they work. That's the best way to figure out how things work. For these, forget the internet -- pretend it doesn't exist. All you have is you, your computer, and your compiler.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.