Exam 4: Making Decisions
Exam 1: Introduction to Computers and Programming47 Questions
Exam 2: Introduction to C62 Questions
Exam 3: Expressions and Interactivity45 Questions
Exam 4: Making Decisions51 Questions
Exam 5: Loops and Files60 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays and Vectors56 Questions
Exam 8: Searching and Sorting Arrays30 Questions
Exam 9: Pointers47 Questions
Exam 10: Characters, C-Strings, and More About the String Class47 Questions
Exam 11: Structured Data46 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes54 Questions
Exam 14: More About Classes46 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions43 Questions
Exam 16: Exceptions and Templates36 Questions
Exam 17: The Standard Template Library38 Questions
Exam 18: Linked Lists41 Questions
Exam 19: Stacks and Queues47 Questions
Exam 20: Recursion27 Questions
Exam 21: Binary Trees39 Questions
Select questions type
What is the output of the following code segment if the user enters 90 for the score?
Cout << "Enter your test score:
";
Cin >> test_score;
If (test_score < 60)
Cout << "You failed the test." << endl;
If (test_score > 60)
Cout << "You passed the test."
Else
Cout << "You need to study harder next time." << endl;
(Multiple Choice)
4.8/5
(25)
This operator takes an operand and reverses its truth or Falsehood:
(Multiple Choice)
4.9/5
(36)
Which line in the following program will cause a compiler error?
1 #include <iostream>
2 using namespace std;
3 int main()
4 {
5 int number = 5;
6 if (number >= 0 && <= 100)
7 cout << "passed.\n";
8 else
9 cout << "failed.\n";
10 return 0;
11 }
(Multiple Choice)
4.7/5
(29)
What is the value of the following expression?
True && !False
(Multiple Choice)
4.9/5
(31)
You should be careful when using the equality operator to compare floating point values because of potential round-off errors.
(True/False)
4.8/5
(33)
The value of result in the following expression will be 0 if x has the value of 12.
result = x > 100 ?
0 :
1;
(True/False)
4.9/5
(35)
Which statement allows you to properly check the char variable code to determine whether it is equal to a C and then output This is a check?
(Multiple Choice)
4.8/5
(27)
If the expression on the left side of the following is true, the expression on the right side will not be checked.
(a > = b) || (c == d)
(True/False)
4.8/5
(31)
As a rule of style, when writing an if statement you should indent the conditionally-executed statements.
(True/False)
4.7/5
(37)
Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.
(Multiple Choice)
4.8/5
(33)
What is the value of result after the following code executes?
int a = 60;
int b = 15;
int result = 10;
if (a = b)
result *= 2;
(Multiple Choice)
4.8/5
(38)
A variable, usually a bool or an int, that signals when a condition exists is known as a(n)
(Multiple Choice)
4.8/5
(24)
Which of the following expressions will determine whether x is less than or equal to y?
(Multiple Choice)
4.8/5
(37)
Which of the following is evaluated first, given the expression:
A && B || C && !D
(Multiple Choice)
4.8/5
(35)
After the following code executes, what is the value of my_value if the user enters 0?
Cin >> my_value;
If (my_value > 5)
My_value = my_value + 5;
Else if (my_value > 2)
My_value = my_value + 10;
Else
My_value = my_value + 15;
(Multiple Choice)
4.8/5
(27)
What is the output of the following code?
int w = 98;
int x = 99;
int y = 0;
int z = 1;
if (x >= 99)
{
if (x < 99)
cout << y << endl;
else
cout << z << endl;
}
else
{
if (x == 99)
cout << x << endl;
else
cout << w << endl;
}
(Multiple Choice)
4.7/5
(27)
Showing 21 - 40 of 51
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)