PCA25C01J · End Semester
Covers all units: Introduction to Java / Classes and Constructors / Inheritance and Exception Handling / Thread and Utility Classes / Event Handling and JDBC
Only page 1 of 2 was photographed. Questions from Q13 onwards are missing.
Answer any 5 Questions
Describe Bytecode and how it contributes to Java's platform independence.
Write a Java program to implement sorting of an array using control statements. Explain your code.
Explain with an example how to implement method overloading and constructor overloading in Java.
Explain the use of the this keyword with a suitable example.
Summarize multilevel inheritance with an example.
State the difference between try-catch-finally and throws in exception handling.
Distinguish between creating a thread by extending Thread class and by implementing Runnable interface.
What are JDBC drivers? List out all the types.
Answer all Questions
Discuss the features of Java that distinguish it from other programming languages. Give suitable examples
(i) Write a Java program to check whether a given number is prime or not using loops and conditional statements. (10 Marks)
(ii) Explain the role of the Java compiler and interpreter (Java and JVM) in program execution. (5 Marks)
Design a Java class called Employee with fields (empId, empName, salary) and methods (calculateBonus, display). Demonstrate constructors and object creation.
(i) Define garbage collection. How does the finalize() method help in this process? (5 Marks)
(ii) Write a Java program to demonstrate string handling methods like length(), substring(), indexOf(), toUpperCase(). (10 Marks)
(i) Explain hierarchical inheritance in Java with an example program. (10 Marks)
(ii) Write a program to demonstrate the use of the super keyword in inheritance. (5 Marks)
Analyze the differences between abstract classes and interfaces with examples, highlighting their use in real-time applications.
Implement a Java program for multithreading to simulate multiple tasks running simultaneously. Discuss thread priorities
Analyze the working of a producer-consumer problem in multithreading. Write a Java program to demonstrate synchronization.