Write the output that is printed when the given method below is passed each of t
ID: 3855221 • Letter: W
Question
Write the output that is printed when the given method below is passed each of the following maps as its parameter. Assume that each parameter map stores its key/value pairs in exactly the order shown, and that is the order in which a for-each loop would examine them. Recall that maps print in a {key1=value1, key2=value2, ..., keyN=valueN} format. Your answer should display the right values in the right order.
{sheep=wool, house=brick, cast=plaster, wool=wool} {munchkin=blue, winkie=yellow, corn=yellow, grass=green, emerald=green} {pumpkin=peach, corn=apple, apple=apple, pie=fruit, peach=peach} {lab=ipl, lion=cat, terrier=dog, cat=cat, platypus=animal, nyan=cat}Explanation / Answer
a. {sheep=wool, house=brick, cast=plaster, wool=wool}
Output :
will print [brick, plaster]
b. {ball=blue, winkie=yellow, corn=yellow, grass=green, emerald=green}
Output :
will print [blue, green, yellow]
c. {pumpkin=peach, corn =apple, apple=apple, pie=fruit, peach=peach}
Output :
Will print [apple, fruit]
d. {lab=ipl, lion=cat, corgi=dog, cat=cat, emu=animal, nyan=cat}
Output :
will print [animal, cat, dog, ipl]
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.