Question: please help with these C++ questions A for loop initializes the loop control variable to 1 and the condition checks to see if this variable
please help with these C++ questions
A for loop initializes the loop control variable to 1 and the condition checks to see if this variable is less than 5. The variable is updated using increment operation. The body of this for loop is:
cout << x + 1 << endl;
If the last value printed is 5, which of the following might have been used for increment?
| Only x++ can be used |
| Any of x++ or x+=1 or ++x can be used |
| Only x+= 1 can be used |
| Only ++x can be used |
Flag this Question
Question 322 pts
Before a do while loop, the counter variable is initialized to 1. The body of the do while loop is:
cout << counter << " ";
The condition is: ++counter <= 10
What will such a program segment do?
| Print the numbers 1 through 11. |
| Print the numbers 1 through 9. |
| Print the numbers 1 through 10. |
| Cause a syntax error. Question 131 pts Arrays are passed by values to a function.
Flag this Question Question 141 pts When you pass an array to a function, you must specify the size of the array inside the brackets.
Flag this Question Question 151 pts When you use pass by reference to pass the value of a variable, the function cannot change the value inside that variable.
Flag this Question Question 161 pts When you use a do while loop, the condition must satisfy first before doing the body of the loop.
Flag this Question Question 171 pts When you know in advance how many times you must loop, the best loop to use would be a while loop.
Flag this Question Question 181 pts You must provide a break statement for each case statement.
Flag this Question Question 191 pts You never write a condition after the else statements.
Flag this Question Question 201 pts A continue statement in a for loop means continuing with the rest of the statements of the current iteration.
Flag this Question Question 211 pts In C++ you may pass by reference many arguments as long as the function type is void.
Flag this Question Question 221 pts The only way to count how many times a function is called is to use a counter and any time the function is going to be called, increment the counter (either before or after).
Flag this Question Question 231 pts per-increment and post-increment are functionally the same if done in a single expression.
|
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
