26. What is printed in the following code segment?
I = 1;
do
{
I = I + 25;
}
while ( I > 50 );
cout << I + 50;
a) 50
b) 51
c) 75
d) 76
26. What is printed in the following code segment?
I = 1;
do
{
I = I + 25;
}
while ( I > 50 );
cout << I + 50;
a) 50
b) 51
c) 75
d) 76
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.
23 http://www.daniweb.com/forums/thread161397.html
14 http://www.daniweb.com/forums/thread161389.html
Is this a live feed direct from my keyboard to your answer sheet without going through YOUR mind?
; 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
else
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.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.