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, 23.06.2019 00:40
Consider the following statements: struct nametype{string first; string last; }; struct coursetype{string name; int callnum; int credits; char grade; }; struct studenttype{nametype name; double gpa; coursetype course; }; studenttype student; studenttype classlist[100]; coursetype course; nametype name; mark the following statements as valid or invalid. if a statement is invalid, explain why.a.) student.course.callnum = "csc230"; b.) cin > > student.name; c.) classlist[0] = name; d.) classlist[1].gpa = 3.45; e.) name = classlist[15].name; f.) student.name = name; g.) cout < < classlist[10] < < endl; h.) for (int j = 0; j < 100; j++)classlist[j].name = name; i.) classlist.course.credits = 3; j.) course = studenttype.course;
Answers: 1
question
Computers and Technology, 23.06.2019 20:30
1. for which of the following are you not required to signal beforehand? a. changing lanes b. speeding up c. stopping
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 23.06.2019 22:50
What is an rss reader used for? for creating a user account on a social new site
Answers: 2
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, 08.10.2019 23:00
question
Mathematics, 08.10.2019 23:00
Questions on the website: 13722363