P1_APLab2Quiz_B3B4
Quiz
•
Computers
•
University
•
Hard
MR ARORA
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What is the primary purpose of abstract methods in Java?
To create methods that can only be accessed within the same package.
To prevent the instantiation of abstract classes.
To define methods that must be implemented by any concrete class derived from the abstract class.
To provide default implementations for methods in derived classes.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In Java, if an exception is thrown in a try block and there are multiple catch blocks, what happens if the exception type does not exactly match any catch block but is a subclass of one of the catch block's parameters?
The compiler throws an error because of ambiguity.
The catch block with the superclass parameter will be executed.
The catch block with the subclass parameter will be executed.
The program will terminate without handling the exception.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following statements about checked and unchecked exceptions in Java is correct?
Checked exceptions must be caught or declared in the method signature using throws keyword.
Unchecked exceptions are always caught by the compiler.
Checked exceptions are subclasses of RuntimeException.
Unchecked exceptions must be caught using try-catch blocks.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which statement is false regarding abstract classes in Java?
Abstract classes can have abstract methods with or without method bodies.
Abstract classes can be declared as final to prevent further inheritance.
Abstract classes cannot be instantiated directly; they need to be subclassed.
Abstract classes can have constructors for initializing instance variables.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Predict the output.
A C
A B C
B C
B
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
What happens if a method uses throws but does not throw any exception?
It will cause a compilation error.
It will throw a runtime exception.
It will throw a checked exception automatically.
It will not cause any issue.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
In Java, why can't methods in interfaces have access modifiers other than public?
It violates the encapsulation principle.
Interfaces are always public, so their methods are implicitly public.
It leads to ambiguity in method visibility.
Methods in interfaces can have different access modifiers based on the implementing class.
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
10 questions
OOPJ #1
Quiz
•
University
10 questions
FST Class 2023- Quiz 1
Quiz
•
University
10 questions
На сколько ты знаешь C#
Quiz
•
University
10 questions
Java Control Flow statements
Quiz
•
University
10 questions
Software Testing
Quiz
•
University
10 questions
Pemrograman Android KD 3.28/4.28
Quiz
•
1st Grade - Professio...
10 questions
System Design
Quiz
•
University
10 questions
Node.js
Quiz
•
University
Popular Resources on Wayground
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Order of Operations
Quiz
•
5th Grade
20 questions
Halloween
Quiz
•
5th Grade
16 questions
Halloween
Quiz
•
3rd Grade
12 questions
It's The Great Pumpkin Charlie Brown
Quiz
•
1st - 5th Grade
20 questions
Possessive Nouns
Quiz
•
5th Grade
10 questions
Halloween Traditions and Origins
Interactive video
•
5th - 10th Grade
Discover more resources for Computers
10 questions
Halloween Movies Trivia
Quiz
•
5th Grade - University
12 questions
Halloween
Quiz
•
3rd Grade - University
5 questions
Using Context Clues
Interactive video
•
4th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
14 questions
Eat Healthy,Be Healty
Quiz
•
4th Grade - University
7 questions
History of Halloween: Pagan or Christian?
Interactive video
•
11th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
