JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA JAVA PROGRAMMING Previous Question Paper (March/April - 2022 - R13)
Answer any five questions. All questions carry equal marks.
Main
Explain constructor overloading with an example.
Answer
Constructor overloading is a technique in Java that allows a class to have multiple constructors with different parameter lists. The compiler differentiates these constructors based on the number, type, and order of the parameters provided during object creation. This provides flexibility in initializing objects with different sets of data.
Example:
class Student {
String name;
int age;
// Constructor with no arguments
Student() {
name = "Unknown";
age = 0;
}
// Constructor with two arguments
Student(String n, int a) {
name = n;
age = a;
}
}What is auto boxing in java? Explain with an example.
Answer
Autoboxing is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper classes (e.g., converting an int to an Integer). This process simplifies code by allowing developers to use primitive values where an object is expected, such as in collections.
Example:
// Autoboxing: primitive int assigned to Integer object
Integer num = 10;
// Using in a collection
java.util.ArrayList<Integer> list = new java.util.ArrayList<>();
list.add(25); // The primitive 25 is automatically boxed into an Integer objectDiscuss about polymorphism with an example program.
Answer
Sign in to view the complete answer paper.
Write a program that reads an integer between 0 and 1000 and adds all the digits in the integer. For example, if an integer is 632, the sum of all its digits is 11.
Answer
Sign in to view the complete answer paper.
Give a brief summary on inheritance with examples.
Answer
Sign in to view the complete answer paper.
Describe the various forms of implementing interfaces.
Answer
Sign in to view the complete answer paper.
Explain how to create, access and import packages with an example program.
Answer
Sign in to view the complete answer paper.
Discuss the methods available in the Character Streams.
Answer
Sign in to view the complete answer paper.
What is difference between Array List and Linked List in collection framework?
Answer
Sign in to view the complete answer paper.
Write a program to read a file content and extract words using String Tokenizer class.
Answer
Sign in to view the complete answer paper.
How a hash table can change the iterator? Explain.
Answer
Sign in to view the complete answer paper.
Differentiate between checked exceptions and unchecked exceptions with examples.
Answer
Sign in to view the complete answer paper.
Write a java program to illustrate the usage of try and catch blocks.
Answer
Sign in to view the complete answer paper.
Write a Java program for keyboard events.
Answer
Sign in to view the complete answer paper.
Differentiate between applets and applications.
Answer
Sign in to view the complete answer paper.