
B4 - More about Polymorphism
Authored by Ahmetcan türk
Other
University
Used 4+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a method's signature?
The signature of a method is the name of the method the type of its return value.
The signature of a method is the name of the method and the names of its parameters.
The signature of a method is the name of the method and the data types of its parameters.
The signature of a method is the name of the method, its parameter list, and its return type.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Here is a method definition:
int compute( int a, double y ){ . . . .}
Which of the following has a different signature?
int compute( int sum, double value){ . . . .}
double compute( int a, double y){ . . . .}
double compute( int sum, double y){ . . . .}
int compute( int a, int y){ . . . .}
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What must a non-abstract child do about an abstract method in its parent class?
A child must override an abstract method inherited from its parent by defining a method with the same signature and same return type.
A child must define an additional method similar to the one inherited from its parent by defining a method with the same signature and different return type.
A child must not define any method with the same signature as the parent's abstract method.
A non-abstract child must define an abstract method with the same signature and same return type as the parent's abstract method.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Here is an abstract method defined in the parent:
public abstract int sumUp ( int[] arr );
Which of the following is required in a non-abstract child?
public abstract int sumUp ( int[] arr ) { . . . }
public int sumUp ( int[] arr ) { . . . }
public double sumUp ( int[] arr ) { . . . }
public int sumUp ( long[] arr ) { . . . }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What must be true if a child of an abstract parent class does not override all of the parent's abstract methods?
This is always an error.
The child class itself must be declared to be abstract.
Child classes are automatically non-abstract, so this is OK.
The parent class is in error.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Here is a situation:
Birthday happy;
happy = new AdultBirthday( "Joe", 39);
happy.greeting();
Which greeting() method is run: the one defined for Birthday or the one defined for AdultBirthday?
The one defined for Birthday because that is the type of the variable happy.
The one defined for AdultBirthday because that is the type of the object referred to by happy.
The one closest in the source code to the happy.greeting() statement.
Neither---the assignment statement is in error.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Say that class Rodent has a child class Rat and another child class Mouse. Class Mouse has a child class PocketMouse. Examine the following
Rodent rod;
Rat rat = new Rat();
Mouse mos = new Mouse();
PocketMouse pkt = new PocketMouse();
Which one of the following will cause a compiler error?
rod = rat;
rod = mos;
pkt = null;
pkt = rat;
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
14 questions
Brawl Stars
Quiz
•
KG - Professional Dev...
10 questions
Critical Approaches to Literature
Quiz
•
University
11 questions
Chapter 2: Factors, Effect of Time & Interest on Money
Quiz
•
University
12 questions
Alberta Natural Resources #2
Quiz
•
KG - University
15 questions
PDP
Quiz
•
University
15 questions
LIVE QUIZ - SDG 4, 5 AND 6
Quiz
•
University
13 questions
Accounting 100
Quiz
•
University
15 questions
FNSINC612 Practice 3
Quiz
•
University
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 Other
18 questions
Valentines Day Trivia
Quiz
•
3rd Grade - University
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
5 questions
What is Presidents' Day?
Interactive video
•
10th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
20 questions
Mardi Gras History
Quiz
•
6th Grade - University
10 questions
The Roaring 20's Crash Course US History
Interactive video
•
11th Grade - University
17 questions
Review9_TEACHER
Quiz
•
University