programming fundamentals Flashcards

(38 cards)

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

==

17
Q

!=

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
real/float
decimal number e.g 4.5
26
boolean
an answer that only has two values
27
casting
converting the value of a variable from one data type to another
28
array
a static data structure that can hold a fixed number of data elements (same data type)
29
what is the index of the first element in an array
0
30
traversing an array
scooby = ["velma", "daphne", "fred"] for name in scooby: print(name)
31
inserting a value
array is fixed but you can change the value of elements that already exist by overwriting e.g scooby[0] = "shaggy"
32
deleting a value
can't actually but can overwrite them as blank instead
33
searching an array
for name in scooby: if name == "fred" print(name) outputs freds name
34
2D array
- table - same data types - row first then column - e.g scooby = [["scooby", "brown"], ["shaggy", "green"]] print(scooby[1][0]) output = shaggy
35
searching 2d array
for row in scooby: for name in row: if name == "scooby": print(row) output = scooby, brown
36
records
- 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
key field
- unique data that identifies each record - field (each row name)
38