Programming Basics - Data Types and Operators Flashcards

1
Q

How many main data types are there?

A

5

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

What is an integer (int)?

A

Whole numbers only e.g. 8,0,-567,6482

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

What is a real/float (real)?

A

Numbers that have a decimal part. e.g. 0.15, -2.67, 100.0

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

What is a boolean (bool)?

A

Can only take one of two values, usually TRUE or FALSE.

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

What is a character (char)?

A

A single letter, number, symbol. e.g. “£”,”7”,”a”

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

What is a string (str)?

A

Used to represent text, is a collection of characters. e.g. “Ftsd4” or “876££”

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

What does using correct data types do to code?

A

Makes code more memory efficient, robust and predictable.

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

Each data type has different amounts of memory. What are they?

A

Integer: 2 or 4 bytes
Real: 4 or 8 bytes
Boolean: 1 bit needed but 1 byte normally used
Character: 1 byte
String: 1 byte for every character in the string

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

What will weakly typed languages do?

A

Try convert data types to avoid errors, but can lead to unpredictable results.

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

What will strongly typed languages do?

A

Won’t try convert data types so will produce more errors but more predictable results.

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

What is casting?

A

Langages have functions that let you manually convert between data types. This is known as casting.

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