subject

The procedure below is intended to display the index in a list of unique names(nameList) where a particular name(targetName) is found. If targetName is not found in nameList, the code should display 0. PRoCEDURE FindName (nameList, targetName)
{
index<-- 0
for EACH name IN nameList
{
index <-- index + 1
IF (name = targetName)
{
foundIndex <--- Index
}
ELSE
{
foundIndex <-- Index
}
ELSE
foundIndex<-- 0
}
}
DISPLAY (foundIndex)
}
Which of the following procedure calls can be used to demonstrate that the procedure does NoT work as intended?

a. FindName(["Andrea", "Ben"], "Ben")
b. FindName(["Andrea", "Ben"], "Diane)
c. FindName(["Andrea", "Ben", "Chris"], "Ben")
d. FindName(["Andrea", "Chris", "Diane"], "Ben")

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:10
How can i delete permalinks from a word press site?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
Write a program that prompts the user to input a string. the program then uses the function substr to remove all the vowels from the string. for example, if str = "there", then after removing all the vowels, str = "thr". after removing all the vowels, output the string. your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Jennifer has to set up a network in a factory with an environment that has a lot of electrical interference. which cable would she prefer to use? jennifer would prefer to use because its metal sheath reduces interference.
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
You know the right answer?
The procedure below is intended to display the index in a list of unique names(nameList) where a par...
Questions
question
Mathematics, 06.05.2020 00:36
question
Mathematics, 06.05.2020 00:36