NEW
Font size
WorksheetsUnit 2 Quiz
Total questions: 62
Worksheet time: 42mins
What is a library in Computer Science?
A collection of books
A collection of If else statements
Modularity
A collection of procedures we can access and reuse
What are the 3 building blocks of Algorithms?
See image
9
5
11
12
What are conditional statements?
What is another word for iteration?
What is a global variable?
What is a local variable? Also known as a script variable.
See image
70
80
90
101
See image
((day= “Tuesday” OR “Thursday”) AND ( gradeLevel<= 10))
((day= “Tuesday” OR “Thursday”) OR ( gradeLevel<= 10))
((day= “Tuesday” OR “Thursday”)
( gradeLevel<= 10)
See image.
( "Jane" , 37)
(Jane, 44)
("Jane" , "66")
None of the above
What is a procedure call?
What is the output?
1,5
2,4
3,6
0,2
What is API?
What information can we find in the API?
Understanding how to use Snap
Understanding how procedures work and what they require
4 MOD 5
2
3
4
5
What is the output?
1 4 7 10 13
4 7 10 13
1 4 7 10
13
What will the procedure call badBunni (60) ?
9
6
3
2
What will be displayed?
2
0
35
30
What is an algortihm?
What would be the Boolean expression to determine if a number is even?
number MOD 2 = 0
number MOD 2 >= 0
number MOD 2 = 1
number MOD 2 > 0
What is sequencing in algorithms?
Going in order from top to bottom
Running code depending on the Boolean condition
Repetition
None of the above
What will be the output?
7
3 6 9 12
The Repeat until will not work
Will cause an infinite loop
What are the 3 main data types we have work with in class?
numbers
Boolean Values
MOD
numbers
IF/ ELSE
Selection
Numbers
Boolean Values
Strings
Predicates
Reporters
Commands
What would be the output for this program?
L
H
Y
T
What would be the output?
L
H
H T
L J
Which of the following code calls a procedure correctly for drawPolygon(sides, size) of 5 sides and size of 70?
None are correct
What are parameters in a procedure?
Variables used to store values within a procedure and never used.
Variables used to pass values out of a procedure only.
Wake up
Get out of bed
Walk to the restroom
Turn the light on
Wash your face
Grab your toothbrush
Grab toothpaste
These steps are what king of algorithm?
Conditional
What is procedural abstraction?
Consider the following code segment to the left.
Which of the variables have the value 50 after executing the code segment?
x only
y only
x and z only
x, y, and z
Consider the following code segment to the left.
What is the value of r as a result of executing the code segment?
10
20
30
40
Three words are stored in the variables word1, word2, and word3. The values of the variables are to be updated as shown in the following table.
Which of the following code segments can be used to update the values of the variables as shown in the table?
temp ← word1
word3 ← word1
word1 ← temp
temp ← word1
word1 ← word3
word3 ← temp
temp ← word1
word1 ← word2
word2 ← word3
word3 ← temp
temp ← word3
word3 ← word2
word2 ← word1
word1 ← temp
To qualify for a particular scholarship, a student must have an overall grade point average of 3.0 or above and must have a science grade point average of over 3.2. Let overallGPA represent a student’s overall grade point average and let scienceGPA represent the student’s science grade point average. Which of the following expressions evaluates to true if the student is eligible for the scholarship and evaluates to false otherwise?
(overallGPA > 3.0) AND (scienceGPA > 3.2)
(overallGPA > 3.0) AND (scienceGPA ≥ 3.2)
(overallGPA ≥ 3.0) AND (scienceGPA > 3.2)
(overallGPA ≥ 3.0) AND (scienceGPA ≥ 3.2)
Consider the following code segment.
If the value of score1 is 350 and the value of score2 is 210, what will be the value of result after the code segment is executed?
3
4
5
7
Three teams (Team A, Team B, and Team C) are participating in a trivia contest. Let scoreA represent the number of correct questions for Team A, scoreB represent the number of correct questions for Team B, and scoreC represent the number of correct questions for Team C. Assuming no two teams get the same number of correct questions, which of the following code segments correctly displays the team with the highest number of correct questions?
What will the following algorithm display?
a ← 13
b ← 17
a ← a + 1
c ← a/7
DISPLAY(c)
DISPLAY(a)
DISPLAY(b)
2, 14, 17
13, 17, 5
2, 12, 2
14, 17, 2
What will the following algorithm display?
a ← 13
a ← 17
a ← a+1
DISPLAY(a)
13
17
18
19
definition of an assignment operator
allows a program to change the value represented by a variable
an ordered sequence of characters.
a named group of programming instructions.
NOT, AND, and OR, which evaluate to a Boolean value.
definition of a logical operator
a data type that is either true or false.
NOT, AND, and OR, which evaluate to a Boolean value.
<, >, <=, >=, ==, != indicate a Boolean expression
allows a program to change the value represented by a variable
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
What is the output?
True
False
Why are the blocks in this image called 'hat blocks'?
Because these blocks can sit only on top of a script (as a way to start the script) and nothing can be connected above them
Because these blocks can sit only on bottom of a script (as a way to end the script) and nothing can be connected below them
Because these blocks can't be programmed for every sprite
Because people typically own multiple hats and there are several different types of this block
What is a sprite in SNAP?
An object on the stage that the code can manipulate (move, show, say)
A block of code that performs a specific function.
Another word for costume, an image that can be imported and shown.
A _________ is an ordered set of items as shown in the image.
list
string
sprite
function
The items in a list are ___________s. A ___________ is a sequence of characters (letters, digits, punctuation, etc.)
reporter
command
function
string
What is a flowchart?
A visual representation of an algorithm.
A diagram that shows abstraction.
A series of shapes.
Which of the following is done by decomposition?
Ensures that only 1 person can work on the problem
Disregards non-essential information
Breaks the problem down into smaller tasks
What is the AP equivalent to the JOIN command in snap?
Combination
Convey
Concatenation
