JNTU
JNTU B.Tech IV Year JAVA PROGRAMMING Previous Question Paper (January/February - 2023 - R18)
Part A is compulsory (25 Marks). Answer all questions. In Part B, answer any one question from each unit (50 Marks). Each question in Part B carries 10 marks.
Part A
Differentiate between class and object.
Answer
A class is a user-defined blueprint or template that defines the properties (fields) and behaviors (methods) common to all objects of a certain type; it does not occupy memory when defined. An object is an instance of a class that represents a real-world entity, created at runtime using the new keyword, and it occupies memory to store its specific state.
What is recursion? Give example?
Answer
Recursion is a programming technique where a method calls itself to solve a problem by breaking it down into smaller, self-similar sub-problems. Every recursive method must have a base case to terminate the execution and a recursive step that moves the state closer to the base case to avoid infinite loops.
Example: Calculating the factorial of a number.
public int factorial(int n) {
if (n == 0 || n == 1) {
return 1; // Base case
}
return n * factorial(n - 1); // Recursive step
}What is the importance of base class object?
Answer
Sign in to view the complete answer paper.
Mention the significance of CLASSPATH environmental variable in packages.
Answer
Sign in to view the complete answer paper.
Differentiate between throw and throws keywords.
Answer
Sign in to view the complete answer paper.
Distinguish among String, StringBuffer, and StringBuilder classes.
Answer
Sign in to view the complete answer paper.
What is the range of values for thread priority and what is its significance?
Answer
Sign in to view the complete answer paper.
What is event source? Give examples of event sources?
Answer
Sign in to view the complete answer paper.
Compare and contrast between application and applet.
Answer
Sign in to view the complete answer paper.
Discuss the sequence of methods called while destroying an applet.
Answer
Sign in to view the complete answer paper.
Part B
Demonstrate nested class with a program.
Answer
Sign in to view the complete answer paper.
Develop a program that shows the binary equivalent of a given positive number from 0 to 255?
Answer
Sign in to view the complete answer paper.
Develop a Java Program to make frequency count of words in a given text.
Answer
Sign in to view the complete answer paper.
Explain parameter passing to functions in Java.
Answer
Sign in to view the complete answer paper.
What are the uses of super keyword, describe?
Answer
Sign in to view the complete answer paper.
Design a class that implements an interface that extends from another interface.
Answer
Sign in to view the complete answer paper.
Why do we need packages? How to create and import packages?
Answer
Sign in to view the complete answer paper.
Describe final class in inheritance.
Answer
Sign in to view the complete answer paper.
Describe the various string comparison methods.
Answer
Sign in to view the complete answer paper.
Elaborate on collection interfaces in java.uitl package.
Answer
Sign in to view the complete answer paper.
Describe the constructors of String class.
Answer
Sign in to view the complete answer paper.
Write a program to catch Negative Array Size Exception. This exception is caused when the array size is initialized to negative values.
Answer
Sign in to view the complete answer paper.
Describe any four Event Classes with its constructors in java.awt.event.
Answer
Sign in to view the complete answer paper.
Develop GUI application using lists that allow multiple selections and add action listener.
Answer
Sign in to view the complete answer paper.
Mention the commonly used listener interfaces and their implemented adapter classes?
Answer
Sign in to view the complete answer paper.
Develop a GUI application using canvas.
Answer
Sign in to view the complete answer paper.
What are different states of a thread, explain?
Answer
Sign in to view the complete answer paper.
Develop an applet that receives an integer in one text field and compute its factorial value in another text field, when the button named ‘Compute” is clicked.
Answer
Sign in to view the complete answer paper.
What is thread synchronization? Demonstrate the different ways to synchronize threads with programs.
Answer
Sign in to view the complete answer paper.