An algorithm is given below.
1 array ID ← [45, 33, 27, 88, 103, 66, 71]
2 OUTPUT "Please enter ID number to find"
3 numberSought ← USERINPUT
4 found ← False
5 n ← LENGTH(ID)
6 k ← 0
7 WHILE NOT found AND k < n
8 IF numberSought = ID[k] THEN
9 found ← True
10 ENDIF
11 k ← k + 1
12 ENDWHILE
13 IF found THEN
14 OUTPUT "ID is in the list at index " + INT_TO_STRING(k – 1)
15 ELSE
16 OUTPUT "ID is not in the list"
17 ENDIF
(a) What value is assigned to n at line 5? 7 [1]
(b) What will be output if the user enters 88? [2]


(c) How many times will the loop be executed if the user enters 88? [1]


(d) What is the name of this algorithm? [1]

Respuesta :

Algorithms are used as a prototype of an actual program.

  • The value is assigned to n at line 5 is 7
  • The output, if the user enters 88 is "ID is in the list at index  3"
  • The loop will be executed 4 times, if the user enters 88
  • The name of the algorithm is the search algorithm

What value will be assigned to n?

On line 5, the length of the array is calculated, and assigned to n.

The array has 7 elements,

So, the value is assigned to n at line 5 is 7

What is the output if the user enters 88?

From the algorithm, the algorithm searches for 88 and prints the index of 88, if it exists in the array

Value 88 is at index 3.

So, the output when the user enters 88 is: "ID is in the list at index  3"

How many times is the loop executed?

Value 88 is at index 3.

This means that it is the 4th element of the array.

So, the loop will be executed 4 times.

What is the name of the algorithm?

The algorithm searches for a value and prints the index of value, if it exists in the array

So, the name of the algorithm is the search algorithm.

Read more about algorithms at:

https://brainly.com/question/24793921