
Understanding Swift Variables and Scope
Authored by Iman Meg
Computers
9th Grade
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
9 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a variable in Swift?
A constant value that cannot be changed
A named storage that can hold a value
A function that performs a specific task
A type of loop used in programming
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct way to declare a variable in Swift?
`let age = 25`
`var name = "John"`
`int height = 180`
`string city = "New York"`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between `let` and `var` in Swift?
`let` is used for loops, `var` is used for functions
`let` declares a constant, `var` declares a variable
`let` is used for strings, `var` is used for integers
`let` is used for global scope, `var` is used for local scope
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a global variable?
A variable declared inside a function
A variable declared outside all functions
A variable declared inside a loop
A variable declared inside a conditional statement
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the scope of a local variable?
It can be accessed from anywhere in the program
It can only be accessed within the block where it is declared
It can be accessed by all functions in the program
It can be accessed by all classes in the program
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct data type in Swift?
`integer`
`float`
`Int`
`double`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following Swift code? ```swift var x = 10 x = 20 print(x) ```
10
20
30
Error
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
4Q Week3 Review Quiz (Who missed the Quiz ONLY))
Quiz
•
9th Grade
12 questions
Kiểm tra giữa kì 2 lớp 7
Quiz
•
9th Grade
10 questions
Arduino
Quiz
•
7th - 12th Grade
10 questions
Sistema Operativo
Quiz
•
1st - 12th Grade
10 questions
Câu hỏi về thiết bị máy tính
Quiz
•
7th Grade - University
10 questions
Операторы и функции языка Pascal
Quiz
•
1st - 10th Grade
13 questions
Redes Sociales y su impacto
Quiz
•
1st - 9th Grade
11 questions
ICT - Networks and communication
Quiz
•
9th Grade
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
Exploring Valentine's Day with Charlie Brown
Interactive video
•
6th - 10th Grade
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
20 questions
El Verbo IR Practice
Quiz
•
9th Grade
10 questions
Valentine's Day History and Traditions
Interactive video
•
6th - 10th Grade
20 questions
Graphing Inequalities on a Number Line
Quiz
•
6th - 9th Grade
20 questions
Exponent Properties
Quiz
•
9th Grade
21 questions
Presidents Day Trivia
Quiz
•
6th - 12th Grade
10 questions
Valentine's Day: History and Modern Celebration
Interactive video
•
9th - 12th Grade