JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA JAVA PROGRAMMING Previous Question Paper (May - 2022 - R20)
Answer any five questions. All questions carry equal marks.
Main
Illustrate the use of this keyword with an example.
Answer
The this keyword in Java is a reference variable that refers to the current object instance. It is primarily used to resolve ambiguity between instance variables and parameters with the same name, or to invoke other constructors within the same class.
Example:
class Student {
String name;
Student(String name) {
this.name = name; // Resolves ambiguity between parameter and field
}
}
Key uses include:
- Referencing the current class instance variable.
- Invoking current class constructor using this().
- Passing the current object as a parameter to another method.
- Returning the current class instance from a method.
Differentiate between procedural language and OOP.
Answer
Procedural programming focuses on a step-by-step execution of functions or procedures, whereas Object-Oriented Programming (OOP) focuses on objects that encapsulate both data and behavior.
| Feature | Procedural Language | OOP |
|---|---|---|
| Approach | Top-down | Bottom-up |
| Data Security | Data is exposed to the entire program | Data is hidden via encapsulation |
| Focus | Functions and logic | Objects and data |
| Code Reusability | Limited (via function calls) | High (via inheritance and polymorphism) |
| Complexity | Difficult to manage for large systems | Easier to manage via modularity |
In procedural languages like C, the program is divided into functions, and data moves freely between them. In OOP languages like Java, the program is organized into objects, which are instances of classes. This allows for features like inheritance, where new classes can derive properties from existing ones, and polymorphism, which allows objects to be treated as instances of their parent class, significantly improving maintainability and scalability.
What is the main purpose of Constructor? How to invoke a constructor in JAVA?
Answer
Sign in to view the complete answer paper.
Write a java program to illustrate the usage of conditional statements.
Answer
Sign in to view the complete answer paper.
Explain the creation of packages and accessing a package with sample program.
Answer
Sign in to view the complete answer paper.
Write the importance of abstract classes.
Answer
Sign in to view the complete answer paper.
Illustrate the use of super and final key words in java.
Answer
Sign in to view the complete answer paper.
Explain the benefits of inheritance.
Answer
Sign in to view the complete answer paper.
Explain nested try and final statements in exceptional handling.
Answer
Sign in to view the complete answer paper.
Demonstrate the definition and implementation of interface in java.
Answer
Sign in to view the complete answer paper.
Distinguish between checked and unchecked exceptions.
Answer
Sign in to view the complete answer paper.
Demonstrate Java program for array index out of bound and divide by zero exception.
Answer
Sign in to view the complete answer paper.
Explain the following Layout Managers: i) border layout ii) grid bag layout
Answer
Sign in to view the complete answer paper.
Write a short note on following: i) JFrame ii) Scroll Panes.
Answer
Sign in to view the complete answer paper.
Explain the life cycle of an applet.
Answer
Sign in to view the complete answer paper.
Write the differences between multi-threading and multitasking.
Answer
Sign in to view the complete answer paper.