Fundamentals of Programming Flashcards

1
Q

Pseudocode

A

Used to write instructions in statements that are somewhere between English and a programming language.

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

Assignment Statements

A

= or 🡨

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

Common Arithmetic Operations

A

+, -, *, / , **

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

Output/Input Statements

A

OUTPUT “”
🡨 USERINPUT

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

Identifier

A

A name that points to a memory location.

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

Assignment

A

Assigning a value to the memory location to create a variable.

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

Integer

A

Whole number.

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

Decimal/Float

A

Decimal number.

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

String

A

A collection of characters - a word.

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

Character

A

A singular letter/symbol.

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

Boolean

A

True or False value.

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

Variable

A

The value can be changed while the program is running.

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

Constant

A

To change the value of a constant, you have to change it in the source code and then recompile. Cannot be the target of assignment. Reduce the risk of errors by reducing access to the memory location.

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

MOD

A

Finds the remainder in integer division.

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

DIV

A

Returns the integer part of the division.

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

.len

A

Returns the length of string.

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

.find(“”)

A

Determines if “” occurs in the string.

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

Relational Operators

A

> greater than
< less than
=> greater than or equal to
=< less than or equal to
= equal to (== in Python)
<> not equal to (!= in Python)

19
Q

IF…THEN…ELSE Statements

A

Control program
flow. Relational operators can be used to compare values within the
expression.

20
Q

Complex Boolean Expressions

A

Boolean expressions can include AND, OR and NOT.

21
Q

ELSE IF

A

Can be used to evaluate multiple expressions.

22
Q

CASE

A

Can be used to evaluate multiple expressions.

23
Q

Iteration

A

Repetition. A sequence of instructions is repeated multiple times. This is much more efficient than writing the instructions multiple times. The number of repetitions needed may vary.

24
Q

WHILE…ENDWHILE Loop

A

The condition is tested upon entry to the loop. It is possible that the instructions inside the loop might not be executed at all if the entry condition is not met.

25
Q

Infinite Loops

A

Infinite loops are often used in 2D games
An “outer” WHILE True… ENDWHILE loop runs the game.

26
Q

FOR…NEXT Loop

A

“Definite iteration”. Is used to repeat a block of instructions a specified number of times. The FOR loop uses a counter variable which is automatically incremented each time through the loop. Optionally, a STEP value can be specified to make the counter increase or decrease by any integer.

27
Q

Nested FOR Loop

A

These are particularly useful for looping through grids in two-dimensional arrays.

28
Q

3 Types of Iteration

A

Indefinite iteration with the condition tested at the start of the loop.
Indefinite iteration with the condition tested at the end of the loop. (Not supported in Python)
Definite iteration where the loop is performed a given number of times.

29
Q

Data Structures

A

Built-in structured data types such as arrays and records.

30
Q

Array

A

Built-in data structure. Items are referred to by an index using square brackets. The array is a set of elements with the same data type.

31
Q

2D Array

A

It is also possible to have two-dimensional arrays, just use two index positions.

32
Q

Multi-Dimensional Arrays

A

It is possible to define arrays with any number of dimensions.

33
Q

Subroutine

A

A set of instructions with a name. Program execution starts at the first statement in the main program. Program flow will “jump” to the subroutine when called
When the subroutine has finished, the program will continue from where it was called. Procedures and functions are types of subroutine.

34
Q

Function

A

A subroutine that returns one or more values. In some programming languages all subroutines are referred to as functions even if no value is returned.

35
Q

Library Subroutines

A

Programming languages also come complete with libraries of pre-defined subroutines. The module library has to be imported at the start of the program - like Random in Python.

36
Q

Parameters

A

Parameters in parentheses are used to pass data to a subroutine. The order of the parameters in parentheses is important. Parameters appear in subroutine definitions.

37
Q

Arguements

A

Arguments appear in subroutine calls. The arguments may vary from call to call, but the parameters are part of the subroutine definition.

38
Q

Functions returning a Value

A

A function can return one or more values using a RETURN statement.

39
Q

Variable Scope

A

When a variable is in scope the values can be accessed. The scope of a local variable is the subroutine in which it is declared. The variable does not exist outside the subroutine.

40
Q

Local Variables

A

A subroutine may have its own variables, these are known as local variables. When you use a name on the left-hand side of an assignment statement in a subroutine, a local variable is automatically created. A local variable can be used only in that subroutine.

41
Q

Global Variables

A

A global variable is defined in the main program and can be used in any subroutine called from the main program.

42
Q

Advantages of Local Variables

A

The subroutines will be independent of a particular program and can be re-used in different programs. There is no chance of accidentally changing a variable in the main program that is used in a subroutine or vice versa. Keep your subroutines self-contained! Pass as arguments any values that are needed.

43
Q

Modular Programming

A

Modular programming means breaking down a major task into smaller subtasks. These subtasks may be further broken down until each ‘module’ performs a single function.

44
Q

Advantages of Modular Programming

A

Programs are more easily and quickly written.
Large programs are broken down into subtasks that are easier to program and manage. Each module can be individually tested.
Modules can be re-used several times in a program. Large programs are much easier to debug and maintain.