Questions
Which of the following is not a relational operator?
- <
- >
- =
- *
What happens if the variable A is equal to 30 when QBasic executes the following statement?
IF A = 32 THEN
A = A * 2
END IF
- The ELSE clause will be executed.
- Control will be passed to the statement following this one.
- The value of A will be doubled.
- An error will occur and program execution stop.
If X = 22, which of the following statements is executed?
If X <> 8 THEN
PRINT "Stop program"
END IF
- The statement Stop program will be displayed
- The THEN part of the statement will not be executed
- An error message will result
- The number 8 will be assigned to the variable X
If X = 7, what happens when the following statement is executed?
IF (X + 3) + 5 > 10 THEN
PRINT "Answer is correct."
END IF
- The first executable statement after this statement is executed.
- Answer is correct. is printed.
- The program stops executing.
- An error message is displayed.
Directions: Use the following program segment:
IF Time < Best THEN
PRINT "NEW WORLD RECORD!"
ELSEIF Time < Best + 10 THEN
PRINT "GOOD RACE"
ELSE
PRINT "AVERAGE RACE"
END IF
If Time equals 120 and Best equals 121, what is output when this statement is executed?
- NEW WORLD RECORD!
- GOOD RACE
- AVERAGE RACE
- Nothing is output
Directions: Use the following program segment:
IF Time < Best THEN
PRINT "NEW WORLD RECORD!"
ELSEIF Time < Best + 10 THEN
PRINT "GOOD RACE"
ELSE
PRINT "AVERAGE RACE"
END IF
If Time equals 130 and Best equals 120, what is output when this statement is executed?
- NEW WORLD RECORD!
- GOOD RACE
- AVERAGE RACE
- Nothing is output
Directions: Use the following program segment:
IF Sex$ = "M" THEN
IF Height > 66 THEN
IF Weight > 180 THEN
PRINT "Try out for the football team."
END IF
END IF
END IF
What happens if the value of Height is 66, Weight 181, and Sex equals M when this statement is executed?
- The message Try out for football team. is displayed.
- Nothing happens; program execution simply continues on to the next statement.
- An error message is displayed.
- The program immediately stops executing.
Entering data interactively at the keyboard is called _______.
- inquiry-and-response mode
- programming mode
- indirect mode
- direct mode
Directions: Use the following expression.
(Height > 20) AND (Tree$ = "Hickory") OR NOT (Tree$ = "Oak")
Which of the logical operators in this expression will be evaluated first?
- AND
- NOT
- OR
- The order of evaluation makes no difference
The _______ statement allows the user to enter data during program execution.
- INPUT
- PRINT
- LOCATE
- REM
While using an INPUT statement, how many values can be entered at a time?
- Only one
- Two or less
- One or more
- INPUT statements do not accept values
A semicolon immediately after a prompt in an INPUT statement will cause _______.
- the prompt to print in the next available space
- a line to be skipped in the output
- a question mark to appear on the screen at the end of the statement
- an error to occur
When entering more than one value in response to a prompt, each value must be separated by _______.
- a semicolon
- a comma
- a colon
- using the spacebar
Directions: Use the following expression.
(Height > 20) AND (Tree$ = "Hickory") OR NOT (Tree$ = "Oak")
For which of the following values will the above expression evaluate as false?
- Tree$ = "PINE"; Height = 20
- Tree$ = "HICKORY"; Height = 21
- Tree$ = "OAK"; Height = 19
- Tree$ = "WALNUT"; Height = 21
Which statement is the best for entering data to programs, where the data changes often?
- PRINT
- LET
- INPUT
- PROMPT
Directions: Use the following program segment.
SELECT CASE Choice
CASE 10
Price = Quantity * UnitPrice
CASE 20
Price = Quantity * UnitPrice * 0.95
CASE 30
Price = Quantity * UnitPrice * 0.90
CASE ELSE
PRINT "Invalid Choice."
END SELECT
What happens if Choice equals 20?
- Price equals Quantity - UnitPrice.
- Price equals 95% of Quantity - UnitPrice.
- Price equals 90% of Quantity - UnitPrice.
- Invalid Choice is displayed.
A _______ chart is used to determine how a program’s output will be formatted.
- structure
- flow
- spacing
- pseudocode
When the user enters the incorrect data in response to an INPUT statement, which of the following statements appears on the screen?
- Error numeric value expected
- Error character string expected
- Redo from last entry
- Redo from start
Directions: Use the following program segment:
IF Sex$ = "M" THEN
IF Height > 66 THEN
IF Weight > 180 THEN
PRINT "Try out for the football team."
END IF
END IF
END IF
Which of the following could replace this statement?
- IF (Sex$ = "M") AND (Height > 66) AND (Weight >180) THEN PRINT "Try out for football team." END IF
- IF (Sex$ = "M") OR (Height > 66) OR (Weight > 180) THEN PRINT "Try out for football team." END IF
- IF (Sex$ = "M") AND (Height > 66) OR (Weight > 180) THEN PRINT "Try out for football team." END IF
- IF (Sex$ = "M") AND NOT (Height > 66) AND (Weight > 180) THEN PRINT "Try out for football team." END IF
By using a(n) _______, you can cause output to be placed in the next print zone.
- semicolon
- asterisk
- comma
- quotation mark
The _______ is used to separate multiple statements on a single physical line.
- colon
- asterisk
- pound (#)
- equal sign
Directions: Use the following program segment.
SELECT CASE Choice
CASE 10
Price = Quantity * UnitPrice
CASE 20
Price = Quantity * UnitPrice * 0.95
CASE 30
Price = Quantity * UnitPrice * 0.90
CASE ELSE
PRINT "Invalid Choice."
END SELECT
Which of the following statements will cause the price to be 90% of Quantity - UnitPrice?
- CASE = 20 + 10
- Choice = 10 + 10
- Choice = 20 + 10
- Choice = 20
Directions: Use the following program segment.
SELECT CASE Choice
CASE 10
Price = Quantity * UnitPrice
CASE 20
Price = Quantity * UnitPrice * 0.95
CASE 30
Price = Quantity * UnitPrice * 0.90
CASE ELSE
PRINT "Invalid Choice."
END SELECT
What happens if Choice equals 21?
- Price equals Quantity- UnitPrice.
- Price equals 95% of Quantity - UnitPrice.
- Price equals 90% of Quantity -UnitPrice.
- Invalid Choice is displayed.