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

A

>

23
Q

Comparison operator for greater than or equal to

A

> =

24
Q

Comparison operator for less than

A

<

25
Q

Comparison operator for less than or equal to

A

<=

26
Q

Comparison operator for not equal to

A

=!

27
Q

Logical operator for and

A

AND

28
Q

Logical operator for or

A

OR

29
Q

Logical operator for not

A

NOT

30
Q

What is an integer

A

Whole number

31
Q

What is a float

A

Decimal number

32
Q

What is a character

A

Single alphanumeric character

33
Q

What is a string

A

One or more alphanumeric characters

34
Q

What is casting

A

Changing the data type

35
Q

How is length of string determined

A

Using len statement
len(name)

36
Q

How can you extract letters from strings

A

surname[2] = third letter of surname
surname[2,3] = 3 letters starting at 2nd
surname[2:4] = 3rd, 4th letters

37
Q

How to make something uppercase

A

.upper()

38
Q

How to make something lowercase

A

.lower()

39
Q

What is concatenation

A

Joining two strings together

40
Q

What is a subprogram

A

Small programs in a larger program

41
Q

2 types of sub programs

A

Procedure
Function

42
Q

What is a procedure

A

Subprogram that performs specific task, when task is complete, subprogram ends

43
Q

What is a function

A

Same as a procedure but it manipulates data and returns it to main program

44
Q

How to code count controlled iteration

A

For variable in range (0,6):

45
Q

How to code condition controlled iteration

A

Whilst variable == condition:

46
Q

What is an array

A

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
Q

What is an element

A

Piece of data in an array

48
Q

What is a database

A

Persistent store of related data

49
Q

How is data in a database stored

A

As records which in turn are stored in files

50
Q

Language used by databases

A

Structured query language

51
Q

How is data retrieved using sql

A

Data can be retrieved using the
commands
SELECT, FROM and WHERE, for example:
SELECT * FROM “personnel” WHERE “Title” = “Mr”

52
Q
  • in sql
A

Wildcard which means all records

53
Q

How is LIKE command used in sql

A

can be used to find matches for an incomplete word, for example:
SELECT * FROM “personnel” WHERE “email address” LIKE “%com”

54
Q

Use of Boolean operators in sql

A

AND and OR can also be used to retrieve data.
SELECT * FROM “personnel” WHERE “Surname” = “Turing” OR “Hopper”