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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the range of values for a Int8?

A

-128 to 127

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the range of values for an UInt8 ?

A

0 to 255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the range of values for an Int16 ?

A

-32.768 to 32.767

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are Character Literals?

A

Character Literals are single characters surrounded by double-quotes:

“A”

“B”

”!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are String literals?

A

String literals are character sequences surrounded by double-quotes:

“Hello, World”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly