Scratch Test Review
By Mickey Arnold
starstarstarstarstarstarstarstarstarstar
Last updated 10 months ago
13 Questions
1 point
1
Question 1
1.
What is output by the code to the right?
set a to 99if a > 99 say "abc"say "def"
What is output by the code to the right?
set a to 99
if a > 99
say "abc"
say "def"
1 point
1
Question 2
2.
What is output by the code to the right?
set b to 100if b > 99 say "abc"say "def"
What is output by the code to the right?
set b to 100
if b > 99
say "abc"
say "def"
1 point
1
Question 3
3.
What is output by the code to the right?
set c to 100if c = 100 say "wow"if c > 95 say "def"
What is output by the code to the right?
set c to 100
if c = 100
say "wow"
if c > 95
say "def"
1 point
1
Question 4
4.
What is output by the code to the right?
set d to 100set e to 88if d > 90 say "abc"if e < 95 say "def"
What is output by the code to the right?
set d to 100
set e to 88
if d > 90
say "abc"
if e < 95
say "def"
1 point
1
Question 5
5.
What is output by the code to the right?
set f to 100set g to 88if f > 99 say "abc"if g > 95 say "def"
What is output by the code to the right?
set f to 100
set g to 88
if f > 99
say "abc"
if g > 95
say "def"
1 point
1
Question 6
6.
What is output by the code to the right?
set h to 100set i to 88if h > 90 if i > 95 say "def"if h > 95 say "ghi"
What is output by the code to the right?
set h to 100
set i to 88
if h > 90
if i > 95
say "def"
if h > 95
say "ghi"
1 point
1
Question 7
7.
What is output by the code to the right?
set f to 1
set g to 0
repeat until f > 16 change g by f change f by 7say g
What is output by the code to the right?
set f to 1
set g to 0
repeat until f > 16
change g by f
change f by 7
say g
1 point
1
Question 8
8.
What is output by the code to the right?
set f to 45
set g to 0
repeat until f < 30 change g by f change f by -7say g
What is output by the code to the right?
set f to 45
set g to 0
repeat until f < 30
change g by f
change f by -7
say g
1 point
1
Question 9
9.
What is output by the code to the right?
set list as emptyset a to 3repeat 2 add a to listsay list
What is output by the code to the right?
set list as empty
set a to 3
repeat 2
add a to list
say list
1 point
1
Question 10
10.
Which of the following code statements would correctly fill <*1>?
//the following code would create a list//of random numbers//the user would be asked for a value//the code would search for value in the list//and count each occurrence of value in the listset list as emptyset rand to 0repeat 10 set rand to pick random 1 to 10 add rand to list
set count to 0ask "Enter a number" and waitset find to answerset spot to 1repeat 10 if item spot of list = find <*1> <*2>say count
Which of the following code statements would correctly fill <*1>?
//the following code would create a list
//of random numbers
//the user would be asked for a value
//the code would search for value in the list
//and count each occurrence of value in the list
set list as empty
set rand to 0
repeat 10
set rand to pick random 1 to 10
add rand to list
set count to 0
ask "Enter a number" and wait
set find to answer
set spot to 1
repeat 10
if item spot of list = find
<*1>
<*2>
say count
1 point
1
Question 11
11.
Which of the following code statements would correctly fill <*2>?
//the following code would create a list//of random numbers//the user would be asked for a value//the code would search for value in the list//and count each occurrence of value in the listset list as emptyset rand to 0repeat 10 set rand to pick random 1 to 10 add rand to list
set count to 0ask "Enter a number" and waitset find to answerset spot to 1repeat 10 if item spot of list = find <*1> <*2>say count
Which of the following code statements would correctly fill <*2>?
//the following code would create a list
//of random numbers
//the user would be asked for a value
//the code would search for value in the list
//and count each occurrence of value in the list
set list as empty
set rand to 0
repeat 10
set rand to pick random 1 to 10
add rand to list
set count to 0
ask "Enter a number" and wait
set find to answer
set spot to 1
repeat 10
if item spot of list = find
<*1>
<*2>
say count
1 point
1
Question 12
12.
What is returned by the call isBiggerThan25( 111 ) ?
isBiggerThan25( number ) if number > 25 report true report false
What is returned by the call isBiggerThan25( 111 ) ?
isBiggerThan25( number )
if number > 25
report true
report false
1 point
1
Question 13
13.
What is returned by the call
countEm( 4,8,5,5,6,7 ) ?
isHuh( number ) if not number mod 2 = 0 report false report truecountEm( list ) set spot to 0 set count to 0 repeat length of list if isHuh(item spot of list) change count by 1
change spot by 1report count
What is returned by the call
countEm( 4,8,5,5,6,7 ) ?
isHuh( number )
if not number mod 2 = 0
report false
report true
countEm( list )
set spot to 0
set count to 0
repeat length of list
if isHuh(item spot of list)
change count by 1
change spot by 1
report count