2.2 - Programming Fundamentals Flashcards

You may prefer our related Brainscape-certified 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?

A

Quotient

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?

A

Real

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
Q

What is an array?

A

A static data structure that can hold a fixed number of data elements

26
Q

What does traverse mean?

A

Move through

27
Q

How would you traverse an array?

A

A for loop can be used to display each data element in order

28
Q

How would you insert a value in an array?

A

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
Q

How would you delete a value in an array?

A

You can ‘delete’ an elements by overwriting it as blank by using “”

30
Q

How would you search an array?

A
31
Q

How might a two dimensional array look like in python?

A
32
Q

How is each value in an array represented?

A

By indexes

33
Q

How would you search a two-dimensional array?

A

You will need two for loops - one for the row and the other for the values of each row

34
Q

How would you print a value from a two dimensional array?

A

Row index then column index

35
Q

What is each row name in a record called?

A

Field

36
Q

What is a key field?

A

A unique data that identifies each record

37
Q

How might a record look like?

A
38
Q

What is SQL?

A

A language that can be used to search for data in a database

39
Q

What does the **symbol * ** represent in SQL?

A

All fields

40
Q

What are wildcards in SQL?

A

Symbols used to substitute characters

41
Q

What is the format of an SQL statement?

A