Professional Documents
Culture Documents
Self-Quiz Unit 5 - Attempt Review
Self-Quiz Unit 5 - Attempt Review
Self-Quiz Unit 5 - Attempt Review
Dashboard / My courses /
CS 1102 - AY2022-T1 / 30 September - 6 October /
Self-Quiz Unit 5
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 1/6
10/14/21, 12:39 AM Self-Quiz Unit 5: Attempt review
Question 1
Correct
class Food {
}
}
Select one:
a. bland
b. bland
spicy
c. no output
d. spicy
To construct an object, the compiler automatically calls the constructors for any superclasses of an object (unless there is an explicit
"super" call). Thus, "Food()" prints "bland", and then "Pepper()" prints "spicy". See Section 5.6.3.
The correct answer is: bland
spicy
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 2/6
10/14/21, 12:39 AM Self-Quiz Unit 5: Attempt review
Question 2
Incorrect
Select one:
a. abstract
b. extend
c. implement
d. inherit
e. override
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 3/6
10/14/21, 12:39 AM Self-Quiz Unit 5: Attempt review
Question 3
Correct
pepper.printFlavor();
}
}
Select one:
a. bland
b. bland
spicy
c. no output
d. spicy
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 4/6
10/14/21, 12:39 AM Self-Quiz Unit 5: Attempt review
Question 4
Incorrect
class Food {
}
}
lunch.flavor();
}
}
Select one:
a. bland
b. bland
spicy
c. no output
d. spicy
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 5/6
10/14/21, 12:39 AM Self-Quiz Unit 5: Attempt review
Question 5
Incorrect
class Food {
}
}
Select one:
a. bland
b. bland
spicy
c. no output
d. spicy
First the "Food" constructor prints "bland". Then the "Pepper" constructor that takes no parameters calls 'this("spicy")', which represents
the "Pepper" constructor that takes a String parameter. It prints its parameter, "spicy". See Section 5.6.3.
spicy
Jump to...
https://my.uopeople.edu/mod/quiz/review.php?attempt=5697673&cmid=265365 6/6