IT computing iterations Flashcards

(26 cards)

1
Q

Define iteration in computing.

A

A single cycle of a repetitive process in programming or algorithms.

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

True or false: Iterations can only be executed in loops.

A

FALSE

Iterations can also occur in recursive functions.

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

What is a for loop?

A

A control flow statement for specifying iteration with a counter.

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

Fill in the blank: An infinite loop occurs when _______.

A

The exit condition is never met.

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

Define recursive iteration.

A

A process where a function calls itself to solve smaller instances.

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

What is the purpose of iteration in algorithms?

A

To repeatedly execute a block of code until a condition is met.

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

True or false: While loops require a predetermined number of iterations.

A

FALSE

While loops continue until a specific condition is false.

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

What is a do-while loop?

A

A loop that executes at least once before checking its condition.

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

Fill in the blank: Recursion is a form of iteration that involves _______.

A

A function calling itself.

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

Define nested loops.

A

Loops within other loops, allowing for multi-dimensional iteration.

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

What is the break statement used for?

A

To exit a loop prematurely based on a condition.

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

True or false: Continue skips the current iteration and proceeds to the next.

A

TRUE

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

What is an iterator?

A

An object that enables traversal through a collection, like arrays.

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

Fill in the blank: Iteration can improve performance by reducing _______.

A

Redundant calculations.

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

Define loop control variables.

A

Variables that determine the number of iterations in a loop.

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

What is algorithmic efficiency in iterations?

A

It measures the time and space complexity of iterative processes.

17
Q

True or false: For-each loops are used for iterating over collections.

18
Q

What is the time complexity of a linear iteration?

A

O(n), where n is the number of iterations.

19
Q

Fill in the blank: Iteration is often used in _______ to refine results.

A

Machine learning algorithms.

20
Q

Define loop unrolling.

A

An optimization technique that reduces the overhead of loop control.

21
Q

What is a foreach loop?

A

A loop that iterates over elements in a collection without an index.

22
Q

True or false: Recursion can replace iteration in all cases.

A

FALSE

Recursion can lead to stack overflow if too deep.

23
Q

What is a count-controlled loop?

A

A loop that runs a specific number of times based on a counter.

24
Q

Fill in the blank: Nested iterations can lead to _______ complexity.

25
Define **tail recursion**.
A recursion where the recursive call is the last operation in the function.
26
What is the **continue** statement used for?
To skip the current iteration and continue with the next one.