Font size
WorksheetsSwift Practice Quiz Fall 25
Total questions: 26
Worksheet time: 23mins
What is a “program”?
A mistake in your code
A set of instructions a computer follows
A type of animation
A computer robot
In Swift, what does let create?
A changeable value
A loop
A constant value
A function
In Swift, what does var create?
A comment
A constant
A changeable variable
A list
What are comments used for?
To run the code faster
To write notes the computer ignores
To break the code
To print text on the screen automatically
Which line prints text to the screen?
show("Hello")
print("Hello")
text("Hello")
write("Hello")
What is a “bug”?
A way to repeat code
A tool inside Swift Playgrounds
An error in your code
A small robot
What does a loop do?
Stops the program forever
Repeats a set of instructions
Changes text to numbers
Deletes variables
Which keyword starts a function?
fun
function
What is the name of the function in this code?
code
jump
func
{}
Why do programmers indent code?
To make programs slower
To make code look organized
To hide code from Swift
To delete comments
What is an if statement used for?
To repeat code many times
To make decisions
To create comments
To name variables
Which is an example of an if statement?
if energy > 5 { moveForward() }
moveForward() moveForward()
let energy = 10
print("Energy")
What is an array?
A mistake in your code
A tool for printing text
A collection of values
A function inside Swift
Which line creates an array of numbers?
let numbers = 1,2,3,4
let numbers = [1, 2, 3, 4]
var numbers: 1234
array numbers = 1 2 3 4
What happens when you use for value in array?
You print all values
You repeat code once
You loop through each item in the array
You delete the array
In Swift Playgrounds, what does Byte usually do?
(a)
Which command makes Byte move forward?
go()
moveForward()
move()
forward()
Which command makes Byte turn left?
spinLeft()
turnAround()
turnLeft()
left()
What is the purpose of collectGem()?
To make Byte jump
To pick up a gem
To place a block
To reset Byte
Why do we use functions when programming Byte?
To save time and avoid repeating long code
To confuse the computer
To delete loops
To make the world harder
A constant (let) can be changed later.
True
False
Variables (var) can change while the program runs.
True
False
Which of these is a correct function call?
jump[]
jump()
run jump
call jump
What does the curly brace { do?
Starts or ends a block of code
Prints text
Creates a variable
Turns Byte
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) .
This is an example of (a)
