programming fundamentals Flashcards

1
Q

sequence

A

structuring code into a logical, sequential order

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

selection

A

decision making using if statements

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

iteration

A

repeating code using for or while loops

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

what do the three constructs of programming do

A

control the flow of a program

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

variable

A
  • a location in the memory that is used to store data in programs
  • they can be changed as the program runs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what are the two parts of the variable

A

data value and identifier

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

local variables

A

variables that are declared within a specific subroutine and can only be used within that subroutine

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

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
9
Q

local variable advantages

A
  • saves memory (only uses memory when needed)
  • easier to debug (as can only be changed within the subroutine)
  • can reuse subroutine with lv in other programs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

global variable advantages

A
  • can be used anywhere
  • makes maintenance easier as they are only declared once
  • can be used for constants
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

constants

A

a location in the memory that stores data and does not change value as the program is run e.g pi

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

>

A

greater than

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

<

A

less than

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

> =

A

greater than or equal to

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

<=

A

less than or equal to

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

==

A

equal to

17
Q

!=

A

not equal to

18
Q

arithmetic operators

A
  • add(+)
  • subtract(-)
  • multiply(*)
  • divide(/)
  • exponentiation(^)(**)
19
Q

modulo division/modulus

A
  • MOD(%)
  • outputs remainder from the last whole number
20
Q

integer division/quotient

A
  • DIV(//)
  • outputs whole number
21
Q

logical operators

A
  • true or false
  • and or not
22
Q

character

A

a data type e.g letter, number, punctuation symbol

23
Q

string

A

a sequence of characters e.g hello

24
Q

integer

A

whole number e.g 4

25
Q

real/float

A

decimal number e.g 4.5

26
Q

boolean

A

an answer that only has two values

27
Q

casting

A

converting the value of a variable from one data type to another

28
Q

array

A

a static data structure that can hold a fixed number of data elements (same data type)

29
Q

what is the index of the first element in an array

A

0

30
Q

traversing an array

A

scooby = [“velma”, “daphne”, “fred”]
for name in scooby:
print(name)

31
Q

inserting a value

A

array is fixed but you can change the value of elements that already exist by overwriting
e.g scooby[0] = “shaggy”

32
Q

deleting a value

A

can’t actually but can overwrite them as blank instead

33
Q

searching an array

A

for name in scooby:
if name == “fred”
print(name)

outputs freds name

34
Q

2D array

A
  • table
  • same data types
  • row first then column
  • e.g scooby = [[“scooby”, “brown”],
    [“shaggy”, “green”]]
    print(scooby[1][0])
    output = shaggy
35
Q

searching 2d array

A

for row in scooby:
for name in row:
if name == “scooby”:
print(row)

output = scooby, brown

36
Q

records

A
  • can store data of different data types
  • made up of information about one person or thing
  • each piece of info in the record is called a field
37
Q

key field

A
  • unique data that identifies each record
  • field (each row name)
38
Q
A