2.2 - programming fundamentals Flashcards

1
Q

What is a variable

A

Named memory address that holds a value. This can change as a program is running

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

What is declaring a variable

A

Identifying a variable before assigning it a value

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

What is assignment

A

Assigning a variable a value

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

What is a constant

A

Allows a name to be assigned a value. Cannot be changed whilst program is running

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

What is a global variable

A

Variable that can be accessed and changed throughout the program

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

What is a local variable

A

Variable confined to a loop or sub program

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

3 basic programming constructs

A

Sequence, selection, iteration

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

What is sequence

A

Order in which statements are executed

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

What is selection

A

The process of making a decision. This decides the path the program will take next. Works by testing a condition

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

Two types of iteration

A

Count-controlled, condition-controlled

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

What is iteration

A

When a program repeats itself until a certain condition is met or until told otherwise

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

What is count-controlled iteration

A

Repeatedly executed a section of code a fixed amount of predetermined times

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

What is condition-controlled iteration

A

Repeatedly executes a section of code until a condition is met

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

Two types of condition controlled iteration

A

While loops
Repeat loops

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

3 types of operators

A

Mathematical
Logical
Comparison

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

Mathematical operator for addition

A

+

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

Mathematical operator for subtraction

A

-

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

Mathematical operator for multiplication

A

*

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

Mathematical operator for division

A

/

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

Mathematical operator for remainder

A

MOD

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

Comparison operator for equals

A

= or ==

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

Comparison operator for greater than

23
Q

Comparison operator for greater than or equal to

24
Q

Comparison operator for less than

25
Comparison operator for less than or equal to
<=
26
Comparison operator for not equal to
=!
27
Logical operator for and
AND
28
Logical operator for or
OR
29
Logical operator for not
NOT
30
What is an integer
Whole number
31
What is a float
Decimal number
32
What is a character
Single alphanumeric character
33
What is a string
One or more alphanumeric characters
34
What is casting
Changing the data type
35
How is length of string determined
Using len statement len(name)
36
How can you extract letters from strings
surname[2] = third letter of surname surname[2,3] = 3 letters starting at 2nd surname[2:4] = 3rd, 4th letters
37
How to make something uppercase
.upper()
38
How to make something lowercase
.lower()
39
What is concatenation
Joining two strings together
40
What is a subprogram
Small programs in a larger program
41
2 types of sub programs
Procedure Function
42
What is a procedure
Subprogram that performs specific task, when task is complete, subprogram ends
43
What is a function
Same as a procedure but it manipulates data and returns it to main program
44
How to code count controlled iteration
For variable in range (0,6):
45
How to code condition controlled iteration
Whilst variable == condition:
46
What is an array
A data structure that holds similar, related data. An array is like a collection of boxes, each of which is called an element. Each element has a position in the array, and can hold a value. The data in an array must all be of the same data type.
47
What is an element
Piece of data in an array
48
What is a database
Persistent store of related data
49
How is data in a database stored
As records which in turn are stored in files
50
Language used by databases
Structured query language
51
How is data retrieved using sql
Data can be retrieved using the commands SELECT, FROM and WHERE, for example: SELECT * FROM "personnel" WHERE "Title" = "Mr"
52
* in sql
Wildcard which means all records
53
How is LIKE command used in sql
can be used to find matches for an incomplete word, for example: SELECT * FROM "personnel" WHERE "email address" LIKE "%com"
54
Use of Boolean operators in sql
AND and OR can also be used to retrieve data. SELECT * FROM "personnel" WHERE "Surname" = "Turing" OR "Hopper"