Programming Techniques Flashcards

(13 cards)

1
Q

What is sequence in programming?

A

Sequence means the code runs in order from top to bottom, one instruction after another.

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

Quick summary of:

1 )Sequence
2) Selection
3) Iteration

A

Sequence – running code line by line

Selection – using conditions (e.g. IF, CASE)

Iteration – repeating code (e.g. FOR, WHILE)

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

What is iteration in programming?

A

Iteration means repeating a block of code using loops like ‘for’ or ‘while’.

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

What is branching in programming?

A

Allows the program to make decisions using conditional statements (like ‘if’, ‘then’, ‘else’.)

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

What is recursion?

A

A function calls itself to solve a smaller part of a problem.

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

Give an example of a recursive algorithm.

A

The factorial function: fact(n) = n * fact(n - 1).

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

How is recursion different from iteration?

A

Recursion uses repeated function calls and a base case; iteration uses loops and often uses less memory.

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

What is modularity in programming?

A

Breaking a program into smaller-reusable procedures/functions

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

What is a function in pseudocode?

A

A block that returns a value, e.g., function calcArea(radius).

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

What is a procedure in pseudocode?

A

A block that performs actions but does not return a value.

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

What is parameter passing by value?

A

A copy of the value is passed; changes inside the procedure do not affect the original variable.

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

What is parameter passing by reference?

A

A reference (address) is passed; changes inside the procedure affect the original variable.

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

How are OOP techniques used in programming logic?

A

By using classes, objects, methods, inheritance, encapsulation, and polymorphism to structure and organise code.

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