Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Stack #4001933

QuestionAnswer
When the condition is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed. True
What's wrong? do{ } while( (i < 10) && (i > 24)) the test condition is always true
When using while loop is that we need to use __________ statement inside while loop so that the loop variable gets changed on each iteration, and at some point condition returns false increment or decrement
Which of the following while clauses tells the computer to exit the loop when the value in the age variable is greater than or equal to the number 0? while (age >= 0)
A do-while loop that never stops is said to be the infinite while loop, when we give the condition in such a way so that it never returns ___ False
The statement i++; is equivalent to ________ i = i + 1;
for loop is pre-test loop True
What's wrong? for (int k = 2, k <=12, k++) the commas should be semicolons
the variable must always be the letter i when using a for loop Which for loop is correct? for (i=0; i<10; i++);
If there is more than one statement in the block of a while loop, which of the following must be placed at the beginning and the ending of the loop block? braces { }
The loop iterates while the condition is true. True
What's wrong? int x=1; while [x<5]{ cout<<x; x++; } test condition should be enclosed in parenthesis
the variable must always be the letter i when using a for loop there should be a semicolon after do keyword the increment should always be ++x What is the final value of x when the code int x=0; while(x<10) {x++;} is run? 1
When the condition becomes true, program control passes to the line immediately following the loop. False
If the test expression is false, the loop terminates (ends). True
Which of the following is most suitable for a menu-driven program? Do-while
What's wrong? int x=1; do { cout<<x; x++; } while (x<5) there should be a semicolon at the end of while keyword
The while loop evaluates the test expression inside the parenthesis {} if it is true. False
What is the effect of writing a break statement inside a loop? It cancels remaining iterations
A __________ statement causes execution to skip to the next iteration of the loop continue
When a break statement is encountered inside a loop, the control directly comes out of loop and the loop gets terminated. True
Which of the following loop constructs perform the statement at least once? do-while
The destination point is identified by a label, which is then used as an argument for the goto instruction. True
What is correct syntax of for loop? for(initialization, condition, increment/decrement)
A continue statement causes execution to skip to ____ the next iteration of the loop
In for loop, initialization happens first and only once True
Condition in for loop is evaluated on each loop iteration, if the condition is false then the statements inside the for loop body gets executed False
Determine the output of the given program segment. int s = 0, j; for( j = 1; j < 3; j++) s = s + j*j; cout << s; 3
Consider the following loop : for(int i=0; i<5; i++) ; What will be the value of i after this loop? 5
Values that are used to end loops are referred to as _____ values. Sentinel
A while loop that never stops is said to be the infinite while loop, when we give the condition in such a way so that it never returns ___. False
Given that the increment/decrement operator is ++/-- and the first testing is true in a loop, the formula to compute for the number of loops when using the relational operator > is |TV – IV| + 1 False
PROGRAM is printed unlimited number of times. PROGRAM
What is the output of C++ Program? #include<iostream> using namespace std; int main(){ int a=25; while(a <= 27) { cout<<a<<" "; a++; } return 0; } 25 26 27
int x=1,y=2,z=3; for (int ctr=1;ctr<=10;ctr++) cout<<ctr<<" iteration"<< endl; cout<<"\t x="<<x<<endl; cout<<"\t y="<<y<<endl; cout<<"\t z="<<z<<endl; x+=y; y+=z; z+=ctr; What are the values of x, y, and z in the second iteration, respectively? 3;5;4
Simulate the following code snippet int a=1,b=1,c=1; for (int ctr=c;ctr<=10;ctr++) { cout<<ctr<<" iteration"<<endl; a++; b+=5; c+=a; cout<<"\t a= "<<a<<endl; cout<<"\t b= "<<b<<endl; cout<<"\t c= "<<c<<endl; } What is the final value of b? 51
What number will the following code display on the computer screen? int sum = 0; int y = 0; do { for ( int x = 1; x < 5; x++) sum += x; y = y + 1; } while ( y < 3); cout << sum << endl; 30
If we change the condition from ctr<=10 to ctr<10, how many iterations will the statement have? 9
A loop inside another loop is called a nested loop. True
Created by: user-1768430
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards