2.2 - Programming Fundamentals Flashcards

1
Q

What are the main constructs?

A
  • Sequence
  • Selection
  • Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a variable?

A

Data that can change in value as a program is being run

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

What are local variables?

A

Declared within a specific subroutine
—> Can be only used within that subroutine

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

What are global variables?

A

Can be used at any point within the whole program

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

What are some advantages of local variables?

A
  • Saves memory
  • Easier to debug local variables
  • You can reuse subroutines with local variables
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do local variables save memory?

A

Only uses memory when that local variable is needed
—> Global variables use memory whether they are used or not

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

How are local variables easier to debug?

A

As they can only be changed within one subroutine.

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

What are some advantages of global variables?

A
  • Makes maintenance easier
  • Can be used anywhere in the whole program
  • Can be used for constants
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do global variables make maintenance easier?

A

As they are only declared once

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

What does modular mean?

A

Split into subroutines with each subroutine having a dedicated purpose

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

What is a constant?

A

Data that does not change in value as the program is run

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

What are comparison operators used for?

A

Compare two data values

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

What is the function of arithmetic operators?

A

Used to mathematically manipulate values

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

What is modulus?

A

Reveals the remainder from the last whole number

e.g.
9 % 4 = 1 (4 goes into 9 twice (8) with a remainder of 1)

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

What is the symbol for modulus?

A

%

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

What is integer division?

A

Reveals the ‘whole number of times’ a number can be divided into another number

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

What is integer division also known as?

18
Q

What are logical operators?

A

Typically use Boolean or AND, OR, NOT

19
Q

What are the different data types?

A
  • Character
  • String
  • Float
  • Boolean
20
Q

What is a float also known as?

21
Q

What is a string?

A

A sequence of characters
—> Including letter, numbers & punctation

22
Q

What is a character?

A

A single character (e.g. letter, number or punctuation symbol)

23
Q

What is casting?

A

Converting the value of one variable from one data type into another

24
Q

Give some examples of some python commands used for casting?

A
  • str()
  • float()
  • int()
25
What is an **array**?
A static data structure that can hold a fixed number of data elements
26
What does **traverse** mean?
Move through
27
How would you **traverse an array**?
A for loop can be used to display each data element in order
28
How would you **insert a value** in an **array**?
You can change the value of elements that already exist by overwriting it ---> The size of the array is fixed so you can't insert new values
29
How would you **delete a value** in an **array**?
You can 'delete' an elements by overwriting it as blank by using ""
30
How would you **search** an **array**?
31
How might a **two dimensional array** look like in **python**?
32
How is **each value** in an **array represented**?
By indexes
33
How would you **search** a **two-dimensional array**?
You will need two for loops - one for the row and the other for the values of each row
34
How would you *print* a **value** from a **two dimensional array**?
Row index then column index
35
What is **each row name** in a **record** called?
Field
36
What is a **key field**?
A unique data that identifies each record
37
How might a **record** look like?
38
What is **SQL**?
A language that can be used to search for data in a database
39
What does the **symbol * ** represent in **SQL**?
All fields
40
What are **wildcards** in **SQL**?
Symbols used to substitute characters
41
What is the **format** of an **SQL statement**?