
java 11-10-2023
Quiz
•
Computers
•
Professional Development
•
Practice Problem
•
Hard
DEVAKI AMIR
Used 4+ times
FREE Resource
Enhance your content in a minute
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
i) Fill in the blank space to make this code an example of Polymorphism
ii) predict whether it prints the base class or derived class
class BuggyBread1 {
public String method() {
return "Base Class - BuggyBread1";
}
}
class BuggyBread2 extends BuggyBread1{
private static int counter = 0;
public String _______(int x) {
return "Derived Class - BuggyBread2";
}
public static void main(String[] args) {
BuggyBread1 bg = new BuggyBread2();
System.out.println(bg.method());
}
}
i) method
ii) prints the base class
i)Buggybread2
ii)prints the base class
i) method
ii)prints the derived class
i)Buggybread2
ii)prints the derived class
2.
FILL IN THE BLANK QUESTION
1 min • 1 pt
Fill in the blanks to print the output "Kapil". Separate the answers with ','.
class Person {
private String name;
public String getName() { return name; }
public void setName(String newName)
{
this.name = newName;
}
}
class Main {
public static void main(String[] args)
{
Person person = new Person();
person._______("kapil");
System.out.println(person.______());
}
}
3.
FILL IN THE BLANK QUESTION
2 mins • 1 pt
Predict the output of the following code.
import java.util.Random;
class DeliveryBoy {
public void deliver() {
System.out.println("Delivering Item");
}
public static void main(String[] args) {
DeliveryBoy deliveryBoy = getDeliveryBoy();
deliveryBoy.deliver();
}
private static DeliveryBoy getDeliveryBoy() {
Random random = new Random();
int number = random.nextInt(5);
return number % 2 == 0 ? new Postman() : new FoodDeliveryBoy();
}
}
class Postman extends DeliveryBoy {
@Override
public void deliver() {
System.out.println("Delivering Letters");
}
}
class FoodDeliveryBoy extends DeliveryBoy {
@Override
public void deliver() {
System.out.println("Delivering Food");
}
}
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What do we mean by the "state" of an object?
Its behavior
Its methods
Its interface
The values assigned to its instance variables
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class Vehicle {
private static String manufacturingDate = "2016";
}
public class Car extends Vehicle{
public static void main(String args[]){
System.out.println(manufacturingDate);
}
}
2016
No Output
error - The field Vehicle.manufacturingDate is not visible
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class Vehicle {
private static String manufacturingDate = "2016";
static public class Car extends Vehicle{
public static void main(String args[]){
System.out.println(manufacturingDate);
}
}
}
2016
No Output
error - The field Vehicle.manufacturingDate is not visible
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Static Polymorphic in Java is achieved through ..
Method Overloading
Method Overriding
Variable Overloading
Variable Overriding
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
Mulai karir sebagai Network Engineer dengan MikroTik
Quiz
•
KG - Professional Dev...
10 questions
DBMS
Quiz
•
Professional Development
15 questions
Network Plus Pre Assessment
Quiz
•
Professional Development
10 questions
Pemrograman Android KD 3.28/4.28
Quiz
•
1st Grade - Professio...
16 questions
Applied Networking
Quiz
•
12th Grade - Professi...
12 questions
Cycle 4: Session 8 Review.
Quiz
•
Professional Development
14 questions
Day 1 - Basics of Java
Quiz
•
Professional Development
10 questions
EdTech @ MODERN
Quiz
•
Professional Development
Popular Resources on Wayground
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
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
10 questions
How to Email your Teacher
Quiz
•
Professional Development
6 questions
3RD GRADE DECLARATION OF INDEPENDENCE EXIT TICKET
Quiz
•
Professional Development
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
22 questions
Multiplying Exponents with the Same Base
Quiz
•
9th Grade - Professio...
40 questions
Flags of the World
Quiz
•
KG - Professional Dev...
