JNTU
JNTU B.Tech II JAVA PROGRAMMING Previous Question Paper (August/September - 2022 - R13)
Answer any five questions. All questions carry equal marks.
Main
Explain Data abstraction, encapsulation and inheritance with suitable example.
Answer
Data Abstraction is the process of hiding implementation details and showing only the essential features of an object. In Java, this is achieved using abstract classes and interfaces. For example, a Shape abstract class defines a method draw(), while specific subclasses like Circle or Rectangle provide the actual implementation.
Encapsulation is the mechanism of wrapping data (variables) and code (methods) together as a single unit. It is achieved by declaring class variables as private and providing public getter and setter methods to access them, ensuring data security. For example, a Student class with a private rollNumber field accessed via getRollNumber().
Inheritance is a mechanism where a new class acquires the properties and behaviors of an existing class. It promotes code reusability. For example, a Manager class can extend an Employee class to inherit common attributes like name and id, while adding specific attributes like department.
Discuss different data types defined in Java.
Answer
Java defines two main categories of data types: Primitive and Non-Primitive.
Primitive Data Types are predefined by the language and hold single values:
byte: 8-bit signed integer.short: 16-bit signed integer.int: 32-bit signed integer.long: 64-bit signed integer.float: 32-bit single-precision floating-point.double: 64-bit double-precision floating-point.char: 16-bit Unicode character.boolean: Represents true or false.
Non-Primitive Data Types (or Reference Types) refer to objects and include Classes, Interfaces, and Arrays. These store memory addresses of objects rather than the actual data values.
Explain the following with example:
this keyword.
Answer
Sign in to view the complete answer paper.
garbage collection.
Answer
Sign in to view the complete answer paper.
Constructor.
Answer
Sign in to view the complete answer paper.
What is inheritance? Discuss different inheritance types.
Answer
Sign in to view the complete answer paper.
Does java support multiple inheritances? Justify your answer.
Answer
Sign in to view the complete answer paper.
Discuss member access rules.
Answer
Sign in to view the complete answer paper.
What is inner class? Discuss different inner classes.
Answer
Sign in to view the complete answer paper.
What is a package? Explain creating and accessing package with example.
Answer
Sign in to view the complete answer paper.
Explain checked exceptions and unchecked exceptions with example.
Answer
Sign in to view the complete answer paper.
Explain the usage of try, catch, throw, throws and finally keywords in exception.
Answer
Sign in to view the complete answer paper.
Explain different procedures for creating thread.
Answer
Sign in to view the complete answer paper.
Explain thread states and thread priorities.
Answer
Sign in to view the complete answer paper.
Explain different java collections in brief.
Answer
Sign in to view the complete answer paper.
Write a Java program to copy contents of one file to another.
Answer
Sign in to view the complete answer paper.
What is JDBC? Explain different JDBC drivers.
Answer
Sign in to view the complete answer paper.
Explain AWT class hierarchy.
Answer
Sign in to view the complete answer paper.
What is an Applet? Explain the life cycle of an Applet.
Answer
Sign in to view the complete answer paper.
Write a java program to pass parameters to an Applet.
Answer
Sign in to view the complete answer paper.