Which of the following code segments will display “Yes” if and only if the value of the variable friend is Grace and the value of the variable favoriteFood is either pizza or popcorn?
Select two answers.
CSP-Selection and Iteration
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Arnel Dimla
Used 4+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
2 mins • 2 pts
Which of the following code segments will display “Yes” if and only if the value of the variable friend is Grace and the value of the variable favoriteFood is either pizza or popcorn?
Select two answers.
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What will be displayed when the code segment below, using the variables a, b and c, is run?
a ← 1
b ← 0
c ← b
b ← 3
a ← c
DISPLAY (a)
DISPLAY (b)
0 0
0 3
1 0
3 3
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following two programs to the right. Which of the following statements can replace <missing statement> to make Program B display the same outcome as Program A when the inputs typed are the same?
4.
MULTIPLE SELECT QUESTION
2 mins • 2 pts
A student developed a program that outputs the name of a fruit that begins with a letter, dependent upon the variable keyPressed, which stores the letter (from A to Z only) a user types on the keyboard. Below is a section of code from her program:
Which of the following descriptions below would be a way that this student might have written the rest of her code so that it executes as intended? Select two answers.
Use 25 nested IF/ELSE blocks where the IF portion is formatted like the code segment above (changing the letters of the alphabet and fruits) and the else simply holding the next IF portion until the last ELSE, which displays a fruit that begins with Z.
Take the above code and insert it into a REPEAT block that repeats 26 times.
Use 26 IF/ELSE blocks where the IF portion is formatted like the code segment above (changing the letters of the alphabet and fruits) and each ELSE portion displays “You did not choose this letter”.
Use 26 IF blocks formatted similarly to the one above (changing the letters of the alphabet and fruits).
5.
MULTIPLE SELECT QUESTION
2 mins • 2 pts
Consider a robot that is initially facing north in a 5-by-5 grid, as shown in the diagram below. A program segment has been written to move the robot to the upper-right corner where it should face west.
Which 2 lines of code in the segment above must be switched in order for the program to correctly move a robot from the starting position to the ending position? Select two answers.
Line 5
Line 2
Line 7
Line 9
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the given code using variables a, b, and c. What will be the output of this code?
6 12
2 12
2 6
12 12
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
This is a section of code taken from a larger program.
What outputs would be the best choice to substitute in for “missing output 1” and “missing output 2”, based on the condition?
10 questions
Comp Sci Unit 3 #7
Quiz
•
11th Grade
12 questions
Java Strings
Quiz
•
9th - 12th Grade
14 questions
Software Engineering
Quiz
•
9th - 12th Grade
14 questions
C++ - Loops and Random Numbers
Quiz
•
9th - 12th Grade
10 questions
AP CSA Unit 1 & 2 Review
Quiz
•
9th - 12th Grade
10 questions
Comp Sci Unit 2 #4
Quiz
•
11th Grade
10 questions
Programming Languages
Quiz
•
11th Grade
10 questions
Comp Sci Unit 3 #9
Quiz
•
11th Grade
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
20 questions
Taxes
Quiz
•
9th - 12th Grade
17 questions
Parts of Speech
Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression
Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing
Quiz
•
9th - 12th Grade
10 questions
Identifying equations
Quiz
•
KG - University