Exam 4: Control Structures I Selection
Exam 1: An Overview of Computers and Programming Languages50 Questions
Exam 2: Basic Elements of C50 Questions
Exam 3: Inputoutput50 Questions
Exam 4: Control Structures I Selection50 Questions
Exam 5: Control Structures II Repetition50 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 Structs50 Questions
Exam 10: Classes and Data Abstraction49 Questions
Exam 11: Inheritance and Composition50 Questions
Exam 12: Pointers, Classes, Virtual Functions, and Abstract Classes50 Questions
Exam 13: Overloading and Templates50 Questions
Exam 14: Exception Handling50 Questions
Exam 15: Recursion50 Questions
Exam 16: Searching, Sorting and the Vector Type50 Questions
Exam 17: Linked Lists50 Questions
Exam 18: Stacks and Queues50 Questions
Select questions type
A control structure alters the normal sequential flow of execution in a program.
(True/False)
4.8/5
(37)
Which of the following will cause a logical error if you are attempting to compare x to 5?
(Multiple Choice)
4.9/5
(36)
Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.
(True/False)
4.8/5
(29)
Once an input stream enters a(n) ____________________ state, all subsequent input statements associated with that input stream are ignored, and the computer continues to execute the program, which produces erroneous results.
(Short Answer)
4.8/5
(40)
What is the value of x after the following statements execute? int x;
X = (5 <= 3 && 'A' < 'F') ? 3 : 4
(Multiple Choice)
4.9/5
(41)
Suppose x is 5 and y is 7. Choose the value of the following expression: (x != 7) && (x <= y)
(Multiple Choice)
4.9/5
(36)
The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.
(True/False)
4.8/5
(45)
Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following expression: z = (y / x > 0) ? x : y;.
(Multiple Choice)
4.8/5
(43)
The ____________________ of relational and logical operators is said to be from left to right.
(Short Answer)
4.8/5
(30)
The term ____________________ describes a process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.
(Short Answer)
4.7/5
(29)
What is the output of the following code? char lastInitial = 'S';
Switch (lastInitial)
{
case 'A':
cout << "section 1" << endl;
break;
case 'B':
cout << "section 2" << endl;
break;
case 'C':
cout << "section 3" << endl;
break;
case 'D':
cout << "section 4" << endl;
break;
default:
cout << "section 5" << endl;
}
(Multiple Choice)
4.8/5
(39)
Consider the following statements.
int score;
string grade;
if (score >= 65)
grade = "pass";
else
grade = "fail";
If score is equal to 75, the value of grade is "____________________".
(Short Answer)
4.7/5
(36)
If the expression in an assert statement evaluates to true, the program terminates.
(True/False)
4.7/5
(46)
Which of the following expressions correctly determines that x is greater than 10 and less than 20?
(Multiple Choice)
4.8/5
(39)
The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4
is ____________________.
(Short Answer)
4.8/5
(33)
Suppose that x is an int variable. Which of the following expressions always evaluates to true?
(Multiple Choice)
4.8/5
(36)
The expression in an if statement is sometimes called a(n) ____.
(Multiple Choice)
4.7/5
(37)
Showing 21 - 40 of 50
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)