wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Swift Programming Review 1

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Runs a block of code over and over for a set number of times.

a)

For Loops

b)

Sequence

c)

Composition

d)

Call

2.

A collection of commands grouped together and given a name. The set of commands can then be run with just the name of the set whenever it is needed.

a)

For Loop

b)

Function

c)

Sequence

d)

Composition

3.

The process of identifying and fixing the error.

a)

sequence

b)

composition

c)

debugging

d)

bugging

4.

_________________ is telling a computer what to do.

a)

Call

b)

Commands

c)

Coding

d)

Composition

5.

A specific action for the computer to perform.

a)

sequence

b)

function

c)

command

d)

loop

6.

The order in which the commands are given.

a)

sequence

b)

composition

c)

command

d)

function

7.

An mistake in your code.

a)

error

b)

malfunction

c)

debug

d)

bug

8.

Telling a program to run a function.

a)

command

b)

call

c)

sequence

d)

coding

9.
Look at the image above. What is the bug in this sequence of commands?
a)
Byte needs to move forward again before he can collect the gem
b)
Byte needs to move forward twice before he can collect the gem
c)
Byte needs to turn left once before he can collect the gem
d)
Byte should only move forward once at the beginning of the sequence
10.

How many time would you loop this code in order for Mario to collect all of the stars:

moveForward( )

moveForward( )

collectStar( )

turnRight( )

a)

1

b)

2

c)

3

d)

4

11.

Which of the following is the correct code for Byte to collect a Gem?

a)

collectGem ( )

b)

CollectGem ()

c)

collectGem

d)

Collect Gem ( )

12.

Commands have no spaces between words and always end with:

a)

colon

b)

parentheses

c)

spaces

d)

semicolons

13.

You identified a repeating pattern in this puzzle and created a function that solves one instance of the pattern. Which of the following could be used to run the function until the puzzle is solved?

a)

for i in 1…12

b)

for i in 1…6

c)

for i in 1…4

d)

for i in 1…5

14.

Which of the following should be deleted from the sequence to solve the puzzle?

a)

toggleSwitch()

b)

moveForward()

c)

for i in 1…4 {

d)

turnRight()

15.

()After identifying a pattern of this puzzle, one of your students wants to define a function that will send Byte to collect a single Jen and return to the original center position. Which of the following could be added to “func SolveStair()” to achieve the students objective? Remember that there are multiple ways to solve a puzzle.

a)

moveForward()

collectGem()

turnAround()

moveForward()

b)

moveForward()

turnAround()

moveForward()

collectGem()

c)

turnRight()

moveForward()

collectGem()

turnRight()

moveForward()

d)

turnAround()

moveForward()

turnAround()

collectGem()

moveForward()