# 7.1 Programming Fundamentals Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a data type

A

Values than be used in a data item

2
Q

Give some data types

A

Integer, float/real, character, string, Boolean

3
Q

Integer

A

Whole numebers

4
Q

Typical amount of memory for integer

A

2 bytes

5
Q

Float/real

A

Number with a fraction part (1.3, 20.0)

6
Q

Typical amount of memory for float/real

A

4 bytes

7
Q

Char

A

A single ASCII char such as A, b, !, 3 and Space

8
Q

Typical amount of memory for a char

A

1 byte

9
Q

String

A

0 or more chars

10
Q

Typical amount of memory for string

A

1 byte per char in string

11
Q

Boolean

A

True or False

12
Q

Typical amount of memory for a boolean

A

Theoretically 1 bit, but in high level languages often 1 byte

13
Q

Difference between variables and constants

A

Variables can be changed while running and constants can only be changed before the program is run.

14
Q

Input Statement

A

A way to gather inputted information from the user via the CLI (Command Line Interface)

15
Q

Give some arithmetic operators

A

+, -, *, /, DIV, MOD

16
Q

DIV

A

Used for integer division (quotient)

17
Q

MOD

A

Modulus is used to find the remainder when dividing one integer by another

18
Q

What rules do arithmetic operations follow?

A

BIDMAS (Brackets, indices, division, multiplication, addition, subtraction)

19
Q

What is the difference between the way the integer 17 is stored and the string “17” is stored?

A

17 is stored as binary 17, whereas the string “17” is stored as the string of “1” and then the string of “7”

20
Q

Casting

A

Functions to change the datatype of one variable to another

21
Q

Examples of casting functions

A
• int()
• float()
• str()
• bool()
• ASC()
• CHR()
• b()
22
Q

What is string concatenation?

A

The operation of joining and manipulating the data held in strings

23
Q

What will “6” +”3” add to?

A

63 (because they are strings which means they are concatenated together)

24
Q

Give some string handling functions (written in python)

A
```len(string)
string[x:]
string[:x]
string.upper()
string.lower()```
25
Q