JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD B.Tech III OBJECT ORIENTED PROGRAMMING THROUGH JAVA Previous Question Paper (August - 2022 - R18)

B.Tech | III | II | R18 | August - 2022

Answer PaperPaper Code: 156CCMaximum Marks: 75Time: 3 Hours

Answer any five questions

All questions carry equal marks

Main

115 marks
a

What is the need of object oriented paradigm?

7 marks

Answer

The object-oriented paradigm was developed to overcome the limitations of procedural programming, specifically regarding code complexity, maintenance, and scalability. As software systems grew in size, procedural approaches led to "spaghetti code" where data and functions were loosely coupled, making debugging and modification difficult.

Key reasons for the need for the object-oriented paradigm include:

  • Encapsulation: It binds data and the methods that operate on that data into a single unit (class), protecting the internal state from unauthorized access.
  • Reusability: Through inheritance, existing code can be extended or reused in new classes, reducing redundancy and development time.
  • Maintainability: Modular design allows developers to update or fix specific components without affecting the entire system.
  • Abstraction: It allows developers to hide complex implementation details and expose only the necessary functionality, simplifying the interaction with objects.
  • Polymorphism: It provides the ability for objects to take on multiple forms, allowing a single interface to represent different underlying types, which enhances flexibility in system design.
b

Write a program to demonstrate constructor overloading in Java.

8 marks

Answer

Constructor overloading in Java allows a class to have multiple constructors with different parameter lists. The compiler distinguishes between them based on the number and type of arguments passed during object creation.

class Student {
    String name;
    int age;

    // Constructor with no arguments
    Student() {
        name = "Unknown";
        age = 0;
    }

    // Constructor with one argument
    Student(String n) {
        name = n;
    }

    // Constructor with two arguments
    Student(String n, int a) {
        name = n;
        age = a;
    }

    void display() {
        System.out.println("Name: " + name + ", Age: " + age);
    }
}

public class ConstructorDemo {
    public static void main(String[] args) {
        Student s1 = new Student();
        Student s2 = new Student("Alice");
        Student s3 = new Student("Bob", 20);

        s1.display();
        s2.display();
        s3.display();
    }
}
215 marks
a

What is byte code? How does it differ from source code, object code?

5 marks

Answer

Sign in to view the complete answer paper.

b

Illustrate the use of ‘this’ keyword.

5 marks

Answer

Sign in to view the complete answer paper.

c

List the frequently used methods of String class.

5 marks

Answer

Sign in to view the complete answer paper.

315 marks
a

What is inheritance? Discuss the benefits and costs of inheritance.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write a program to implement multi-level inheritance.

8 marks

Answer

Sign in to view the complete answer paper.

415 marks
a

Demonstrate dynamic method dispatch concept in Java.

5 marks

Answer

Sign in to view the complete answer paper.

b

Compare BufferedInput stream with DataInput stream.

5 marks

Answer

Sign in to view the complete answer paper.

c

How to define an interface? Give an example.

5 marks

Answer

Sign in to view the complete answer paper.

515 marks
a

What are the five keywords used in Java exception handling? With suitable code snippets explain their usage.

8 marks

Answer

Sign in to view the complete answer paper.

b

Write a program to read date of birth from user and display the age of the user.

7 marks

Answer

Sign in to view the complete answer paper.

615 marks
a

How to create threads in Java? Illustrate with an example.

7 marks

Answer

Sign in to view the complete answer paper.

b

Write a program to solve producer-consumer problem using threads.

8 marks

Answer

Sign in to view the complete answer paper.

715 marks
a

Describe delegation event model.

7 marks

Answer

Sign in to view the complete answer paper.

b

What is a layout manager? Discuss different types of layout manager.

8 marks

Answer

Sign in to view the complete answer paper.

815 marks
a

Write code to create an Applet drawing a smiley face using graphics class.

8 marks

Answer

Sign in to view the complete answer paper.

b

Explain model-view-controller architecture for application development.

7 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the solved question paper with answers of OBJECT ORIENTED PROGRAMMING THROUGH JAVA from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for B.Tech ECE III II, August - 2022, R18.

For the question paper without answers, switch to the Question Paper tab.

Other papers in OBJECT ORIENTED PROGRAMMING THROUGH JAVA

Loading Question Papers

Fetching data from database...