
Medium Multiple Choice Questions on Inheritance
Authored by Caroline Hersh-Rodeen
Computers
5th Grade

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Given the following class declarations, what is the output from Student s1 = new GradStudent(); followed by s1.getInfo();?
Won't compile since GradStudent doesn't have a getInfo method
Taco
Pizza
Won't compile since you are creating a GradStudent, not a Student
Won't compile since you use this.getFood()
2.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Given the following class declarations, and EnhancedItem enItemObj = new EnhancedItem(); in a client class, which of the following statements would compile?
I only
II only
I and II only
II and III only
I, II, and III
3.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Given the following class declarations and initializations in a client program, which of the following is a correct call to method1?
t1.method1(t1,t1);
t2.method1(t2,t2);
t3.method1(t1,t1);
t2.method1(t3,t2);
t3.method1(t3,t3);
4.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
If you have a parent class Animal that has a method speak() which returns: Awk. Cat has a speak method that returns: Meow. Bird does not have a speak method. Dog has a speak method that returns: Woof. Pig does not have a speak method. Cow has a speak method that returns: Moo. What is the output from looping through the array a created below and asking each element to speak()?
Meow Moo Woof Awk Awk
Awk Awk Awk Awk Awk
This will not compile
This will have runtime errors
Meow Moo Woof Oink Awk
5.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Given the following class declarations and code, what is the result when the code is run?
The code compiles and runs with no errors, the output is 5 6 5 6
The code compiles and runs with no errors, the output is: 5 6 10 11
The code compiles and runs with no errors, the output is 10 11 10 11
The code won't compile.
You get a runtime error ClassCastException, when fastCar.addFuel() is executed.
6.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
Given the following class declarations and code, what is the result when the code is run?
I only
II only
I and III only
III only
I, II, and III
7.
MULTIPLE CHOICE QUESTION
2 mins • 3 pts
What is the output of the following code?
Meow Screeech Lasagna
Screeech Meow Lasagna
Lasagna Meow Screeech
Lasagna Screeech Meow
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Learn to Code: Swift Playgrounds
Quiz
•
3rd - 6th Grade
12 questions
Computer Science
Quiz
•
3rd - 12th Grade
10 questions
SAFE AND RESPONSIBLE USE OF COMPUTER, INTERNET AND EMAIL
Quiz
•
4th - 6th Grade
8 questions
Keyword Internet searches
Quiz
•
2nd - 5th Grade
10 questions
Quiz
Quiz
•
4th - 6th Grade
11 questions
Regreso a Clases 2023
Quiz
•
1st - 5th Grade
10 questions
Computer Languages
Quiz
•
KG - University
11 questions
BTEC DIT: Revision 1-6
Quiz
•
1st - 12th Grade
Popular Resources on Wayground
7 questions
History of Valentine's Day
Interactive video
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
15 questions
Valentine's Day Trivia
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Multiplication Facts
Quiz
•
5th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
12 questions
Presidents' Day
Quiz
•
KG - 5th Grade
20 questions
Classifying Triangles
Quiz
•
5th Grade
10 questions
History and Traditions of Valentine's Day
Interactive video
•
3rd - 6th Grade
10 questions
Multiplying Fractions
Quiz
•
5th Grade
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
10 questions
Adding and Subtracting Decimals
Quiz
•
5th Grade