Java Programming Quiz

Quiz
•
English
•
12th Grade
•
Hard
Harshavardhan Saripalli
Used 12+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the primary difference between method overloading and method overriding in Java?
Overloading occurs at runtime, while overriding occurs at compile time.
Overloading requires different method names, while overriding does not.
Overloading requires different parameter lists, while overriding uses the same parameter list.
Overloading works only in the parent class, while overriding works only in the child class.
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following is true about the final keyword in Java?
A final method can be overridden in a subclass.
A final class can extend another class.
A final variable can be re-assigned once initialized.
A final class cannot be subclassed.
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What happens if a throws clause is used in a method but no exception is thrown in the method body?
A compile-time error occurs.
A runtime error occurs.
The program compiles and runs successfully.
The JVM generates a warning.
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of these statements is NOT true about interfaces in Java?
Interfaces support multiple inheritance.
Interfaces can include static methods with a body.
Interfaces can have private methods.
A class can extend multiple interfaces simultaneously.
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following correctly defines the relationship between packages and access modifiers?
Classes in the same package can access private members.
Classes in different packages can access protected members via inheritance.
The default access modifier is accessible only within the class.
The public modifier restricts access within the package.
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the correct order of execution for try, catch, and finally blocks?
try -> catch -> finally
finally -> try -> catch
catch -> try -> finally
try -> finally -> catch
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of the following code?
class Animal {
void sound() {
System.out.println("Animal makes a sound");
}
}
class Dog extends Animal {
@Override void sound() {
System.out.println("Dog barks");
}
}
public class Main { public static void main(String[] args) {
Animal obj = new Dog(); obj.sound();
}
}
Animal makes a sound
Dog barks
Compilation error: Method sound() cannot be overridden.
Runtime error: Method sound() not found.
Create a free account and access millions of resources
Similar Resources on Wayground
16 questions
Song of Shawn Mendes

Quiz
•
University
20 questions
Obligation and Permission

Quiz
•
KG - Professional Dev...
15 questions
The Cosmere quiz

Quiz
•
6th - 12th Grade
15 questions
Android - Quiz 14

Quiz
•
University
15 questions
Identifying Closed Syllable Exceptions

Quiz
•
2nd Grade - University
15 questions
Identifying Closed Syllable Exceptions

Quiz
•
2nd Grade - University
16 questions
Central Idea Bell Ringer

Quiz
•
KG - University
15 questions
TOEIC READING PART 6 PRACTICE

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for English
19 questions
Understanding the Circle of Control

Quiz
•
9th - 12th Grade
15 questions
Essential Strategies for SAT Reading and Writing Success

Interactive video
•
12th Grade
20 questions
Chronological Order of Events (Chp. 61-70) in Born Behind Bars

Quiz
•
9th - 12th Grade
8 questions
Elements of Poetry

Lesson
•
9th - 12th Grade
20 questions
Rhetorical Appeals

Lesson
•
9th - 12th Grade
20 questions
Parts of Speech

Quiz
•
12th Grade
20 questions
Chronological Order of Events (Chp. 48-60) in Born Behind Bars

Quiz
•
9th - 12th Grade
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University