JNTU
JNTU MCA 2022 JAVA PROGRAMMING Previous Question Paper (October/November - 2022 - R20)
Answer any five questions. All questions carry equal marks.
Main
Explain the basic concepts of object oriented programming.
Answer
Object-Oriented Programming (OOP) is a paradigm based on the concept of objects which contain data in the form of fields and code in the form of methods. The core concepts are:
- Class: A blueprint or template that defines the properties and behaviors of objects.
- Object: An instance of a class with a specific state and behavior.
- Encapsulation: The mechanism of wrapping data and code together as a single unit and restricting direct access to some of an object's components.
- Abstraction: Hiding complex implementation details and showing only the essential features of an object.
- Inheritance: A mechanism where one class acquires the properties and behaviors of another class, promoting code reusability.
- Polymorphism: The ability of an object or method to take on many forms, typically achieved through method overloading and overriding.
Discuss the scope and life time of the variable in java.
Answer
In Java, the scope and lifetime of a variable depend on its declaration:
- Instance Variables: Declared inside a class but outside any method. Their scope is the entire class, and their lifetime is tied to the object; they are created when an object is instantiated and destroyed when the object is garbage collected.
- Static (Class) Variables: Declared with the
statickeyword. Their scope is the class, and they exist for the entire duration of the program execution, shared by all instances of the class. - Local Variables: Declared inside a method, constructor, or block. Their scope is limited to the block in which they are defined. Their lifetime begins when the block is entered and ends when the block is exited.
- Method Parameters: Act as local variables within the method. Their scope is the method body, and they are destroyed once the method execution completes.
What is a constructor? What is its requirement in programming? Explain with program.
Answer
Sign in to view the complete answer paper.
What is a nested class? Differentiate between nested classes and inner classes.
Answer
Sign in to view the complete answer paper.
Define a package? How to access and import a package? Explain with an example.
Answer
Sign in to view the complete answer paper.
Discuss multilevel inheritance with a sample program.
Answer
Sign in to view the complete answer paper.
What is the use of final with inheritance? Explain with an example.
Answer
Sign in to view the complete answer paper.
Discuss in detail the limitations and benefits of inheritance.
Answer
Sign in to view the complete answer paper.
Explain about exception handling and write a java program which illustrates the try, catch, throw and throws and finally blocks.
Answer
Sign in to view the complete answer paper.
Design an interface called Shape with methods draw() and getArea(). Further design two classes called Circle and Rectangle that implements Shape to compute area of respective shapes. Use appropriate getter and setter methods. Write a java program for the same.
Answer
Sign in to view the complete answer paper.
What is the role of event listeners in event handling? List the Java event listeners.
Answer
Sign in to view the complete answer paper.
Explain delegation event model.
Answer
Sign in to view the complete answer paper.
Explain the synchronization of multiple threads in Java with an example.
Answer
Sign in to view the complete answer paper.
Explain the concept of applet to applet communication.
Answer
Sign in to view the complete answer paper.