wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Swift Playgrounds Part 2

Total questions: 15

Worksheet time: 30mins

Name
Class
Date
1.

What is Swift Playground?

a)

A tool used to write a pseudo code for any program

b)

Advanced tool to create applications

c)

Powerful programming language created by Apple

d)

An algorithmic designer tools

2.

What best describes an algorithm?

a)

A step-by-step series of operations

b)

Only calculations that use advanced mathematics

c)

The computer equivalent of rhythm

d)

The same thing as an identifier

3.

What is a sequence ?

a)

specific actions for the computer to perform

b)

Is the order in which the commands are given

c)

is the repeated actions

d)

is the algorithmic thinking skills

4.

What is coding?

a)

The repeated actions in the program

b)

Algorithmic thinking skills

c)

Telling a ​computer what to do.

d)

None of the above

5.

What is a mistake in code called?

a)

error

b)

debug

c)

bug

d)

misfunction

6.

By writing commands you give instructions to do something. Which command sequence is formatted correctly?

a)

collectGem()

moveForward()

b)

collect Gem ()

move Forward ()

c)

(moveForward)

(collectGem)

d)

moveForward() collectGem()

7.

Longer sequences of code can involve ----------------

a)

less bugs.

b)

more bugs.

c)

fewer variables.

d)

fewer actions.

8.

If the code is not running as intended, what could be the cause of the problem?

a)

bugs

b)

interface

c)

sequence

d)

code

9.

Sometimes we solve coding problems by combining existing commands to create a new behavior. This process is called composition. Which is an example from Swift Playgrounds of composition?

a)

When I told the bot to collectGem()

b)

When I learned to toggleSwitch()

c)

When I created a turnRight() with three turnLeft()

d)

When I write 1 line of code.

10.

With the following code, what would you expect to see happen when you run your code?


func saySomething ( ) {

print ("Functions are awesome")

saySomething ( )

}

saySomething ( )

a)

Functions are awesome, once

b)

Functions are awesome, twice

c)

Functions are awesome, repeated over and over and over...

d)

Nothing

11.

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

12.

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()

13.

()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()

14.

Base on the image, what type of codes is used?

a)

Logical AND operator

b)

Logical NOT operator

c)

While loop with an inner while loop

d)

Logical OR operator

e)

While loop nested in for a loop

15.

What is missing to solve this puzzle?

  1. Use for i in 1…12.
  2. Add a conditional “if isONClosedSwitch” statement that runs “toggleSwitch()” if true.
  3. ___________________
  4. Finally, add a “moveForward()” command.
a)

Use “else if isOnGem” to call “collectGem()” if true.

b)

Use “else if isOnOpenSwitch” to call “toggleSwitch()” if true.

c)

Use a function

d)

Use additional "for" statement