Exam 5: Control Structures II (Repetition)
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C++50 Questions
Exam 3: Input/Output50 Questions
Exam 4: Control Structures I (Selection)50 Questions
Exam 5: Control Structures II (Repetition)50 Questions
Exam 6: User-Defined Functions50 Questions
Exam 7: User-Defined Simple Data Types, Namespaces, and the string Type50 Questions
Exam 8: Arrays and Strings50 Questions
Exam 9: Records (structs)50 Questions
Exam 10: Classes and Data Abstraction50 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, Abstract Classes, and Lists50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Linked Lists50 Questions
Exam 17: Stacks and Queues50 Questions
Exam 18: Searching and Sorting Algorithms50 Questions
Exam 19: Binary Trees50 Questions
Exam 20: Graphs50 Questions
Exam 21: Standard Template Library (STL)50 Questions
Select questions type
The ____________________ loop has an exit condition but no entry condition.
(Short Answer)
4.7/5
(34)
Assume all variables are properly declared.The output of the following C++ code is 2 3 4 5.
n = 1;
while (n < 5)
{
n++;
cout << n << " ";
}
(True/False)
4.8/5
(37)
The function srand takes as input a(n)____________________ int,which acts as the seed for the algorithm.
(Short Answer)
4.9/5
(31)
The control variable in a flag-controlled while loop is a bool variable.
(True/False)
4.8/5
(39)
A software ____________________ is a piece of code written on top of an existing piece of code intended to fix a bug in the original code.
(Short Answer)
4.8/5
(40)
In a counter-controlled while loop,the loop control variable must be initialized before the loop.
(True/False)
4.9/5
(35)
The ____________________ statement is typically used for two purposes:
• To exit early from a loop.
• To skip the remainder of a switch structure.
(Short Answer)
4.9/5
(38)
In a sentinel-controlled while loop,the body of the loop continues to execute until the EOF symbol is read.
(True/False)
4.8/5
(34)
A for loop is typically called a counted or ____________________ for loop.
(Short Answer)
4.8/5
(37)
What is the output of the following loop? count = 5;
cout << 'St';
do
{
cout << 'o';
count--;
}
while (count <= 5);
(Multiple Choice)
4.9/5
(26)
In the case of the sentinel-controlled while loop,the first item is read before the while loop is entered.
(True/False)
4.9/5
(42)
The following while loop terminates when j > 20.
j = 0;
while (j < 20)
j++;
(True/False)
4.8/5
(44)
Which of the following loops does not have an entry condition?
(Multiple Choice)
5.0/5
(37)
When a continue statement is executed in a ____,the update statement always executes.
(Multiple Choice)
4.9/5
(39)
Consider the following code.(Assume that all variables are properly declared.)
cin >> ch;
While (cin)
{
cout << ch;
cin >> ch;
}
This code is an example of a(n)____ while loop.
(Multiple Choice)
4.8/5
(38)
What is the output of the following C++ code? num = 100;
while (num <= 150)
num = num + 5;
cout << num << endl;
(Multiple Choice)
4.7/5
(43)
If a(n)____________________ statement is placed in a do...while structure,the loop-continue test is evaluated immediately after this statement.
(Short Answer)
4.9/5
(34)
The statement in the body of a while loop acts as a decision maker.
(True/False)
4.9/5
(36)
In a(n)"____________________" problem,either the loop executes one too many or one too few times.
(Short Answer)
4.8/5
(43)
The ____ statement can be used to eliminate the use of certain (flag)variables.
(Multiple Choice)
5.0/5
(33)
Showing 21 - 40 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)