NEW
Font size
S
M
L
XL
WorksheetsConstants and Naming
Total questions: 10
Worksheet time: 4mins
Name
Class
Date
1.
Which of the following will NOT properly declare and initialize a constant?
a)
let num = 12;
b)
let myShoes = "velcro shoes";
c)
myCat = "Fat Cat";
d)
let r = 100;
2.
What is a constant used for?
a)
To be able to reuse a value by name, without changing the value.
b)
Set a value to a name and be able to change it whenever you want/need.
3.
What is the best name for an identifier, defined as the number of oranges?
a)
num
b)
numberOfOranges
c)
x
d)
integerValue
4.
What is the best name for an identifier, storing the last name of a customer?
a)
CustomerName
b)
customerLastName
c)
nom
d)
cLN
5.
What is the best name for an identifier which stores the number of shirts in your closet?
a)
sInClos
b)
ShirtsInCloset
c)
shirtsInCloset
d)
shirtsOwned
6.
Which will NOT result in a value of 12 displaying on the right side toolbar of the playground in XCode?
a)
2 + 4 + 5;
b)
(12 / 2) + 6;
c)
let twelve = 12;
twelve;
twelve;
d)
let twelve = 10;
twelve + 2;
twelve + 2;
7.
What does it mean to "declare" something is programming?
a)
To write a comment that explains your calculation.
b)
To write a hypothesis that you believe to be true.
c)
To set a requirement on a performance measurement.
d)
To give a name to something for the first time.
8.
Which of the following are strings?
a)
"Lute"
b)
Violin
c)
"Cello" and Harp
d)
All of these are strings, since they are written which characters.
9.
Which of the following are strings?
a)
"$5,000.00"
b)
100%
10.
What is the result of "1" + "1"
a)
"2"
b)
"11"
c)
"41"
d)
Error: Can't add Strings
Reset
