JNTU
JNTU B.Tech II OBJECT ORIENTED PROGRAMMING THROUGH JAVA Previous Question Paper (October - 2020 - R16)
Answer any five questions. All questions carry equal marks.
Main
What are the primitive data types available in Java? Explain.
Answer
Java provides eight primitive data types, which are the basic building blocks for data manipulation. These are categorized as follows:
- byte: 8-bit signed integer, range -128 to 127.
- short: 16-bit signed integer, range -32,768 to 32,767.
- int: 32-bit signed integer, the default choice for integer values.
- long: 64-bit signed integer, used when a wider range than int is required.
- float: 32-bit IEEE 754 floating-point, used for decimal values requiring less precision.
- double: 64-bit IEEE 754 floating-point, the default choice for decimal values.
- char: 16-bit Unicode character, range '\u0000' to '\uffff'.
- boolean: Represents one bit of information, having only two possible values: true or false.
What is composition in Java? How is it different from inheritance?
Answer
Composition is a design technique in Java where a class contains an instance of another class as a member variable. It represents a 'has-a' relationship, implying that the contained object is part of the container object.
The primary differences between composition and inheritance are:
| Feature | Composition | Inheritance |
|---|---|---|
| Relationship | Has-a | Is-a |
| Coupling | Low coupling; objects are independent. | High coupling; child depends on parent. |
| Flexibility | Highly flexible; components can be changed at runtime. | Less flexible; hierarchy is fixed at compile time. |
| Access | Accesses features via object reference. | Inherits members directly from the superclass. |
Composition is generally preferred over inheritance to achieve code reuse because it allows for greater encapsulation and avoids the rigid constraints of deep inheritance hierarchies.
Write a detailed note on Java Virtual Machine.
Answer
Sign in to view the complete answer paper.
What is meant by data abstraction? Briefly explain.
Answer
Sign in to view the complete answer paper.
Discuss the similarities between interfaces and classes.
Answer
Sign in to view the complete answer paper.
How to design and implement an interface? Explain.
Answer
Sign in to view the complete answer paper.
Write a Java program to show the use of File Input Stream.
Answer
Sign in to view the complete answer paper.
Discuss about File Output Stream with an example.
Answer
Sign in to view the complete answer paper.
What is an Exception? How is an Exception handled in JAVA? Give example.
Answer
Sign in to view the complete answer paper.
Distinguish between thread based and process based multitasking.
Answer
Sign in to view the complete answer paper.
Explain the thread based preemptive multitasking with example.
Answer
Sign in to view the complete answer paper.
Write about built-in exceptions in java.
Answer
Sign in to view the complete answer paper.
Give overview of collections framework.
Answer
Sign in to view the complete answer paper.
Explain Date and Scanner classes in detail.
Answer
Sign in to view the complete answer paper.
Explain the process of passing parameters to Applets.
Answer
Sign in to view the complete answer paper.
Write a program to implement the keyboard events in Java.
Answer
Sign in to view the complete answer paper.