wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Apple - Learn to code (revision 1)

Total questions: 10

Worksheet time: 11mins

Name
Class
Date
1.

Which of the following values would be best represented with a constant?

a)

Player name

b)

Player level

c)

Player score

d)

Player location

2.

Which of the following would be best represented with a variable?

a)

Name

b)

Birthday

c)

Age

d)

Home address

3.

Which keyword is used to declare a constant?

a)

const

b)

var

c)

let

4.

Which keyword is used to declare a variable?

a)

const

b)

var

c)

let

5.

What is the value of myNumber at the end of the following code?

let x = 2

let y = 4

let z = 6

let myNumber = x + y + z

a)

4

b)

6

c)

10

d)

12

6.

What is the value of myNumber at the end of the following code?

let x = 2

let y = 4

let z = 6

let myNumber = (x + y) * z

a)

12

b)

24

c)

36

d)

42

7.

What is the operator called when it has an arithmetic symbol in front of the equals sign?


myScore += 100

a)

Assignment operator

b)

Compound assignment operator

c)

Plus equals operator

d)

Reset operator

8.

Fill in the blanks below to declare a variable named "test" with the initial value "Hi", then assign it the value "I love Swift!".


__ test __ "Hi“

__ = "I love Swift!".

(a)  

9.

Fill in the blanks using the options below to declare a constant named "name" and a variable called "age".


_ name = “David”

_ _ = "25"

(a)  

10.

Fill in the blanks from the options below to indicate types for the constants.


let meaningOfLife = 42 // _

let pi = 3.14159 // _

(a)