Exam 4: Selection
Exam 1: Introduction to Computer Programming44 Questions
Exam 2: Getting Started in C Programming46 Questions
Exam 3: Processing and Interactive Input48 Questions
Exam 4: Selection44 Questions
Exam 5: Repetition47 Questions
Exam 6: Modularity Using Functions: Part I51 Questions
Exam 7: Modularity Using Functions: Part II49 Questions
Exam 8: Arrays48 Questions
Exam 9: Character Strings51 Questions
Exam 10: Data Files50 Questions
Exam 11: Arrays, Addresses, and Pointers49 Questions
Exam 12: Structures48 Questions
Exam 13: Dynamic Data Structures49 Questions
Exam 14: Additional Capabilities55 Questions
Exam 15: A Brief Introduction to C++49 Questions
Select questions type
One aspect of ____ programming is to check for improper data before an attempt is made to process it further.
(Multiple Choice)
4.8/5
(41)
What will the following program print on screen?
Int age = 0;
If (age = 40)
Printf("Happy Birthday!");
Else
Printf("Sorry");
(Multiple Choice)
5.0/5
(42)
The compiler will, by default, associate an else with the closest previous unpaired if, unless braces are used to alter this default pairing.
(True/False)
4.9/5
(42)
The ____ operator is used to change an expression to its opposite state.
(Multiple Choice)
4.7/5
(40)
Which of the following operators has right to left associativity?
(Multiple Choice)
4.9/5
(35)
When the ____ operator is used with two expressions, the condition is true only if both expressions are true by themselves.
(Multiple Choice)
4.7/5
(33)
What will the following program print on screen?
Int age = 40;
If (age = 40)
Printf("Happy Birthday!");
Else
Printf("Sorry");
(Multiple Choice)
4.8/5
(44)
In a switch statement, the word ____ is optional and operates the same as the last else in an if-else chain.
(Multiple Choice)
4.9/5
(35)
In a switch statement, if the break statements are omitted, all cases following the matching case value, including the default case, are executed.
(True/False)
4.9/5
(36)
Generally, the most useful nested if statement occurs when a second if-else statement is placed within the else part of an if-else statement.
(True/False)
4.8/5
(39)
A nested if construction in which each nested if is written in the same line as the previous else is called an if-else chain, and is used extensively in many programming problems.
(True/False)
4.9/5
(38)
One of the main disadvantages of using a switch statement is that it requires the use of braces for compound internal statements.
(True/False)
4.8/5
(30)
A ____ statement is one or more statements contained between braces.
(Multiple Choice)
4.8/5
(30)
In C any expression can be tested within a selection statement, be it a relational, arithmetic, or assignment expression, or even a function call.
(True/False)
4.8/5
(34)
The following statement prints "You lose!" on the screen;
int num = -1;
if (num)
printf("Bingo!");
else
printf("You lose!");
(True/False)
4.8/5
(38)
The expression:
(6 * 3 == 36 / 2) && (13 < 3 * 3 + 4) || !(6 - 2 < 5)
evaluates to 1.
(True/False)
4.8/5
(36)
What will the following program print on screen?
Int tenure = -5;
If (tenure + 5)
Printf("Congratulations!");
Else
Printf("Sorry");
(Multiple Choice)
4.8/5
(34)
In C, character data cannot be compared using relational operators.
(True/False)
4.8/5
(41)
What will the following program print on screen?
Int tenure = -10;
If (tenure + 5)
Printf("Congratulations!");
Else
Printf("Sorry");
(Multiple Choice)
4.8/5
(37)
Showing 21 - 40 of 44
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)