Problem solving and programming 2.2 Flashcards

1
Q

Name the three programming constructs

A
  1. Sequence
  2. Selection
  3. Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is sequence?

A

Sequence is the order in which instructions occur and are proccessed

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

What does selection do?

A

Selection determines which path the program takes

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

What is iteration?

A

iteration is the repeated excecution of a section of code when a program is running

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

Which two categories of loop are iteration split up into?

A
  1. Count controlled(for loop)
  2. Condition controlled(while loop)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is recursion?

A

Where a subroutine call itself during excecution until the stopping condtion is met

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

State two advantages of recusion

A
  1. Can be represented in fewer lines of code
    2.Easier to express some functions recursively than using iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

State two disadvatages of recursion

A
  1. Inefficent use of memory
    2.Difficult to trace
  2. Danger of stack overflow
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define scope

A

The section of the program in which a variable is accessible

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

Give two advantages of using local variables over global variables

A
  1. Less memory is used
    2.Take priority over global variables with the same name
  2. uneffected by code outside of the subroutine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the difference between a procedure and a function?

A

Functions must always return a single value, while procedures do not always need to return a value

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

What does it mean to pass in a parameter (to a subroutine) by reference?

A

The address in memory of the parameter is passed to the subroutine so the value outside the subroutine will be updated

The value in the parameter is changed

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

What does it mean to pass in a parameter (to a subroutine) by value?

A

The value stored inside memory location is passed into the function

The variable outside the function does not change

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

What are IDE’s?

A

Integrated development environment is a software application that provides a comprehensive set of tools. They are useful tools for software developers

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

What does IDE stand for?

A

Integrated Development enviornment

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

State two features of IDEs

A
  1. Debuggin tools
  2. Source code editior
  3. Breakpoint
  4. Variable watch
17
Q

What is encapsulations in OOP?

A

When attributes and methods are declared as private so they can only be accessed by setters and getters

18
Q

What is the purpose of encapsulation in OOP?

A

Program complexity is reduced by protecting data from being accidentally editied from other parts of the program

19
Q

What is Inheritance in OOP?

A

Inheritance is when a child class inherits its methods and attributes from the parent class

20
Q

What is polymorphism?

A

When two mehods in two different classes share the same name and purpose

21
Q

What is it meant by a computable problem?

A

A problem that can be solved using an algorithm

22
Q

Give three limiting factors of computable problems

A
  1. Time
  2. Proccessing power
  3. Processor speed
  4. Computer memory
23
Q

Describe how divide and conquer techniques work

A

The problem size is halfed with each iteration. Each individual subroutine is solved recursively. Then they are recombined

24
Q

Give two applications of divide and conquer

A
  1. Quick sort
  2. Merge sort
  3. Binary search
25
Q

State 4 problem solving techniques

A
  1. Abstraction
  2. pipelining
  3. Divide and Conquer
  4. Data Mining
  5. Backtracking
  6. Visualisation
  7. Decomposition
26
Q

Describe how backtracking work

A

It works by visiting each path and building a solution based on the paths found to be correct. if a path is invalid, it backtracks to the previous stage and visits an alternative path

Backtracking is useful in computer science because it allows you to efficiently find a solution to a problem by exploring all possible options and discarding those that are not valid.

27
Q

When may heuristics be used in problem solving

A

when the standard way is time and resource consuming

28
Q

State two advantages of using performace modelling

A
  1. Safe
  2. less time consuiming
  3. inexpensive
29
Q

What is performace modelling?

A

The process of evaluating if a system or a program works as expected, before it is released.

30
Q

What is pipelining

A

Pipelining is the process of completing the fetch, decode, and execute cycles of three separate instructions simultaneously

31
Q

What is Data mining?

A

The process of finding meaningful patterns and valuable information within large data sets.

32
Q

What is a class in OOP?

A

A class is a blueprint for creating objects

33
Q

What is a method in OOP?

A

Methods define the behaviour and functionality of objects in the class

34
Q

What is an attribute in OOP?

A

Attibutes define the characteristics of objects in a class

35
Q

What is a constructer?

A

A special method that is called when an object is created from a class. It is used to initalize the objects attributes

36
Q

What are IDE’s?

A

IDE’s is a software application that provides a comprehensive set of tools. They are useful tools for software developers