Exam 4: Making Decisions
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
These operators connect two or more relational expressions into one, or reverse the logic of an expression.
Free
(Multiple Choice)
4.9/5
(78)
Correct Answer:
B
Input values should always be checked for
Free
(Multiple Choice)
4.8/5
(60)
Correct Answer:
D
What will be the output of the following code segment after the user enters 0 at the keyboard?
int x = -1;
cout << "Enter a 0 or a 1 from the keyboard: ";
cin >> x;
if (x)
cout << "true" << endl;
else
cout << "false" << endl;
Free
(Multiple Choice)
5.0/5
(81)
Correct Answer:
B
As a rule of style, when writing an if statement you should indent the conditionally-executed statements.
(True/False)
4.8/5
(78)
When a program lets the user know that an invalid choice has been made, this is known as:
(Multiple Choice)
4.8/5
(83)
What will the following segment of code output if 11 is entered at the keyboard?
int number;
cin >> number;
if (number > 0)
cout << "C++";
else
cout << "Soccer";
cout << " is ";
cout << "fun" << endl;
(Multiple Choice)
4.7/5
(68)
What will following segment of code output? int x = 5;
If (x = 2)
cout << "This is true!" << endl;
else
cout << "This is false!" << endl;
cout << "This is all folks!" << endl;
(Multiple Choice)
4.8/5
(87)
What will the following segment of code output? You can assume the user enters a grade of 90 from the keyboard.
cout << "Enter a test score: ";
cin >> test_score;
if (test_score < 60);
cout << "You failed the test!" << endl;
if (test_score > 60)
cout << "You passed the test!" << endl;
else
cout << "You need to study for the next test!";
(Multiple Choice)
4.7/5
(75)
Which value can be entered to cause the following code segment to display the message "That number is acceptable."
int number;
cin >> number;
If (number > 10 && number < 100)
cout << "That number is acceptable.\n";
else
cout << "That number is not acceptable.\n";
(Multiple Choice)
4.9/5
(91)
An expression that has any value other than 0 is considered true by an if statement.
(True/False)
4.8/5
(81)
What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables. a = x >= y;
(Multiple Choice)
4.9/5
(80)
What will the following segment of code output?
score = 40;
if (score > 95)
cout << "Congratulations!\n";
cout << "That's a high score!\n";
cout << "This is a test question!" << endl;
(Multiple Choice)
4.9/5
(79)
Given that x = 2, y = 1, and z = 0, what will the following cout statement display? cout << "answer = " << (x || !y && z) << endl;
(Multiple Choice)
4.8/5
(96)
This statement lets the value of a variable or expression determine where the program will branch to.
(Multiple Choice)
4.9/5
(88)
What is the value of the following expression? true && true
(Multiple Choice)
4.8/5
(77)
When an if statement is placed within the conditionally-executed code of another if statement, this is known as:
(Multiple Choice)
4.7/5
(63)
Showing 1 - 20 of 53
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)