JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA 2021 JAVA PROGRAMMING Previous Question Paper (July/August - 2021 - R13)

MCA | 2021 | III | R13 | July/August - 2021

Answer PaperPaper Code: 813AQMaximum Marks: 60Time: 3 Hours

Answer any five questions. All questions carry equal marks.

Main

1

What object oriented features are supported by Java language? Briefly explain with suitable code segments.

12 marks

Answer

Java is a robust object-oriented programming language that supports the four fundamental pillars of OOP, along with other essential features:

  1. Encapsulation: The mechanism of wrapping data (variables) and code (methods) together as a single unit. It restricts direct access to data using private access modifiers and provides public getter/setter methods.
    private int age; public void setAge(int a) { age = a; }
  2. Abstraction: The process of hiding complex implementation details and showing only the essential features of an object. This is achieved in Java using abstract classes and interfaces.
    abstract class Shape { abstract void draw(); }
  3. Inheritance: A mechanism where one class acquires the properties and behaviors of another class, promoting code reusability. Java supports single and multilevel inheritance through the extends keyword.
    class Animal { void eat() {} } class Dog extends Animal {}
  4. Polymorphism: The ability of an object to take on many forms. Java supports compile-time polymorphism (method overloading) and runtime polymorphism (method overriding).
    // Overriding example: class Parent { void show() {} } class Child extends Parent { void show() {} }

Additionally, Java supports Classes and Objects as the basic building blocks, and Interfaces to achieve multiple inheritance of type, which is not supported through classes.

212 marks
a

Write a program to demonstrate constructor overloading.

7 marks

Answer

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

class Box {
    double width, height, depth;
    Box() {
        width = height = depth = 0;
    }
    Box(double len) {
        width = height = depth = len;
    }
    Box(double w, double h, double d) {
        width = w;
        height = h;
        depth = d;
    }
}
public class Main {
    public static void main(String[] args) {
        Box b1 = new Box();
        Box b2 = new Box(10);
        Box b3 = new Box(10, 20, 30);
    }
}
b

Differentiate between Abstract classes and interfaces.

5 marks

Answer

Sign in to view the complete answer paper.

3

What is inheritance? What are the costs of inheritance? Explain hierarchical and multi-level inheritance.

12 marks

Answer

Sign in to view the complete answer paper.

412 marks
a

Is every nested class an inner class? Justify your answer.

6 marks

Answer

Sign in to view the complete answer paper.

b

What is the role of CLASSPATH variable for package usage?

6 marks

Answer

Sign in to view the complete answer paper.

512 marks
a

Write a program to append a file content to another file, read the two file names as command line arguments.

7 marks

Answer

Sign in to view the complete answer paper.

b

What is the need of string Tokenizer?

5 marks

Answer

Sign in to view the complete answer paper.

6

What is the support provided by Java for network programming through java.net package? Give an the overview.

12 marks

Answer

Sign in to view the complete answer paper.

7

How can a user define his/her own exception? Write a program to explain handling such exception.

12 marks

Answer

Sign in to view the complete answer paper.

8

What is an event? List various types of events and respective sources of events in event handling.

12 marks

Answer

Sign in to view the complete answer paper.

About this paper

This page contains the question paper of JAVA PROGRAMMING from JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD for MCA 2021 III, July/August - 2021, R13.

For the solved question paper with answers, switch to the Answer Paper tab.

Other papers in JAVA PROGRAMMING

Loading Question Papers

Fetching data from database...