Exam 4: Selection

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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)

Relational expressions are also known as ____.

(Multiple Choice)
4.8/5
(46)

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
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)