wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Swift Playground Programming Quiz

Total questions: 10

Worksheet time: 15mins

Name
Class
Date
1.

What is Swift Playground?

a)

A place you can play quickly

b)

An app on the iPad that helps you learn to code in Swift

c)

An app used to create artwork

d)

An app where you can play games on

2.

What is a code?

a)

A set of instructions for a program to follow

b)

A list of items

c)

A website

d)

A way to make music on the computer

3.

What is the command to move the character forward once?

a)

moveForward()

b)

move forward once

c)

: move forward

d)

robot move foward

4.

Which command is used to turn the switch on?

a)

turnOnSwitch()

b)

Switch()

c)
toggleSwitch()
d)
onSwitch()
5.

Why do we need to write functions?

a)

To group a set of commands together and call them

b)

To write more code

c)

To make the code more complicated

d)

To change how the character moves

6.

How can you create the new function turnAround() ?

a)

func turnAround()

{

turnLeft()

turnLeft()

}

b)

func turnAround()

{

2 turnLeft()

}

c)

func turnAround()

{

turnLeft()

turnLeft()

turnLeft()

moveForward()

}

d)

func turnAround()

{

}

turnLeft()

turnLeft()

7.

Which set of commands would work for the function gemAndSwitch() ?

a)

moveForward()

collectGem()

moveForward()

toggleSwitch()

b)

moveForward()

moveForward()

toggleSwitch()

collectGem()

c)

collectGem()

toggleSwitch()

d)

turnleft()

moveForward()

ToggleSwitch()

collectGem()

moveForward()

8.

What is a loop?

a)

A way to write a code once and repeat it a number of times

b)

When you write a command over and over again

c)

A function

d)

A special command

9.

Which one of these shows you how to write code for a loop?

a)

for i in 1 ... 4 {

    moveForward()

    collectGem()

    moveForward()

    turnRight()

}

b)

repeat 4 times {

    moveForward()

    collectGem()

    moveForward()

    turnRight()

}

c)

copy 4 {

    moveForward()

    collectGem()

    moveForward()

    turnRight()

}

d)

moveForward()

collectGem()

moveForward()

turnRight()

10.

Which piece of code will help the character collect all the gems?

a)

for i in 1 ... 5 {

moveForward()

moveForward()

collectGem()

moveForward()

}

b)

for i in 1 ... 3 {

moveForward()

moveForward()

collectGem()

moveForward()

}

c)

for i in 1 ... 5 {

moveForward()

collectGem()

moveForward()

}

d)

for 5 {

moveForward()

moveForward()

collectGem()

moveForward()

}