JNTU
JNTU B.Tech III JAVA PROGRAMMING Previous Question Paper (August/September - 2024 - R16)
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
Write the drawbacks of Arrays in Java.
Answer
The primary drawbacks of arrays in Java are as follows:
- Fixed Size: Arrays have a static size defined at the time of creation, making it impossible to increase or decrease their capacity dynamically during runtime.
- Homogeneous Data: Arrays can only store elements of the same data type, which limits their flexibility when handling diverse data structures.
- Memory Inefficiency: If the allocated size is larger than the actual number of elements stored, memory is wasted; conversely, if the array is full, resizing requires creating a new, larger array and copying all existing elements, which is computationally expensive.
What is Encapsulation? Explain.
Answer
Encapsulation is a fundamental principle of object-oriented programming that involves bundling data (variables) and the methods that operate on that data into a single unit, known as a class. It restricts direct access to some of an object's components, which is a technique used to prevent accidental interference and misuse of data.
Key aspects of encapsulation include:
- Data Hiding: By declaring class variables as private, the internal state of an object is hidden from the outside world.
- Controlled Access: Access to private data is provided through public getter and setter methods, allowing the class to validate or filter data before updating it.
- Maintainability: Encapsulation makes code easier to maintain and modify because the internal implementation details can be changed without affecting other parts of the program that use the class.
Where do you use Abstract classes?
Answer
Sign in to view the complete answer paper.
How the packages are created and accessed in Java? Explain.
Answer
Sign in to view the complete answer paper.
Differentiate Checked and Unchecked Exceptions.
Answer
Sign in to view the complete answer paper.
What is thread interruption in Java? List 3 methods in Java for interrupting a thread.
Answer
Sign in to view the complete answer paper.
What are Byte and Character Streams in Java?
Answer
Sign in to view the complete answer paper.
Write the uses of Scanner and String Tokenizer classes in Java.
Answer
Sign in to view the complete answer paper.
Explain Security issues with applets.
Answer
Sign in to view the complete answer paper.
What is Delegation Event Model?
Answer
Sign in to view the complete answer paper.
Part B
Write the usage of Break and Continue statements in loops.
Answer
Sign in to view the complete answer paper.
Write a Java program to find factorial of a given number.
Answer
Sign in to view the complete answer paper.
Write about various types of Constructors in Java.
Answer
Sign in to view the complete answer paper.
Write a Java program to implement an enum called "Direction" with constants representing the cardinal directions (North, South, East, West).
Answer
Sign in to view the complete answer paper.
How do you implement Multilevel and Hybrid Inheritance in Java? Give examples.
Answer
Sign in to view the complete answer paper.
Write a Java program to create a class known as "BankAccount" with methods called deposit() and withdraw(). Create a subclass called SavingsAccount that overrides the withdraw() method to prevent withdrawals if the account balance falls below five hundred.
Answer
Sign in to view the complete answer paper.
What are Static inner classes? Explain with an example.
Answer
Sign in to view the complete answer paper.
What is Dynamic binding? How to implement in Java? Explain.
Answer
Sign in to view the complete answer paper.
How to create and use User defined exceptions in Java? Explain in detail.
Answer
Sign in to view the complete answer paper.
Write a Java program that reads a list of numbers from a file and throws an exception if any of the numbers are negative.
Answer
Sign in to view the complete answer paper.
How thread priories impact the flow of multi-threading program execution in Java? Explain with a suitable example.
Answer
Sign in to view the complete answer paper.
Write a Java program that creates two threads to find and print even and odd numbers from 1 to 20.
Answer
Sign in to view the complete answer paper.
What is the use of Hash table? How to implement it in Java.
Answer
Sign in to view the complete answer paper.
What is Vector? How to create and access it in Java.
Answer
Sign in to view the complete answer paper.
Write the steps in connecting a database in Java.
Answer
Sign in to view the complete answer paper.
Write a Java program to find the longest word in a text file.
Answer
Sign in to view the complete answer paper.
Describe the relationship between Event sources and Listeners.
Answer
Sign in to view the complete answer paper.
Explain Mouse event handling process.
Answer
Sign in to view the complete answer paper.
Discuss the life Cycle of an Applet? What are the differences between applets and applications.
Answer
Sign in to view the complete answer paper.
Write the syntax for JLabel, JTextArea and JButton Swing components.
Answer
Sign in to view the complete answer paper.