JNTU
JNTU B.Tech IV JAVA PROGRAMMING Previous Question Paper (February/March-2022 - R18)
Answer any Five Questions
All Questions Carry Equal Marks
Main
Explain the features of object oriented programming.
Answer
Object-Oriented Programming (OOP) is a paradigm based on the concept of objects, which contain data and code. Its primary features include:
- Classes and Objects: A class is a blueprint for creating objects, while an object is an instance of a class that encapsulates state and behavior.
- Encapsulation: The bundling of data (variables) and methods that operate on the data into a single unit, restricting direct access to some components to protect internal state.
- Abstraction: Hiding complex implementation details and showing only the necessary features of an object to the user.
- Inheritance: A mechanism where a new class derives properties and behaviors from an existing class, promoting code reusability.
- Polymorphism: The ability of an object or method to take on multiple forms, typically achieved through method overloading (compile-time) and method overriding (runtime).
Write an example program to describe the concept of constructors.
Answer
A constructor is a special member method that is invoked automatically when an object of a class is created. It has the same name as the class and no return type.
class Student {
String name;
int id;
// Default Constructor
Student() {
name = "Unknown";
id = 0;
}
// Parameterized Constructor
Student(String n, int i) {
name = n;
id = i;
}
void display() {
System.out.println("Name: " + name + ", ID: " + id);
}
}
public class Main {
public static void main(String[] args) {
Student s1 = new Student();
Student s2 = new Student("Alice", 101);
s1.display();
s2.display();
}
}Compare procedural languages with object oriented languages.
Answer
Sign in to view the complete answer paper.
Write a java program that implements binary search operation.
Answer
Sign in to view the complete answer paper.
Describe the usage of super keyword with suitable program segments.
Answer
Sign in to view the complete answer paper.
Can inheritance be applicable to interfaces? Justify your answer with suitable java program.
Answer
Sign in to view the complete answer paper.
Explain the process of creating and importing a package with suitable examples.
Answer
Sign in to view the complete answer paper.
Write a java program to implement multilevel inheritance.
Answer
Sign in to view the complete answer paper.
Define thread. Explain how threads can be created by extending Thread class.
Answer
Sign in to view the complete answer paper.
Write a java program to implement producer-consumer problem using the concept of inter thread communication.
Answer
Sign in to view the complete answer paper.
List and explain the different built in exceptions with examples for each.
Answer
Sign in to view the complete answer paper.
Explain the concept of exceptions in java with example.
Answer
Sign in to view the complete answer paper.
What are events in java? Write a program for keyboard event.
Answer
Sign in to view the complete answer paper.
Discuss about the significance of GridLayout manager in java using an example.
Answer
Sign in to view the complete answer paper.
Explain different stages in the life cycle of an applet.
Answer
Sign in to view the complete answer paper.
Why Multithreading is used? Explain briefly about Multithreading with an example.
Answer
Sign in to view the complete answer paper.