NEW
Font size
WorksheetsWarm Up - CAI711
Total questions: 10
Worksheet time: 8mins
Which of the following code segments is the proper declaration of a constant?
Name = “Hamad”
let name = “Hamad”
var name = “Hamad”
name : “Hamad”
let “Hamad” = name
Which of the following is ignored by the playground and does not affect how your code run?
Functions
Loops
Comment
Variables
Constants
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?
12
14
16
18
20
Explain why would the below statement show an error?
Print(“ This Exam is Easy”)
Braces are to be placed around the text instead of brackets
The text should be surrounded by single quotes.
Print keyword should start with a small p.
Square brackets should be placed around the text.
The Println keyword should replace the Print keyword
What is the output of the below code segment?
let coursecode = 74
print ("Welcome to App Development course code CSC\(coursecode) ")
coursecode = 75
Welcome to App Development course code CSC74
Welcome to App Development course code CSC\74
Welcome to App Development course code CSCcoursecode
Welcome to App Development course code CSC75
Code will return an error message
Which of the following signs is used for multiplication?
+
x
*
$
^
Which of the following is an assignment in programming?
I. // Update the variable value
II. let numberOfSodas = 7
III. 4 + 6 + 9
I only
II only
III only
I and III only
I, II and III
Which of the following code segments is the proper declaration of a constant?
age = “ten”
let age = “ten”
var age = “ten”
age : “ten”
let “age” = ten
What is the output of the below code segment?
let coursecode = 74
print ("Welcome to App Development course code CSC\(coursecode) ")
Welcome to App Development course code CSC74
Welcome to App Development course code CSC\74
Welcome to App Development course code CSCcoursecode
Welcome to App Development course code CSC75
Code will return an error message
Which of the following represents a type annotation in Swift?
let number = Double = 20
let number = 20 Double
let number : Double = 20
let Double (number) = 25
let number ; Double = 20
