NEW
Font size
WorksheetsApple Swift Coding I - Lesson 1 - 6
Total questions: 30
Worksheet time: 15mins
Which option uses more specific names?
dollarPerSandwich * customerCount
numberOfDollars * numberOfPeople
Which of these is an "assignment" in programming?
Giving a name to a particular value, such as: let numberOfSodas = 7
Describing a programming task in a comment, such as: // TODO: Update the sharing message
Running a calculation, such as: 4 + 6 + 9
Which line will be run?
// 10 – 8 +3
18 + 7 + 365
The first line
The second line
Both
Neither
What does it mean to "declare" something in programming?
To write a comment that explains your calculation
To write a hypothesis that you believe to be true
To set a requirement on a performance measurement
To give a name to something for the first time
Which option uses more specific names?
calculatedSpeed < anotherSpeed
currentSpeed <maximumSpeed
Which of these is written in "camel case"?
FIRSTname
first_name
firstName
first.name(camel)
Which of these are strings?
“9.99”
“100%”
Neither
Both A and B
Which of these are strings?
"Happy birthday"
88
Neither
Both A & B
The second line below has a "use of unresolved identifier" error. What does that mean?
let playgroundName = "My Playground"
let welcomeMessage = "Come and play in \(playGroundName)"
The string interpolation is done wrong; it should use a /
You can't repeat names
playGroundName isn't a string
Names need to match capital and lowercase letters; it should be playgroundName
Which of these are strings?
let myLuckyNumber = 42
"\"Curiouser and curiouser, \ "said Alice."
Neither
Both A & B
Which option uses a more specific name?
X
Distance
. Which of these is the escape character to coding in Swift?
/
\
!
ESC
What is the result of the expression "1" + "1"
Hint: Not sure? Open the Strings playground, type it in and try it. That's not cheating: programmers try out little bits of code in Playgrounds all the time.
2
"2"
11
"11'
Identify this part of a playground.
// Qualifying total time
Details you can’t edit
A code comment
A line with an error
Results view
What is a character in programming?
A distinguished coder like Ada Lovelace or Alan Turing
The first 140 ASCII symbols
A letter from A to Z
Treating the next character in a special way
Which of the following is not a benefit of using functions?
They prevent repeated code organization
They can give you infinite loops
They keep your code organized
They make large programs easier to understand
What is the escape character for?
Undoing the last program command
Telling the computer to quit an app
Skipping the rest of the string
Treating the next character in a special way
// My total time
! 81 + 97 + 80b
A code comment
Details you can’t edit
A line with an error
Results View
With the following code, what would you expect to see in the console in a playground?
func saySomething ( ) {
print ("Functions are awesome")
}
Functions are awesome
saySomething
Nothing
Which line is the correct way to declare a function?
let myFunction = func ( ) {
let func = myFunction ( ) {
func MyFunction ( ) {
func = myFunction ( ) {
A representation of almost any character from any language such as French, German, Spanish, Russian also including emoji's.
Escape sequence
Unicode
String interpolation
Quick Look Button
Identify the part of a playground in red.
Side bar
81
81
97
97
80
80
A code comment
Details you can’t edit
A line with an error
Results View
Identify this part of a playground.
Will your time qualify?
A code comment
A line with an error
Details you can't edit
Results view
With the following code, what would you expect to see in the console in a playground?
func saySomething ( ) {
print ("Functions are awesome")
saySomething ( )
}
saySomething ( )
Functions are awesome, once
Functions are awesome, twice
Functions are awesome, repeated over and over and over...
Nothing
What don't programmers like doing?
Coding
Reading
Repeating themselves
Writing
What's another word for the lines of code that a function contains?
Body
Clause
Parameters
Return value
With the following code, what would you expect to see in the console in a playground?
func saySomething ( ) {
print ("Functions are awesome")
}
saySomething ( )
a. Funtions are awesome
a. saySomething
Nothing
Which of these messages belongs in a console instead of in the view that the user sees?
Error - 1000 (kCFURLErrorBadURL):"asdfwefawge.ed"
We can't find the page "asdfwefawge.ed"
Which of these messages belongs in a console instead of in the main app's UI?
Connection restored (now ReachableViaWWAN). Offline time: 1587 secs.
You're back online!
Which of these messages belongs in a console instead of in the main app's UI?
Your changes couldn't be saved.
Mutating an object 0x98126450 after it has been removed from its context
