wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Swift Practice Quiz Fall 25

Total questions: 26

Worksheet time: 23mins

Name
Class
Date
1.

What is a “program”?

a)

A mistake in your code

b)

A set of instructions a computer follows

c)

A type of animation

d)

A computer robot

2.

In Swift, what does let create?

a)

A changeable value

b)

A loop

c)

A constant value

d)

A function

3.

In Swift, what does var create?

a)

A comment

b)

A constant

c)

A changeable variable

d)

A list

4.

What are comments used for?

a)

To run the code faster

b)

To write notes the computer ignores

c)

To break the code

d)

To print text on the screen automatically

5.

Which line prints text to the screen?

a)

show("Hello")

b)

print("Hello")

c)

text("Hello")

d)

write("Hello")

6.

What is a “bug”?

a)

A way to repeat code

b)

A tool inside Swift Playgrounds

c)

An error in your code

d)

A small robot

7.

What does a loop do?

a)

Stops the program forever

b)

Repeats a set of instructions

c)

Changes text to numbers

d)

Deletes variables

8.

Which keyword starts a function?

a)

fun

b)

function

9.

What is the name of the function in this code?

a)

code

b)

jump

c)

func

d)

{}

10.

Why do programmers indent code?

a)

To make programs slower

b)

To make code look organized

c)

To hide code from Swift

d)

To delete comments

11.

What is an if statement used for?

a)

To repeat code many times

b)

To make decisions

c)

To create comments

d)

To name variables

12.

Which is an example of an if statement?

a)

if energy > 5 { moveForward() }

b)

moveForward() moveForward()

c)

let energy = 10

d)

print("Energy")

13.

What is an array?

a)

A mistake in your code

b)

A tool for printing text

c)

A collection of values

d)

A function inside Swift

14.

Which line creates an array of numbers?

a)

let numbers = 1,2,3,4

b)

let numbers = [1, 2, 3, 4]

c)

var numbers: 1234

d)

array numbers = 1 2 3 4

15.

What happens when you use for value in array?

a)

You print all values

b)

You repeat code once

c)

You loop through each item in the array

d)

You delete the array

16.

In Swift Playgrounds, what does Byte usually do?

(a)  

17.

Which command makes Byte move forward?

a)

go()

b)

moveForward()

c)

move()

d)

forward()

18.

Which command makes Byte turn left?

a)

spinLeft()

b)

turnAround()

c)

turnLeft()

d)

left()

19.

What is the purpose of collectGem()?

a)

To make Byte jump

b)

To pick up a gem

c)

To place a block

d)

To reset Byte

20.

Why do we use functions when programming Byte?

a)

To save time and avoid repeating long code

b)

To confuse the computer

c)

To delete loops

d)

To make the world harder

21.

A constant (let) can be changed later.

a)

True

b)

False

22.

Variables (var) can change while the program runs.

a)

True

b)

False

23.

Which of these is a correct function call?

a)

jump[]

b)

jump()

c)

run jump

d)

call jump

24.

What does the curly brace { do?

a)

Starts or ends a block of code

b)

Prints text

c)

Creates a variable

d)

Turns Byte

25.

There are 2 loops nested in this set of code. The Outer loop will cause the sprite to move​ ​ ​ (a)   and the inner loop will cause the sprite to move ​ (b)   .

Choose from the below words
around the sides
spaces
26.

This is an example of (a)  

Choose from the below words
a loop
nested loops
a function
a conditional