wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Unit 2 Quiz

Total questions: 62

Worksheet time: 42mins

Name
Class
Date
1.

What is a library in Computer Science?

a)

A collection of books

b)

A collection of If else statements

c)

Modularity

d)

A collection of procedures we can access and reuse

2.

What are the 3 building blocks of Algorithms?

a)
input, output, and processing
b)
variables, functions, and loops
c)
conditions, loops, and arrays
d)
sequence, selection, and iteration
3.

See image

a)

9

b)

5

c)

11

d)

12

4.

What are conditional statements?

a)
Conditional statements are statements in programming that allow different actions to be taken based on different conditions or criteria.
b)
Conditional statements are statements that are executed only once.
c)
Conditional statements are statements that are used to repeat a block of code multiple times.
d)
Conditional statements are statements that are used to define variables in programming.
5.

What is another word for iteration?

a)
loop
b)
recursion
c)
iteration
d)
repetition
6.

What is a global variable?

a)
A global variable is a variable that can only be accessed within a specific function or block of code.
b)
A global variable is a variable that is declared and used within a single function or method.
c)
A global variable is a variable that is limited to a specific class or object.
d)
A global variable is a variable that is accessible and can be used throughout the entire program, regardless of its scope.
7.

What is a local variable? Also known as a script variable.

a)
A local variable is a variable that is declared outside of any function or block and can be accessed from anywhere in the program.
b)
A local variable is a variable that is declared with the 'global' keyword and can be accessed from any function or block.
c)
A local variable is a variable that is declared inside a function or a block and can only be accessed within that function or block.
d)
A local variable is a variable that is declared with the 'static' keyword and retains its value between function calls.
8.

See image

a)

70

b)

80

c)

90

d)

101

9.

See image

a)

((day= “Tuesday” OR “Thursday”) AND ( gradeLevel<= 10))

b)

((day= “Tuesday” OR “Thursday”) OR ( gradeLevel<= 10))

c)

((day= “Tuesday” OR “Thursday”)

d)

( gradeLevel<= 10)

10.

See image.

a)

( "Jane" , 37)

b)

(Jane, 44)

c)

("Jane" , "66")

d)

None of the above

11.

What is a procedure call?

a)
A procedure call is a statement in a program that terminates the program execution.
b)
A procedure call is a statement in a program that defines a new procedure.
c)
A procedure call is a statement in a program that assigns a value to a variable.
d)
A procedure call is a statement in a program that invokes a specific procedure or function to perform a specific task or operation.
12.

What is the output?

a)

1,5

b)

2,4

c)

3,6

d)

0,2

13.

What is API?

a)
Application Programming Interface
b)
Application Programming Integration
c)
Automated Programming Interface
d)
Application Programming Instruction
14.

What information can we find in the API?

a)

Understanding how to use Snap

b)

Understanding how procedures work and what they require

15.

4 MOD 5

a)

2

b)

3

c)

4

d)

5

16.

What is the output?

a)

1 4 7 10 13

b)

4 7 10 13

c)

1 4 7 10

d)

13

17.

What will the procedure call badBunni (60) ?

a)

9

b)

6

c)

3

d)

2

18.

What will be displayed?

a)

2

b)

0

c)

35

d)

30

19.

What is an algortihm?

a)
A mathematical equation
b)
A step-by-step procedure or a set of rules for solving a specific problem or accomplishing a specific task.
c)
A type of computer program
d)
A form of encryption
20.

What would be the Boolean expression to determine if a number is even?

a)

number MOD 2 = 0

b)

number MOD 2 >= 0

c)

number MOD 2 = 1

d)

number MOD 2 > 0

21.

What is sequencing in algorithms?

a)

Going in order from top to bottom

b)

Running code depending on the Boolean condition

c)

Repetition

d)

None of the above

22.

What will be the output?

a)

7

b)

3 6 9 12

c)

The Repeat until will not work

d)

Will cause an infinite loop

23.

What are the 3 main data types we have work with in class?

a)

numbers
Boolean Values
MOD

b)

numbers

IF/ ELSE

Selection

c)

Numbers

Boolean Values

Strings

d)

Predicates

Reporters

Commands

24.

What would be the output for this program?

a)

L

b)

H

c)

Y

d)

T

25.

What would be the output?

a)

L

b)

H

c)

H T

d)

L J

26.

Which of the following code calls a procedure correctly for drawPolygon(sides, size) of 5 sides and size of 70?

a)
drawPolygon(5, 70)
b)
createPolygon(5, 70)
c)
polygon(5, 70)
d)

None are correct

27.

What are parameters in a procedure?

a)

Variables used to store values within a procedure and never used.

b)
Variables used to return values from a procedure.
c)

Variables used to pass values out of a procedure only.

d)
Variables used to pass values into a procedure.
28.

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?

a)
Parallel
b)
Sequential
c)
Recursive
d)

Conditional

29.

What is procedural abstraction?

a)
Procedural abstraction is a programming concept that allows the details of a procedure or function to be exposed, so that it can be used as a low-level operation with full knowledge of the specific implementation details.
b)
Procedural abstraction is a programming concept that allows the details of a procedure or function to be hidden, but still requires knowledge of the specific implementation details to use it.
c)
Procedural abstraction is a programming concept that allows the details of a procedure or function to be hidden, so that it can only be used as a low-level operation with limited knowledge of the specific implementation details.
d)
Procedural abstraction is a programming concept that allows the details of a procedure or function to be hidden, so that it can be used as a single, high-level operation without needing to know the specific implementation details.
30.

Consider the following code segment to the left.

Which of the variables have the value 50 after executing the code segment?

a)

x only

b)

y only

c)

x and z only

d)

x, y, and z

31.

Consider the following code segment to the left.

What is the value of r as a result of executing the code segment?

a)

10

b)

20

c)

30

d)

40

32.

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?

a)

temp ← word1

word3 ← word1

word1 ← temp

b)

temp ← word1

word1 ← word3

word3 ← temp

c)

temp ← word1

word1 ← word2

word2 ← word3

word3 ← temp

d)

temp ← word3

word3 ← word2

word2 ← word1

word1 ← temp

33.

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?

a)

(overallGPA > 3.0) AND (scienceGPA > 3.2)

b)

(overallGPA > 3.0) AND (scienceGPA ≥ 3.2)

c)

(overallGPA ≥ 3.0) AND (scienceGPA > 3.2)

d)

(overallGPA ≥ 3.0) AND (scienceGPA ≥ 3.2)

34.

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?

a)

3

b)

4

c)

5

d)

7

35.

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?

a)

b)

c)

d)

36.

What will the following algorithm display?
\leftarrow   13
\leftarrow   17
\leftarrow   a + 1
\leftarrow   a/7
DISPLAY(c)
DISPLAY(a)
DISPLAY(b)

a)

2, 14, 17

b)

13, 17, 5

c)

2, 12, 2

d)

14, 17, 2

37.

What will the following algorithm display?

a ← 13

a ← 17

a ← a+1

DISPLAY(a)

a)

13

b)

17

c)

18

d)

19

38.

definition of an assignment operator

a)

allows a program to change the value represented by a variable

b)

an ordered sequence of characters.

c)

a named group of programming instructions.

d)

NOT, AND, and OR, which evaluate to a Boolean value.

39.

definition of a logical operator

a)

a data type that is either true or false.

b)

NOT, AND, and OR, which evaluate to a Boolean value.

c)

<, >, <=, >=, ==, != indicate a Boolean expression

d)

allows a program to change the value represented by a variable

40.

What is the output?

a)

True

b)

False

41.

What is the output?

a)

True

b)

False

42.

What is the output?

a)

True

b)

False

43.

What is the output?

a)

True

b)

False

44.

What is the output?

a)

True

b)

False

45.

What is the output?

a)

True

b)

False

46.

What is the output?

a)

True

b)

False

47.

What is the output?

a)

True

b)

False

48.

What is the output?

a)

True

b)

False

49.

What is the output?

a)

True

b)

False

50.

What is the output?

a)

True

b)

False

51.

What is the output?

a)

True

b)

False

52.

What is the output?

a)

True

b)

False

53.

What is the output?

a)

True

b)

False

54.

What is the output?

a)

True

b)

False

55.

What is the output?

a)

True

b)

False

56.

Why are the blocks in this image called 'hat blocks'?

a)

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

b)

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

c)

Because these blocks can't be programmed for every sprite

d)

Because people typically own multiple hats and there are several different types of this block

57.

What is a sprite in SNAP?

a)

An object on the stage that the code can manipulate (move, show, say)

b)

A block of code that performs a specific function.

c)

Another word for costume, an image that can be imported and shown.

58.

A _________ is an ordered set of items as shown in the image.

a)

list

b)

string

c)

sprite

d)

function

59.

The items in a list are ___________s. A ___________ is a sequence of characters (letters, digits, punctuation, etc.)

a)

reporter

b)

command

c)

function

d)

string

60.

What is a flowchart?

a)

A visual representation of an algorithm.

b)

A diagram that shows abstraction.

c)

A series of shapes.

61.

Which of the following is done by decomposition?

a)

Ensures that only 1 person can work on the problem

b)

Disregards non-essential information

c)

Breaks the problem down into smaller tasks

62.

What is the AP equivalent to the JOIN command in snap?

a)
JOIN
b)

Combination

c)

Convey

d)

Concatenation