JNTU
JNTU MCA 2023 JAVA PROGRAMMING Previous Question Paper (March - 2023 - R20)
Note: i) Question paper consists of Part A, Part B. ii) Part A is compulsory, which carries 25 marks. In Part A, answer all questions. iii) In Part B, Answer any one question from each unit. Each question carries 10 marks and may have a, b as sub questions.
Part A
Illustrate type conversion and type casting in Java.
Answer
Type conversion and type casting are mechanisms in Java to handle the assignment of values between different data types.
Type Conversion (Widening): This occurs automatically when a smaller data type is assigned to a larger data type. It is safe because there is no loss of data. The compiler performs this implicitly.
long l = i; // Implicit conversion from int to long
Type Casting (Narrowing): This is an explicit process required when assigning a larger data type to a smaller data type. It must be performed manually by the programmer using the cast operator (type) because it may result in data loss or precision reduction.
int i = (int) d; // Explicit casting from double to int, results in 9
The key difference is that widening is automatic and safe, whereas narrowing is explicit and carries the risk of truncation or overflow.
Differentiate between interface and abstract class.
Answer
An abstract class is a class that cannot be instantiated and may contain both abstract methods (without bodies) and concrete methods (with implementation). It is used to provide a common base class for subclasses to share code and state. In contrast, an interface is a blueprint of a class that typically contains only abstract methods (prior to Java 8) and constants. It defines a contract that implementing classes must follow.
| Feature | Abstract Class | Interface |
|---|---|---|
| Inheritance | A class can extend only one abstract class. | A class can implement multiple interfaces. |
| Methods | Can have abstract and non-abstract methods. | Methods are implicitly public and abstract (default/static allowed since Java 8). |
| Variables | Can have final, non-final, static, and non-static variables. | Variables are implicitly public, static, and final. |
| Access Modifiers | Members can have any access modifier (private, protected, public). | Members are implicitly public. |
| Purpose | Used for code reuse and defining a base identity. | Used to achieve multiple inheritance and define capabilities. |
What are the benefits of exception handling?
Answer
Sign in to view the complete answer paper.
Discuss the limitations of abstract window toolkit.
Answer
Sign in to view the complete answer paper.
How to perform thread synchronization?
Answer
Sign in to view the complete answer paper.
Part B
Explain the need of object oriented programming paradigm and its concepts.
Answer
Sign in to view the complete answer paper.
Demonstrate the use of ‘final’ keyword.
Answer
Sign in to view the complete answer paper.
With an example, explain the concept of inner classes.
Answer
Sign in to view the complete answer paper.
Define polymorphism and discuss dynamic method dispatch.
Answer
Sign in to view the complete answer paper.
Describe member access rules for packages.
Answer
Sign in to view the complete answer paper.
Write a program to implement hierarchical inheritance.
Answer
Sign in to view the complete answer paper.
How to define an interface? Illustrate partial and total implementation of interfaces.
Answer
Sign in to view the complete answer paper.
Differentiate between throw and throws usage.
Answer
Sign in to view the complete answer paper.
Write a program to demonstrate nested by statements.
Answer
Sign in to view the complete answer paper.
With the help of a program explain delegation event model of Java.
Answer
Sign in to view the complete answer paper.
Create a login form using labels, text boxes and buttons.
Answer
Sign in to view the complete answer paper.
Describe Model-view-controller architecture.
Answer
Sign in to view the complete answer paper.
Discuss the advantages of applets over application program and life cycle of an applet.
Answer
Sign in to view the complete answer paper.
How to create multiple threads?
Answer
Sign in to view the complete answer paper.
Explain the purpose of wait() and notify() methods.
Answer
Sign in to view the complete answer paper.