Ask Question
18 December, 01:15

3. What is the error in the following pseudocode? / / The searchName function accepts a string containing the name / / to search for, an array of strings containing the names, and / / an integer specifying the size of the array. The function / / searches for the name in the array. If the name is found, the / / string containing the name is returned; otherwise a message / / indicating that the name was not found in the array is / / returned. Function String searchName (String name, String names[], Integer size) Declare Boolean found Declare Integer index Declare String result / / Step through the array searching for the / / specified name. While found = = False AND index < = size - 1 If contains (names[index], name) Then Set found = True Else Set index = index + 1 End If End While / / Determine the result. If found = = True Then Set result = names[index] Else Set result = "That name was not found in the array." End If Return result End Function

+5
Answers (1)
  1. 18 December, 03:26
    0
    The answer is "In the given pseudo-code there are three errors".

    Explanation:

    The description of the errors can be defined as follows:

    The first error in this code is that the variable doesn't initialize any value with a variable, which is equal to false. The second error is it does not return any string value. At the last, if the conditional statement doesn't work properly because in this block if the name is found, it doesn't print any error message.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “3. What is the error in the following pseudocode? / / The searchName function accepts a string containing the name / / to search for, an ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers