2.2 Programming fundamentals

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/73

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:45 AM on 4/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

74 Terms

1
New cards

Variable Declaration

Creates a variable to store data.

2
New cards

Constant Declaration

A value that does not change while the program runs. Often given fully uppercase identifiers.

3
New cards

Assignment

Setting or updating a value in a variable.

4
New cards

Input

Receiving data from the user.

5
New cards

Output

Displaying data or information to the user.

6
New cards

Sequence

Instructions executed in order.

7
New cards

Selection

Decisions (IF, ELSE).

8
New cards

Iteration

Repetition (WHILE, FOR).

9
New cards

Arithmetic Operations

The basic mathematical calculations that can be performed in a programming language.

10
New cards

Addition

Operation symbol: +, Example: 3 + 2, Result: 5.

11
New cards

Subtraction

Operation symbol: -, Example: 7 - 4, Result: 3.

12
New cards

Multiplication

Operation symbol: *, Example: 5 * 3, Result: 15.

13
New cards

Real Division

Operation symbol: /, Example: 10 / 4, Result: 2.5.

14
New cards

What does the modulus operation (MOD) find?

The remainder when one number is divided by another number.

15
New cards

What is the operation symbol for modulus?

%

16
New cards

What is the result of the operation 5 % 2?

1

17
New cards

What is the definition of a quotient?

The number we obtain when we divide one number by another.

18
New cards

What is the operation symbol for division in programming?

//

19
New cards

What is the result of the operation 8 // 3?

2

20
New cards

Exponentiation

Operation symbol: ^, Example: 4^2, Result: 16.

21
New cards

Comparison Operations

Used to compare different items of data, returning True or False.

22
New cards

Equal to

Operation symbol: ==, Example: 5 == 5, Result: True.

23
New cards

Not equal to

Operation symbol: !=, Example: 3 != 4, Result: True.

24
New cards

Less than

Operation symbol: <, Example: 2 < 5, Result: True.

25
New cards

Greater than

Operation symbol: >, Example: 6 > 7, Result: False.

26
New cards

Less than or equal to

Operation symbol: <=, Example: 5 <= 5, Result: True.

27
New cards

Greater than or equal to

Operation symbol: >=, Example: 7 >= 10, Result: False.

28
New cards

Boolean Operations

Logical operators that work with Boolean values (True or False).

29
New cards

NOT

Reverses the Boolean value.

30
New cards

AND

Returns True if both input conditions are true.

31
New cards

OR

Returns True if either input condition is true.

32
New cards

Data Types

Defines the kind of data a variable or constant can hold.

33
New cards

Integer (int)

Whole numbers only, no decimals.

34
New cards

Real (float)

Numbers that include a fractional/decimal part.

35
New cards

Boolean (bool)

Often used for conditions and logic, can be True or False.

36
New cards

Character (char)

A single symbol or letter, must be enclosed in quotation marks.

37
New cards

String (str)

A sequence of characters.

38
New cards

Integer

A data type representing whole numbers.

39
New cards

String

A data type representing a sequence of characters.

40
New cards

Casting

Changing data types of a variable, for example from integer to string.

41
New cards

String Manipulation

Refers to measuring the length of strings, concatenating strings or slicing strings.

42
New cards

Length

Returns the number of characters in a string.

43
New cards

subString

Extracts a sequence of characters within a string.

44
New cards

Concatenation

Joins strings together.

45
New cards

File Handling

Refers to the reading or writing to or from an external file.

46
New cards

Read Mode

A mode in which a file is opened for reading.

47
New cards

Write Mode

A mode in which a file is opened for writing.

48
New cards

Data Structure

A way of organising and storing related data so it can be used efficiently in a program.

49
New cards

Record

A data structure used to group different types of data under one structure.

50
New cards

Array

A fixed-size data structure with a collection of similar data items stored under a single name.

51
New cards

One-Dimensional Array (1D)

A single list of items.

52
New cards

Two-Dimensional Array (2D)

An array of arrays, like a database table or grid.

53
New cards

Database

Used to store large amounts of data into organised tables.

54
New cards

Structured Query Language (SQL)

A language used to search for, manage, and manipulate data in a database.

55
New cards

SELECT

An SQL command used to specify the data to be retrieved.

56
New cards

FROM

An SQL command used to specify the table from which to retrieve data.

57
New cards

WHERE

An SQL command used to specify conditions for data retrieval.

58
New cards

SELECT command

Used to retrieve information about a particular field in a database.

59
New cards

FROM command

Refers to the database being searched.

60
New cards

WHERE command

Used to apply conditions to a search.

61
New cards

SQL command structure

Takes the form: SELECT FROM WHERE .

62
New cards

Wildcard * in SQL

Used to represent all fields in the SELECT command.

63
New cards

Subprogram

A section of code which performs a specific task, and can be called whenever it is needed.

64
New cards

Functions

A type of subprogram that performs a task and returns a value.

65
New cards

Procedures

A type of subprogram that performs a task and does not return a value.

66
New cards

Parameters

Values which can be passed into a subprogram when it is called.

67
New cards

Local variables

Defined inside of a subprogram and can only be used inside of that subprogram.

68
New cards

Global variables

Defined in the main program and can be used anywhere, including all subprograms.

69
New cards

Why use Subprograms?

They make code more structured and modular, allow code to be reused, make programs easier to test and maintain, and allow shared workload.

70
New cards

Random Number Generation

The ability to produce unpredictable numeric values within a specified range.

71
New cards

RANDOM_INT function

Used to generate a random integer within a specified range.

72
New cards

random.randint function in Python

Generates a random integer within a specified range, inclusive of the endpoints.

73
New cards

Typical Uses of Random Number Generation

Rolling a die, picking a random question or card, generating test values for simulations, and randomly deciding outcomes in games.

74
New cards

Good Practice for Random Number Generation

Store the random value in a variable if it will be used more than once.