subject

The procedure below is intended to display the index in a list of unique names (nameList) where a particular name (targetName) is found. lf 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 ← 0
}
}
DISPLAY (foundIndex)
}
Which of the following procedure calls can be used to demonstrate that the procedure does NOT Work as intended?
Select one:

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

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:10, brylove603
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
image
Computers and Technology, 24.06.2019 16:00, miner12924owhu4d
5.a fishing rod is formed from a composite material of 0.5 kg of glass fibers embedded in a matrix of 0.5 kg of epoxy resin. the glass fibers are assumed to be long, continuous and unidirectional. to achieve a greater stiffness it is proposed to use a different composite that is comprised of long continuous carbon fibers that will be embedded in a matrix of 0.5 kg of epoxy resin. if the modulus of elasticity of the carbon fiber composite is 10% greater than the elastic modulus of the glass fiber composite, estimate the mass of carbon fibers that will be used to make the carbon fiber composite. assume the applied tensile stress is parallel to the direction of the long axis of the fibers. the epoxy resin, glass fiber, and carbon fiber have an elastic modulus of 5, 86, and 350 gpa respectively and a density of 1100, 2500, and 1800 respectively.
Answers: 3
image
Computers and Technology, 25.06.2019 03:00, reearamrup27
Match the categories in the first column with examples in the second column. 1. good for watching movies 2. maximum power with small size 3. older style mobile devices that may or may not have internet connectivity tablet computer a.)pda b.)smart phone c.)tablet computer
Answers: 1
image
Computers and Technology, 25.06.2019 06:30, tiwaribianca475
How can u permanently delete a picture from your camera ?
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 pa...

Questions in other subjects:

Konu
Physics, 11.10.2019 21:10