Programming Fundamentals Flashcards

1
Q

What is an INTEGER?

A

Whole numbers that can be positive or negative and includes 0.

Examples include -5, 0, and 7.

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

What is a REAL / FLOAT?

A

Numbers that have a decimal point, which can also be negative.

Examples include -1.8, 0.5, and 3.14.

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

What is a BOOLEAN?

A

A data type that can only take one of two values: TRUE or FALSE, YES or NO, 0 or 1.

Used in logical operations.

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

What does CHARACTER represent in programming?

A

A single letter, number or symbol, e.g. 6, Y, &.

It is often used to denote individual characters in strings.

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

What is a STRING?

A

A collection of characters used to represent text, e.g. ‘Mavis’, ‘C19$8’.

Strings can include spaces and punctuation.

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

Fill in the blank: A BOOLEAN can only take the values _______.

A

TRUE or FALSE

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

True or False: A FLOAT can only be a positive number.

A

False

FLOATs can be negative, such as -1.5.

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

What is casting?

A

Casting is used to change the data type.

e.g. You could change the integer 7 to string “7”.

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

What are arithmetic operators?

A

Arithmetic Operators take two values and perform a mathematical function on them.

e.g. 5 + 6.

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

What is exponentiation?

A

Exponentiation is used to raise a number to a power. In Python, the symbols ^ or ** are used.

e.g. 2 ** 3 = 2x2x2 = 8.

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

What does the Div operator do?

A

The Div operator returns the whole number part of a division. In Python, the symbol // is used.

e.g. 20 // 3 = 6.

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

What does the MOD operator do?

A

The MOD operator returns the remainder part of the division. In Python, the symbol % is used.

e.g. 20 % 3 = 2.

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

What is the Assignment Operator?

A

The Assignment Operator is used to allocate values to constants or variables.

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

What do Comparison Operators do?

A

Comparison Operators compare the expression on the left hand side with the expression on the right hand side and produce a Boolean value: True or False.

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

What is a Constant?

A

A Constant is assigned a data value that cannot be changed as the program runs.

Example: VAT = 0.2

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

What is a Variable?

A

A variable is a location in memory that holds one or more values. It has a label or name to identify it and its values can be changed as the program runs.

17
Q

What can you do with string manipulation commands?

A

You can use commands which give you information about the string or allow you to alter the string.

18
Q

What are IF Statements?

A

IF Statements allow you to check if a statement is True or False and carry out different actions based on the outcome.

Example: if age <= 16 then print(“Child”) else print(“Adult”)

19
Q

What are Switch Statements?

A

Switch statements (also known as Case Select Statements) can check if a variable has a specific value.

Example: print(“You selected 1”) print(“This is not a valid choice”)

20
Q

What is a COUNT CONTROLLED LOOP (FOR)?

A

For Loops will repeat the code in them a fixed number of times.

Example: For i = 1 to 7

21
Q

What is a CONDITION CONTROLLED LOOP (WHILE)?

A

While Loops are controlled by a condition at the start of the loop and will keep going while the condition is true.

Example: While total < 10

22
Q

What is a CONDITION CONTROLLED LOOP (DO)?

A

A DO … UNTIL Loop is controlled by a condition at the end of the loop and will keep going until the condition is true. This loop will always run at least once.

Example: Do num = input Until total >= 10

23
Q

What are the three Boolean operators?

A

AND, OR, NOT

These are used in selection and iteration statements.

24
Q

What is the purpose of random numbers in programming?

A

They are useful for simple games.

Example: X = random(1,6)

25
What is an array?
A data structure that can store a collection of data values under one name. ## Footnote Example: scores = [2, 5, 1, 3, 4, 7, 9]
26
What is a two-dimensional array?
It can be thought of as a one-dimensional array where each element is a one-dimensional array.
27
What is file handling in programming?
It is about how a program can access and change data stored in an external file.
28
What is a Record?
A Record is a type of data structure like an array - it is used to store a collection of data values. They can store values with different data types.
29
What does SQL stand for?
SQL stands for Structured Query Language.
30
What is the purpose of SQL?
SQL can be used to search database tables for specific data.
31
What is a Sub Program?
Sub Programs can be used to save time and simplify code. The Sub Program will usually carry out a specific task.
32
What are Procedures?
Procedures are sets of instructions stored under one name. When you want your program to carry out these instructions, you just call the name of the procedure.
33
What are Functions?
Functions are similar to procedures but Functions always return a value.