wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Unit-1 Computational Thinking

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is a valid reason for giving variables meaningful names in a program?

a)

A programmer will find it easier to read and understand the code since they will know what the variables represent.

b)

The compiler will be able to parse the code faster since it will know the purpose of each variable.

c)

The memory required to store the variables will be reduced as the possible values which can be stored by each variable can be determined from their names.

d)

The code will run with fewer errors since the CPU can interpret what the variable represents from its name.

2.

Which of the following describes good practice when naming variables in code?

  1. Use names which contain as few different characters to aid the compiler and shorten compile times
  2. Use names which show in what order the variables were introduced to make it easier to find the value of a variable
  3. Use names which describe what each variable represents to make code easier to understand
  4. Use concise names to avoid typos and keep code tidier
a)

All of the above

b)

2, 3 & 4 only

c)

3 & 4 only

d)

2 & 4 only

3.

Q. Which of the 4 computational thinking skills are required to complete the following task?: You and your family are planning a road trip through all of the capitals in the Europe and you have the job of figuring out the shortest route possible to save on the cost of fuel.

a)

Algorithm Design

b)

Decomposition

c)

Pattern Recognition

d)

Abstraction

4.

Q. What is the minimum number of bits you would need to encode the 26 letters of the alphabet plus a space -- for a total of 27 characters?

a)

5 bits

b)

10 bits

c)

9 bits

d)

27 bits

5.

8 bits is enough to represent 256 different numbers. How many total bits do you need to represent 512 (twice as many) numbers?

a)

9 bits

b)

17 bits

c)

10 bits

d)

16 bits

6.
a)

move 10 steps then stop

b)

broadcast RUN when distance is close

c)

make sprite run when distace is close

d)

glitch out

7.

The following incomplete algorithm appears in a Scratch script for a sprite, and is intended to draw a rectangle.

a)
b)
c)
d)
8.

Consider the following code segment, which is attached to a sprite in a Scratch program:


Suppose this Scratch program is run, and the user types 3 in response to the first question, and 5 in response to the second question. What number does the sprite say at the end of this script?

a)

No answer text provided.

b)

8

c)

6

d)

10

9.

A statistics teacher wishes to create a program on her calculator that generates a random even integer. The command built in the calculator to generate a random positive integer is RANDOM(a,b). This command generates a random integer between integers a and b (and including a and b). Which of the following lines of code will ensure that the random integer generated will be even?

a)

RANDOM(a,b) - 2

b)

RANDOM(a,b) + 1

c)

RANDOM(a,b) + 2

d)

RANDOM(a,b) * 2

10.

Which of the following should be true of any algorithm?

I. The order in which the steps making up the algorithm are followed is logically determined

II. Following the instructions in the algorithm will always result in the same outputs, regardless of any inputs

III. The instructions in the algorithm contain all necessary information to be implemented

a)

I, II and III

b)

II and III only

c)

I and III only

d)

I only

11.

Which of the following best describes how a compiled program is run by a computer?

a)

The CPU converts instructions into binary. RAM is used to look through and interpret these instructions which are then executed by the CPU.

b)

The instructions stored in the CPU are sent to RAM, where they are read and executed. Outputs for the program are then sent back to the CPU so they can be displayed

c)

The binary instructions from the program are loaded into RAM. The CPU reads and executes instructions, storing and accessing data from RAM as needed.

d)

The instructions are read directly from the computer hard disk, and the RAM and CPU work separately to execute different parts of the code as it is read.

12.

Which of the following best describes “compilation” in reference to computer science?

a)

Instructions are repeated a set number of times, or until some specified objective is completed.

b)

Code in a high-level language is converted to low-level instructions which can be interpreted and run by the CPU.

c)

Algorithms which have been planned, for example using flow-charts, are written in code.

d)

Memory is set aside to store variables and instructions so that a program can be executed.

13.

Consider the following algorithm which uses an integer variable n.

  1. Double the value of n
  2. Add 34 to the answer
  3. Round the answer to the nearest ten
  4. Sum the digits of the answer
  5. Display the final answer

Which of the following statements best describes the predictability of the results when this algorithm is run on a computer?

a)

The answer displayed by the algorithm can be predicted for some values of n, but not for others.

b)

It is impossible to predict the value of the answer displayed, even if the value of n is known.

c)

The algorithm always displays the same answer, regardless of the value of n.

d)

The answer displayed by the algorithm for any known value of n can always be predicted.

14.

Understanding of the life cycle of a program is an essential component to becoming an effective programmer. Which of the following is the best example of how the life cycle of a program should work?

a)

Idea→write code→algorithm→execute code→debug→maintain

b)

Idea→algorithm→write code→execute code→debug→maintain

c)

Idea→algorithm→write code→execute code→maintain→debug

d)

Idea→algorithm→write code→debug→execute code→maintain

15.

Consider the following statement which refers to the block

When you execute this block in Scratch, your computer is actually doing several things: retrieving values from memory representing the direction and position of the sprite, performing an algorithm to update these values, and changing the display in the window to match the updated state of the program. All of these actions are represented by just one single block.

Which of the following terms names the phenomenon which is best described by this statement?

a)

Abstraction

b)

Compilation

c)

Sequencing

d)

Iteration

16.
a)

Randomly move a sprint around

b)

play a sound when sprite is clicked

c)

none of the above

d)

both of the above

17.

What are the values of Fruit and Citrus after this script is done?

a)

Fruit = 12, Citrus = 17

b)

Fruit = 12, Citrus = 16

c)

Fruit = 13, Citrus = 16

d)

Fruit = 4, Citrus = 12

18.

What is returned by 10 MOD 3 or 10 % 3?

a)

1

b)

2

c)

3

d)

4

19.

Which is not an example of abstraction?

a)

You parents tell you to clean your room instead of each individual thing that should be done.

b)

A programmer calls a function that was written by another programmer, but doesn't need to know the details of the function.

c)

A program performs repetitive tasks in a loop

d)

You don't need to know how a dishwasher works, just that it will wash the dishes

20.

A variable that can only be True or False is a(n):

a)

Integer

b)

Floating-point number

c)

String

d)

Boolean