2.2.1 Programming Techniques Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Sequence

A

Executing instructions one after another

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

Selection (branching)

A
  • IF statement
  • A construct that allows a program to change direction depending on the outcome of a condition
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Iteration

A

Enables us to repeat sections of code

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

When is a FOR loop (count-controlled loop) used?

A

When the required number of iterations is known ahead of the execution

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

When is a WHILE loop (condition-controlled loop) used?

A

When the required number of iterations is unknown as the variable used to determine when the iteration ends is changing within the iteration itself

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

Nest structure

A

Programming constructs inside one another

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

Recursion

A

When a subroutine calls itself from within another subroutine

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

What 3 characteristics should a recursion subroutine have?

A
  • Contains a stopping condition (base case)
  • For an input value other than the base case, the subroutine should call itself
  • The stopping condition should be reachable within a finite number of times
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Without the 3 characteristics, what would the recursion subroutine result in?

A

A stack overflow

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

Variable

A

Used to store information to be referenced and manipulated in a computer program

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

Local variable (4)

A
  • Declared inside a subroutine
  • Only accessible by that subroutine
  • Created when the subroutine is called
  • Destroyed when the subroutine ends
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Global variable (4)

A
  • Declared at the top of a program, outside of any subroutine
  • Accessible throughout the program
  • Created when the program starts
  • Destroyed when the program ends
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Scope of a variable

A
  • Refers to where the variable can be accessible in the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Procedure

A
  • Block of code that takes in zero, one or more parameters and performs a set task
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Function

A
  • Block of code that takes in zero, one or more parameters and performs a set task
  • RETURNS A VALUE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Modularity

A

Concept of breaking a large program into smaller chunks
- Each module carries out a single, specific task

17
Q

Integrated Development Environments

A
  • Program that provides a set of tools and related functionality designed to maximise a programmer’s productivity
18
Q

Common features of IDEs

A
  • Auto-documentation
  • Syntax highlighting
  • Error diagnostics
  • Code editors
  • Translators
19
Q

Code editor

A

A text area for programmers to enter code directly into the IDE; often supports features e.g. syntax highlighting, automatic indentation

20
Q

Error diagnostics

A

Reports errors in the code and where they can be found

21
Q

Translators

A

Program that converts high level code into machine code

22
Q
A