wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Warm Up - CAI711

Total questions: 10

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following code segments is the proper declaration of a constant?

a)

Name = “Hamad”

b)

let name = “Hamad”

c)

var name = “Hamad”

d)

name : “Hamad”

e)

let “Hamad” = name

2.

Which of the following is ignored by the playground and does not affect how your code run?

a)

Functions

b)

Loops

c)

Comment

d)

Variables

e)

Constants

3.

let x = 2

let y = 3

let z = 4

let result = (x + y) * z


What is the value of result after running the above code?

a)

12

b)

14

c)

16

d)

18

e)

20

4.

Explain why would the below statement show an error?

Print(“ This Exam is Easy”)

a)

Braces are to be placed around the text instead of brackets

b)

The text should be surrounded by single quotes.

c)

Print keyword should start with a small p.

d)

Square brackets should be placed around the text.

e)

The Println keyword should replace the Print keyword

5.

What is the output of the below code segment?

let coursecode = 74

print ("Welcome to App Development course code CSC\(coursecode) ")

coursecode = 75

a)

Welcome to App Development course code CSC74

b)

Welcome to App Development course code CSC\74

c)

Welcome to App Development course code CSCcoursecode

d)

Welcome to App Development course code CSC75

e)

Code will return an error message

6.

Which of the following signs is used for multiplication?

a)

+

b)

x

c)

*

d)

$

e)

^

7.

Which of the following is an assignment in programming?

I. // Update the variable value

II. let numberOfSodas = 7

III. 4 + 6 + 9

a)

I only

b)

II only

c)

III only

d)

I and III only

e)

I, II and III

8.

Which of the following code segments is the proper declaration of a constant?

a)

age = “ten”

b)

let age = “ten”

c)

var age = “ten”

d)

age : “ten”

e)

let “age” = ten

9.

What is the output of the below code segment?

let coursecode = 74

print ("Welcome to App Development course code CSC\(coursecode) ")

a)

Welcome to App Development course code CSC74

b)

Welcome to App Development course code CSC\74

c)

Welcome to App Development course code CSCcoursecode

d)

Welcome to App Development course code CSC75

e)

Code will return an error message

10.

Which of the following represents a type annotation in Swift?

a)

let number = Double = 20

b)

let number = 20 Double

c)

let number : Double = 20

d)

let Double (number) = 25

e)

let number ; Double = 20