Instructions
- 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
- 2. Thoroughly review each solution before proceeding to ensure full understanding.
- 3. Final results will be available after submission to provide insights into areas for further improvement.
- 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
- 5. Once submitted, responses are final, so ensure you’re confident in your answers.
- 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.
All Problems
Question
Action
1. What is polymorphism in Java?
2. Which of the following is an example of compile-time polymorphism?
3. Which keyword is used to achieve runtime polymorphism in Java?
4. What is the result of method overriding in Java?
5. Consider the following code. What will be the output?
6. What happens when a static method is overridden in Java?
7. Which of the following is true about method overloading?
8. Which of the following supports runtime polymorphism?
9. What is the main difference between overriding and overloading?
10. Which method is called when a child class object is created and assigned to a parent class reference?
1. What is polymorphism in Java?
<p><br></p><p><br></p>
2. Which of the following is an example of compile-time polymorphism?
3. Which keyword is used to achieve runtime polymorphism in Java?
<p>A. this</p><p>B. static</p><p>C. super</p><p>D. No specific keyword<br><strong>Answer:</strong> D</p>
4. What is the result of method overriding in Java?
5. Consider the following code. What will be the output?
<p>class A {<br> void display() {<br> System.out.println("Class A");<br> }<br>}<br>class B extends A {<br> void display() {<br> System.out.println("Class B");<br> }<br>}<br>public class Test {<br> public static void main(String[] args) {<br> A obj = new B();<br> obj.display();<br> }<br>}<br><br></p>
6. What happens when a static method is overridden in Java?
7. Which of the following is true about method overloading?
8. Which of the following supports runtime polymorphism?
<p><br></p><p><br></p>
9. What is the main difference between overriding and overloading?
<p><br></p><p><br></p>
10. Which method is called when a child class object is created and assigned to a parent class reference?
<p><br></p><p><br></p>