cs paper 1 - past paper questions Flashcards

(25 cards)

1
Q

Recursive Subroutine?

A

a subroutine that calls itself

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

Heuristic Technique?

A

employs a method of finding a solution that might not be best ( an estimate for an intractable problem)

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

difference between static and dynamic data structures?

A
  1. Static storage size can be determined before program is run / dynamic can grow and shrink during execution.
  2. Static can waste storage space / dynamic only takes up amount of storage space needed for data
  3. Dynamic requires pointers to next item / static does not need pointers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why RPN used

A

-simpler for machine to evaluate
- Do not need brackets to show correct order of evaluation

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

Components of Stack frame

A

local variables, return address

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

why use adjacency list?

A

-when there’s fewer edges between vertices
-when edges rarely change

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

why use adjacency metric

A
  • Many edges between vertices
  • Edges frequently change
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Halting Problem

A
  • determining if a program will halt
  • without running the program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Why can a TM not be used to solve halting problem

A
  • it is non-computable
    -TM can only solve computable problems
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

components of TM

A

-finite set of states
- read-write head
-set of transition rules

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

The Universal TM

A
  • computes any computable sequence
  • Instructions for TM stores on tape
  • acts as an interpreter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why is Universal TM powerful?

A
  • infinite amount of memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

how to ‘solve’ an intractable problem

A
  • use of heuristic algorithm
  • makes an estimate based on experience
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

representational abstraction?

A
  • remove unnecessary details
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

abstraction by generalisation

A
  • grouping by common characteristics
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

intractable problem

A
  • problem can be solved
  • but in exponential time complexity or worse
17
Q

dynamic data structures +/- compared to static

A

+no wasted memory
+ resources only allocated if needed
- additional memory needed for pointers
- can result in memory leak

18
Q

Binary tree

A
  • rooted tree
  • where each node has at most 2 child nodes
19
Q

Base case for recursive subroutines

A
  • circumstances when recursive subroutine does not call itself
20
Q

procedural decomposition

A

-breaking problem into smaller sub-problems
-each solves an identifiable task
- each of which might be further subdivided

21
Q

steps to add record in hash table

A
  • Hash algorithm applied
  • to key value
  • result is location in table where record should be stored
  • if location not empty
  • use next free location
22
Q

tractable problem

A
  • polynomial or better time complexity
23
Q

Constant time complexity

A
  • as size of input increases, amount of time taken remains the same
24
Q

Cardinality

A
  • number of elements in a set
25