2.2 Flashcards

(33 cards)

1
Q

What is a variable declaration?

A

A statement that creates a variable to store data. Example: score = 0.

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

What is a constant declaration?

A

A named value that does not change while the program runs. Example: PI = 3.14.

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

What is assignment in programming?

A

Giving a value to a variable, or updating it. Example: total = total + 1.

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

What are the three programming constructs?

A

Sequence, selection, and iteration.

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

What is meant by ‘selection’?

A

Decision making, such as IF ELSE statements.

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

What is meant by ‘iteration’?

A

Repetition or loops, such as FOR and WHILE loops.

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

What are arithmetic operations?

A

Mathematical calculations, such as addition, subtraction, multiplication, and division.

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

What does modulus return?

A

Modulus returns the remainder of a division. Example: 9 MOD 5 = 4.

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

What does quotient return?

A

Quotient returns the largest integer from a division. Example: 11 DIV 5 = 2.

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

What are comparison operators?

A

Comparison operators compare items of data, and either return True or False.

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

What does the symbol != represent?

A

Not equal to.

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

What are the three Boolean operators?

A

NOT, AND, OR.

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

What are data types?

A

A data type defines the kind of data a variable or constant holds.

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

What are the 5 main data types?

A

Integer (int), Real (float), Boolean (bool), Character (char), and String (str).

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

Why are data types important?

A

They help the computer understand how to store and manipulate data, and allow you to perform the correct operations on data.

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

What does length() do?

A

Returns the number of characters in a string.

17
Q

What does subString(x, y) do?

A

Extracts a sequence of characters from a string: returns y characters, starting from the xth position in the string.

18
Q

What is string concatenation?

A

The joining together of two strings using the + operator, e.g. “Hi” + “ there” = “Hi there”.

19
Q

What two things can you do to a file?

A

Read to and write from it.

20
Q

What must you always do once you are done reading / writing a file?

A

Close the file.

21
Q

What is a record?

A

A record is a data structure which groups different types of data together, and is similar to a row in a database.

22
Q

What is an array?

A

An array is a fixed-size data structure that only contains items of the same data type.

23
Q

What is a 2D array?

A

An array of arrays, similar to a database table or a grid.

24
Q

What are the three main SQL commands?

A

SELECT, FROM, WHERE.

25
What is the purpose of the 'WHERE' command?
To apply conditions when searching.
26
What is a subprogram?
A subprogram is a section of code which performs a specific task, and can be called in the main program to perform that task.
27
What is a function?
A function is a type of subprogram which returns a value.
28
What is a procedure?
A procedure is a type of subprogram which does not return a value.
29
What are parameters?
Values which can be passed into a subprogram.
30
What is a local variable?
Local variables are defined inside a subprogram, and can only be used inside that subprogram.
31
What is a global variable?
Global variables are defined in the main program and can be used anywhere.
32
What is random number generation?
The ability to produce unpredictable numeric values within a specified range.
33
What are uses of random number generation?
Uses may include rolling dice, generating test values for simulation or for testing and security in passwords.