JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech II Year OBJECT ORIENTED PROGRAMMING THROUGH JAVA Previous Question Paper (April/May - 2018 - R16)
Part A is compulsory which carries 25 marks. Answer all questions in Part A. Part B consists of 5 Units. Answer any one full question from each unit. Each question carries 10 marks and may have a, b, c as sub questions.
Part A
What is abstract class? Give example.
Answer
An abstract class is a class declared with the abstract keyword that cannot be instantiated. It is designed to be a base class for subclasses and may contain a mix of abstract methods (methods without a body) and concrete methods (methods with implementation). Any class extending an abstract class must provide implementations for all its abstract methods, unless the subclass itself is also declared abstract.
Example:
abstract class Animal {
abstract void makeSound();
void sleep() {
System.out.println("Sleeping...");
}
}
class Dog extends Animal {
void makeSound() {
System.out.println("Bark");
}
}Explain the use of ‘for’ statement in Java with an example.
Answer
The for statement in Java is a control flow construct used for iterative execution of a block of code. It is most effective when the number of iterations is known in advance. The syntax consists of three parts: initialization, condition, and update.
The initialization sets the starting point, the condition is checked before each iteration, and the update modifies the loop variable after each cycle. The following example prints the numbers 1 through 5:
for (int i = 1; i <= 5; i++) { System.out.println(i); }Define a Package? What is its use in java? Explain.
Answer
Sign in to view the complete answer paper.
List out the benefits of Stream oriented I/O.
Answer
Sign in to view the complete answer paper.
How do we start and stop a thread?
Answer
Sign in to view the complete answer paper.
Write the complete life cycle of a thread.
Answer
Sign in to view the complete answer paper.
What is the benefit of Generics in Collections Framework?
Answer
Sign in to view the complete answer paper.
Differentiate between Enumeration and Iterator interface.
Answer
Sign in to view the complete answer paper.
What are the limitations of AWT?
Answer
Sign in to view the complete answer paper.
Why do applet classes need to be declared as public?
Answer
Sign in to view the complete answer paper.
Part B
What is inheritance and how does it help to create new classes quickly.
Answer
Sign in to view the complete answer paper.
Describe different levels of access protection available in Java.
Answer
Sign in to view the complete answer paper.
List the primitive data types available in Java and explain.
Answer
Sign in to view the complete answer paper.
What is polymorphism? Explain different types of polymorphisms with examples.
Answer
Sign in to view the complete answer paper.
What is an interface? What are the similarities between interfaces and classes?
Answer
Sign in to view the complete answer paper.
How can you extend one interface by the other interface? Discuss.
Answer
Sign in to view the complete answer paper.
Discuss about CLASSPATH environment variables.
Answer
Sign in to view the complete answer paper.
Discuss the different levels of access protection available in Java.
Answer
Sign in to view the complete answer paper.
What are advantages of using Exception handling mechanism in a program?
Answer
Sign in to view the complete answer paper.
Write a java program that demonstrates how certain exception types are not allowed to be thrown.
Answer
Sign in to view the complete answer paper.
What are the different ways that are possible to create multiple threaded programs in java? Discuss the differences between them.
Answer
Sign in to view the complete answer paper.
Write a program to create four threads using Runnable interface.
Answer
Sign in to view the complete answer paper.
What is Java Collections Framework? List out some benefits of Collections framework and explain.
Answer
Sign in to view the complete answer paper.
What is the importance of hashCode() and equals() methods?
Answer
Sign in to view the complete answer paper.
What are the common algorithms implemented in Collections Framework? Discuss.
Answer
Sign in to view the complete answer paper.
What is difference between ArrayList and LinkedList in collection framework? Explain.
Answer
Sign in to view the complete answer paper.
What is an applet? Explain the life cycle of Applet with a neat sketch.
Answer
Sign in to view the complete answer paper.
Write the applets to draw the Cube and Cylinder shapes.
Answer
Sign in to view the complete answer paper.
What is an Layout manager? Explain different types of Layout managers.
Answer
Sign in to view the complete answer paper.
Write a program to create a frame window that responds to key strokes.
Answer
Sign in to view the complete answer paper.