Implementation | Algorithms Flashcards

1
Q

What are standard algorithms?

A

Algorithms that appear in program after program.

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

List four standard algorithms.

A
  • Input validation
  • Find minimum/maximum
  • Count occurrences
  • Linear search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the purpose of input validation?

A

To restrict the data the user can input or to reject invalid input.

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

What type of loop is commonly used for input validation?

A

WHILE . . . DO . . . END WHILE conditional loop.

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

How does the REPEAT . . . UNTIL conditional loop function in input validation?

A

It checks for invalid input using an IF . . . THEN . . . END IF control structure.

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

True or False: The REPEAT . . . UNTIL algorithm is more efficient than the WHILE . . . DO . . . END WHILE algorithm for input validation.

A

False

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

What function is used to limit the length of an input string in input validation?

A

Length function.

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

What is a boolean flag in the context of input validation?

A

A boolean variable used to control the termination of the conditional loop.

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

What data structure is commonly used to store a list of values in the Find Minimum/Maximum algorithm?

A

Array.

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

Describe the Finding the Maximum algorithm.

A

It stores the largest value in a variable and checks the array contents one by one.

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

What is the first step in the Finding Minimum algorithm?

A

Set the variable for the smallest value equal to the first item in the array.

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

What does the Counting Occurrences algorithm do?

A

Counts how many times a particular value occurs in an array.

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

In the Counting Occurrences algorithm, what is the initial value of the counter?

A

Zero.

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

What is the purpose of the Linear Search algorithm?

A

To find an item in a list.

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

How does the Linear Search algorithm determine when to stop searching?

A

When the search term is found or the end of the array is reached.

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

True or False: The Linear Search algorithm can return the position of every instance of the search item.

17
Q

What type of variable is used in the Linear Search algorithm to track whether an item has been found?

A

Boolean variable.

18
Q

What is the main limitation of the linear search using a conditional loop?

A

It only returns the position of the first occurrence of the search item.