Chapter 4
Which of the following operators is used in most languages to test if two operands do not have the exact same value?
!=
What would be displayed if the following pseudocode was coded and executed, with salary = 400? If salary > 400 ThenSet bonus = 10 Set salary = salary + bonus EndIf Display salary
400
What would be displayed if the following pseudocode was coded and executed, with salary = 400?If salary > 400 ThenSet bonus = 10Set salary = salary + bonusElseSet salary = salary + salary * .20End IfDisplay salary
480
Which of the following is not a logical operator?
<>
Which two logical operators perform short-circuit evaluation?
AND and OR
Which of the following is not a logical operator?
All are logical operators.
If the following pseudocode was coded and run, what would display, given that rate = 8?Select rateCase 10:Display "A"Case 9:Case 8:Display "B"Case 7:Case 6:Display "C"Default:Display "Rating not possible."End Select
B
If the following pseudocode was coded and run, what would display, given that rate = 9?Select rateCase 10:Display "A"Case 9:Case 8:Display "B"Case 7:Case 6:Display "C"Default:Display "Rating not possible."End Select
B
If an expression is False, the ________ operator will return True.
NOT
The ________ operator is a unary operator, which means it works with only one operand.
NOT
Given the following pseudocode, what would display if this pseudocode was coded and executed, given that examGrade = 93 and homeworkGrade = 87?If examGrade >= 90 AND homeworkGrade >= 90 ThenDisplay "You are doing very well!"Else If examGrade < 90 AND homeworkGrade >= 90 ThenDisplay "Study harder for the next exam."Else If examGrade >= 90 AND homeworkGrade < 90 ThenDisplay "See me for help with homework."ElseDisplay "Let's talk about your grades."End If
See me for help with homework.
What would be displayed if the following pseudocode was coded and executed?Declare String pet1 = "puppy"Declare String pet2 = "kitten"If pet1 > pet2 ThenDisplay "These animals are the same."ElseDisplay "These animals are different."End If
These animals are the same
In a flowchart, the ________ symbol indicates that some condition must be tested.
diamond
Given the following pseudocode, what would display if this pseudocode was coded and executed, given that examGrade = 73 and homeworkGrade = 67?If examGrade >= 90 AND homeworkGrade >= 90 ThenDisplay "You are doing very well!"Else If examGrade < 90 AND homeworkGrade >= 90 ThenDisplay "Study harder for the next exam."Else If examGrade >= 90 AND homeworkGrade < 90 ThenDisplay "See me for help with homework."ElseDisplay "Let's talk about your grades."End If
lets talk about your grades
A case structure is a ________ alternative decision structure.
multiple
What type of operator determines whether a specific relationship exists between two values?
relational
In many languages, the case structure is called a ________ statement.
switch
What would be displayed if the following pseudocode was coded and executed?Declare String pet1 = "puppy"Declare String pet2 = "kitten"If pet1 == pet2 ThenDisplay "These animals are the same."ElseDisplay "These animals are different."End If
these animals are different
What does the following expression evaluate to, given that a = 3 and b = 6? (a != b) AND (b > a)
true
What does the following expression evaluate to, given that a = 3 and b = 6? (a == b) OR (b > a)
true
Which of the following expressions would check if a number, x, is outside the range 90 - 100, inclusive (i.e., either less than 90 or greater than 100)?
x < 90 OR x > 100
Which of the following expressions would check if a number, x, is between 90 and 100, inclusive?
x >= 90 AND x <= 100