flashcards

1
Q

why a queue is used instead of a stack

A
  • queues are first in first out
  • so that the data will be stored in the order they arrive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

why is dequeue() a function and not a procedure

A

because it returns a value

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

what does best time O(n) complexity mean

A
  • processing time is linear
  • directionally proportional to the size of the list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what does average and worst tine O(n²) complexity mean

A
  • processing time is proportional to the square of the number of items in the list
  • quadratic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does worst space O(1) conplexity mean

A

constant amount of memories used

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

which direction is breadth and depth in a binary tree

A
  • breadth = horizontal
  • depth = vertical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

backtracking in a binary tree

A

when the value is found, the algorithm backtracks following the previous nodes

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

explain the difference between branching and iteration

A
  • branching chooses which code is run next
  • iteration loops through the same code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

what does MOD do

A

returns the remainder

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

what is one benefit and one drawback of using iteration instead or recursion

A
  • benefit = can’t run out of memory
  • drawback = code is longer, therefore mode difficult to understand
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

explain how decomposition can aid the design of a program

A
  • breaking down code into subroutines
  • in order to make it a more manageable problem which is easier to understand
  • can tackle each sub problem independently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

define pipelining

A

the result of one process leads to another

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

name 4 features of an IDE and what they do

A
  • syntax highlighting = the IDE can make the text bold, highlighted, coloured etc to highlight accidental syntax errors
  • debugging = runs through code and fixes any errors or bugs
  • testing = allowes developers to run code locally (without exiting software) before it is implemented in other developers’ code
  • variable watch widow = allows a developer to monitor the value of a variable during execution (during debugging)

other marks
* reduce spelling errors
* fewer mistakes
* user friendly for novices
* increase speed of testing/finding errors

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

different examples of how abstraction simplifies visuals

A
  • no actual images shown
  • items are names/labeled
  • simplified layouts with shapes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

explain the need for abstraction in the production of a visual

A
  • reduces complexity of design,
    • programming
  • reduce memory/processing requirements
  • could involve a large number of images which take up excessive memory
  • reality contains things that aren’t related to a computer program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is meant by problem recognition and decomposition

A
  • recognition = identifying what the problem is(scope)
  • decomposition = breaking down problem into smaller parts (subroutines)
17
Q

define the term ‘data mining’

A

searching through data to find trends, specific information

18
Q

identify 3 pieces of information that data mining could provide a company about sales and how the company could make use of it

A
  • identifying customer trends
    • to identify items to sell/offers to send customers
  • identify which stores are making the most profit
    • to identify what other stores in the area are doing well
  • which items are not selling well
    • to replace them with other items
19
Q

define ‘performance modelling’ and one way it can be used to test a system

A
  • test the behavious of the system before it is used
  • testing it with a large number of customers/items/orders
20
Q

one benefit of creating reusable program components

A
  • components can be used in a future program
  • do not need to be rewritten/saves time
21
Q

differences between a graph and a tree

A
  • a graph has cycles
  • tree has a hierarchy
  • graphs an be directed/undirected
22
Q

2 advantages of how using visualisations

A
  • visualisations benefit humans rather than computers
  • present information in a simpler form to understand
  • visualisations can best explain complex situations
23
Q

explain why a recursive algorithms use more memory than iterative algorithm (2)

A
  • each recursive call creates new variables
  • iteration reuses the same variables
24
Q

describe how a 1D array can be set up and used to push and pop items as a stack

A
  • define the size of the array
  • use a pointer to point to the top of the stack
  • when an item is pushed the pointer is increased by one
  • when an item is popped the poiner decreases by one
25
explain the similarities and differences between a record structure and a class
* both store data of different types * both can have multiple instances * record is a data structure * a class is a template for making data strutures(objects) * class can include visibility of properties / private
26
define 'queue' (2)
* data stucture * that is FIFO
27
define 'stack' (2)
* data structure * that is FILO
28
how does a private attribute improve the integrity of data (3)
* properties are encapsulated and can only be accessed through their mehods * cannot be changed/accessed accidentally * innapropriate data can be caught before entered
29
how could someone amend a program to make sure the items and queue sill exist and are used the next time the program is run (2)
* store the items and queue to an external file when the program closes * load the items and queue from the program when it starts
30
what is a global variable
a variable that is declared in the main program, outside of any subroutines and can be used anywhere in the program
31
what is object oriented programming
a programming paradigm where the system is viewed as a set of objects each with their own data (attributes) and procedured (methods) that can interact with each other.
32
what is a procedure
* a subroutine that is called by simply writing its name in the code * procedures do not have a return a value in the program
33
define recursion
a programming subroutine where a section of code calls itself
34
what are heuristics
a ‘rule of thumb’ algorithm which can produce a sub-optimal solution for a difficult problem as an approximation
35
what is branching
using IF statements
36
describe iteration
* count-controlled code = block of code executed a certain number of times * condition-controlled code = block of code is executed while a condition is met * e.g. for i in range loops * iteration uses FOR, WHILE, REPEAT UNTIL loops.
37
what do push(), pop() and peek() do in stacks
* push = adds an item into the stack * pop = removes the most recently added item into the stack * peek = without modifying the stack, return the value of the last element added
38
what is a sequence
code is executed line-by-line, from top to bottom
39
2 advantages and 2 disadvantages of recursion;’;
*advantages* * can be represented in fewer lines of code * easier to express some functions recursively e.g. factorial *disadvantages* * risk of stack overflow if memory runs out * difficult to trace