Types Flashcards
1
Q
What data types are supported by Swift?
A
- Bool - Boolean Value
- Int - Signed Integer Value
- UInt - Unsigned Integer Value
- Double -Double-precision (64-bit) floating-point value
- Float - Single Precision (32-bit) floating-point value
- Character - A single Unicode character
- String - An ordered collection of characters
2
Q
What is the range of values for a Int8?
A
-128 to 127
3
Q
What is the range of values for an UInt8 ?
A
0 to 255
4
Q
What is the range of values for an Int16 ?
A
-32.768 to 32.767
5
Q
How can you determine the maximum and minimum values that can be stored by each integer type?
A
By using the max and min properties.
UInt8.max // returns 255
Int16.min // returns -32768
6
Q
What are Character Literals?
A
Character Literals are single characters surrounded by double-quotes:
“A”
“B”
”!”
7
Q
What are String literals?
A
String literals are character sequences surrounded by double-quotes:
“Hello, World”