
Java Mastery Challenge
Quiz
•
English
•
University
•
Practice Problem
•
Hard
Dhrudeep Vaghashiya
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main principle of object-oriented programming?
Inheritance of properties from a parent class.
Encapsulation of data and behavior into objects.
Static typing of all variables in the program.
Polymorphism through method overloading only.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the difference between an interface and an abstract class in Java.
An interface can have instance variables, while an abstract class cannot.
An abstract class can be instantiated, but an interface cannot.
An interface can extend multiple classes, while an abstract class can only extend one.
An interface defines a contract for classes to implement, while an abstract class can provide some method implementations and state.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of accessing an element in an ArrayList?
O(log n)
O(n)
O(n^2)
O(1)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Describe the concept of inheritance in Java with an example.
class Vehicle { void start() { System.out.println('Vehicle started'); } } class Car extends Vehicle { void start() { System.out.println('Car is running'); } }
class Plant { void grow() { System.out.println('Plant growing'); } } class Tree extends Plant { void grow() { System.out.println('Tree is tall'); } }
class Animal { void makeSound() { System.out.println('Meow'); } } class Cat extends Animal { void makeSound() { System.out.println('Roar'); } }
Example: class Animal { void makeSound() { System.out.println('Animal sound'); } } class Dog extends Animal { void makeSound() { System.out.println('Bark'); } }
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the 'final' keyword in Java?
The 'final' keyword is used to create interfaces.
The 'final' keyword allows multiple inheritance in classes.
The 'final' keyword is used to define abstract classes.
The 'final' keyword is used to declare constants, prevent method overriding, and prevent inheritance.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you implement a stack using an array in Java?
Implement the stack using a HashMap.
Create a class with only a push method.
Use a linked list to implement the stack.
Create a class with an array, a top index, and methods for push, pop, and peek.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is polymorphism and how is it achieved in Java?
Polymorphism is achieved through the use of interfaces only.
Polymorphism is the ability to create multiple classes in Java.
Polymorphism allows objects to be created without any methods.
Polymorphism is the ability of an object to take on many forms, achieved in Java through method overriding and method overloading.
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
13 questions
Research Report
Quiz
•
University
10 questions
EFFECTIVE GROUP DISCUSSION
Quiz
•
9th Grade - University
10 questions
Present Simple
Quiz
•
6th Grade - Professio...
15 questions
Want/Like/Need/Have + To
Quiz
•
5th Grade - Professio...
10 questions
Giving advice
Quiz
•
9th Grade - Professio...
10 questions
UNIT 6 LEVEL 5
Quiz
•
University
15 questions
Classroom Management Concept
Quiz
•
University
15 questions
Identifying Logical Fallacies
Quiz
•
University
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
