What is the main principle of object-oriented programming?

Java Mastery Challenge

Quiz
•
English
•
University
•
Hard
Dhrudeep Vaghashiya
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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.
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
Exploring Ratios and Proportions for Grade 6

Quiz
•
6th Grade - University
10 questions
Text Features

Quiz
•
3rd Grade - University
15 questions
JavaScript

Quiz
•
University
10 questions
bedwars quiz

Quiz
•
University - Professi...
13 questions
Loops and operators java

Quiz
•
University
9 questions
2D IGCSE

Quiz
•
9th Grade - University
15 questions
Nevermoor

Quiz
•
5th Grade - University
13 questions
Quiz 3

Quiz
•
University
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade