A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children


A summer camp offers a morning session and an afternoon session. The list morningList contains the names of all children attending the morning session, and the list afternoonList contains the names of all children attending the afternoon session.
Only children who attend both sessions eat lunch at the camp. The camp director wants to create lunchList, which will contain the names of children attending both sessions.
The following code segment is intended to create lunchList, which is initially empty.
It uses the procedure IsFound (list, name), which returns true if name is found in list and returns false otherwise.
FOR EACH child IN morningList
{
}
Which of the following could replace so that the code segment works as intended?
(A)
IF (IsFound (afternoonList, child))
{
APPEND (lunchList, child)
}
(B)
IF (IsFound (lunchList, child))
{
APPEND (afternoonList, child)
}
(C)
IF (IsFound (morningList, child))
{
APPEND (lunchList, child)
}
(D)
IF ((IsFound (morningList, child)) OR
(IsFound (afternoonList, child)))
{
APPEND (lunchList, child)
}


Leave a Reply

Your email address will not be published.