Unit 2 Programming (C7) Flashcards

1
Q

What is a variable?

A

A location in memory that can store one or more values in RAM. They are assigned an identifier upon creation.

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

What is an identifier?

A

A name given to a variable which allows the programmer to distinguish it from other variables.

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

What are the four data types?

A

String, Integer, Float, Real, Boolean

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

What is a string?

A

Data which contains a sequence of characters that can be letters, numbers or special characters.

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

What is an integer?

A

Data which contains only whole numbers

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

What is a real?

A

Data which contains decimal numbers

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

What is a Boolean?

A

Data which contains a “True” or “False” statement

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

What is an input?

A

Data entered by the user into the program

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

What is casting?

A

Changing the data type of a variable, such as an integer, 54, to a string “54”. This can be done by using the name of the data type and putting the data or variable in brackets i.e. str(54)

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

What is a modulus (a MOD number)?

A

The remainder that is left when a number is divided by another. Represented by the % sign i.e. 5 % 2 = 1

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

What is a quotient (a DIV number)?

A

Returns the nearest whole number of a division (known as the quotient) i.e. 5 // 2 = 2

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

What is an exponential?

A

Multiplying a number to the power of another (squaring cubing etc.)

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

What is a concatenation?

A

The linking of two strings using a +

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

What is string traversal?

A

Programming software is able to keep track of the position of every character within the string, allowing you to change individual characters without affecting the whole string.

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

What do you use to change the case of a variable?

A

variable.upper() or variable.lower()

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

What do you use to calculate the length of a string?

A

len(variable)

17
Q

What is a substring?

A

A string of characters that exists within a larger string, for example the first name of Harry Smith would be [0:5]
and the last name would be [7: ]

18
Q

What is a comparison and what symbols can be used to make one?

A

A comparison is a operator used to decide the result of a program by comparing 2 or more values using symbols such as = == != < <= > >=

19
Q

What is an operator?

A

A symbol used to instruct a program to perform a specific operation. Examples include + - * / % // ** == != < <= > >= and or not