computer science principles test questions
14. Choose the correct definition for Conditional Statement?
A. affects the sequential flow of control by executing different statements based on the value of a Boolean expression
8. When this function is called, the smaller of two numbers is displayed. What Boolean expression would not work in line 12 in order to accomterm-6plish this goal.
A. num1 == num2
12. The visitor's age is stored in the variable "age", the day of the week is stored in a variable "day", and the price in dollars is stored in the variable "price". Which piece of code will correctly decide the price for each ticket?
B.
13. What is the value of the variable "bags" be at the end of the flowchart shown here?
B.
15. Which of the following is true of functions?
B.
1. What number will be output by the console.log command on line 7?
B. 100
7. "You win!" never displays. What line is responsible for this error?
B. 3
9. This function chooses the screen to display based on the score. What is the correct way to call this function?
B. checkWin();
11. The customer's age is stored in the variable "age", and the price is stored in the variable "price". Which piece of code will correctly decide the price for each ticket?
C.
6. What will be the order of letters printed to the console when this program is run?
C. a b c b c
10. There is repeated code in these "onEvent" blocks. Choose the correct code for the "updateScreen()" function which would be called in each of the "onEvent" blocks.
D.
4. What text will be output by the program?
D. 30 or more
3. What number will be output by the console.log command on line 5?
D. 35
5. What text will be output by the program?
D. Output D
2. What number will be output by the console.log command on line 5?
E. 16