Jawaharlal Nehru Technological University Hyderabad
Jawaharlal Nehru Technological University Hyderabad B.Tech III JAVA PROGRAMMING Previous Question Paper (August - 2022 - R16)
Answer any five questions. All questions carry equal marks.
Main
What is type conversion and casting? Explain with an example.
Answer
Type conversion in Java is the process of converting a value from one data type to another. It is categorized into two types: Widening and Narrowing.
Widening Casting (Implicit): This occurs automatically when a smaller data type is converted into a larger data type. It is safe because there is no loss of data.
Narrowing Casting (Explicit): This must be done manually by placing the target type in parentheses in front of the value. It is necessary when converting a larger data type to a smaller one, which may result in data loss.
Write a java program to display all the odd numbers between 1 to 30 using ‘for’ loop and ‘if’ statement.
Answer
The following Java program iterates from 1 to 30 and uses an if statement to check for odd numbers by verifying if the remainder is non-zero when divided by 2.
public class OddNumbers {
public static void main(String[] args) {
for (int i = 1; i <= 30; i++) {
if (i % 2 != 0) {
System.out.print(i + " ");
}
}
}
}Discuss about the method overloading and constructor overloading with an example.
Answer
Sign in to view the complete answer paper.
Write a Java program to implement multilevel inheritance concept.
Answer
Sign in to view the complete answer paper.
Give the differences between an Abstract class and an Interface.
Answer
Sign in to view the complete answer paper.
Explain the following:
Final classes and methods
Answer
Sign in to view the complete answer paper.
Anonymous inner classes.
Answer
Sign in to view the complete answer paper.
What is an exception? Explain how an exception can be handled in Java? And also list the benefits of Exception Handling.
Answer
Sign in to view the complete answer paper.
Demonstrate nested ‘try’ statements with an example program in Java.
Answer
Sign in to view the complete answer paper.
Describe the complete life cycle of a thread.
Answer
Sign in to view the complete answer paper.
What are the differences between multiprocessing and multithreading? State the advantages of multithreading.
Answer
Sign in to view the complete answer paper.
Give an overview of Java collection framework.
Answer
Sign in to view the complete answer paper.
Demonstrate about stack class with an example.
Answer
Sign in to view the complete answer paper.
Explain the phases in the life cycle of an Applet.
Answer
Sign in to view the complete answer paper.
Write down the differences between Applets and applications.
Answer
Sign in to view the complete answer paper.