2.2.1 Programming Techniques Flashcards

1
Q

What are the primary programming constructs?

A

Sequence

Iteration

Branching/Selection

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

What are examples of count-controlled and condition-controlled loops?

A

Count: For loop

Condition: While loop

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

Define ‘recursion’

A

A function calling itself until a condition is met

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

What are the benefits and drawbacks of recursion?

A

Benefits:

Can be used to traverse trees

Drawbacks:

Requires more storage space than an iterative solution

A missing condition will lead to a stack overflow

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

Define ‘global variable’

A
  • A variable accessible anywhere within a program
  • Allocated a distinct memory location during execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define ‘local variable’

A
  • A variable only accessible within a specific part of a program
  • Usually defined within a function or passed by value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define ‘scope’

A

Refers to where a variable/constant can be accessed.

The scope is either local to a subroutine or global to a program

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

Explain ‘passing by value’

A

A copy of the variable is created within the subroutine, therefore the original variable is unchanged without returning the value

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

Explain ‘passing by reference’

A

A pointer to the variable is created when passed.

When changed within the subroutine, it is updated to the original as well

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

Define ‘IDE’

A

Integrated Development Environment:

Provides tools and an area to create code

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

What are some common features of an IDE?

A
  • Warning alerts
  • Colour coding
  • Commenting
  • Auto-complete and hints
  • Translating and running code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly