0% found this document useful (0 votes)
6 views

Java second internals question bank

The document is a question bank for a Java programming course, covering various topics such as static members, method overloading, inheritance, constructors, access specifiers, and polymorphism. It includes programming tasks and theoretical questions that require explanations and code snippets. The questions are designed to assess understanding of core Java concepts and object-oriented programming principles.

Uploaded by

faraazahmed2708
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Java second internals question bank

The document is a question bank for a Java programming course, covering various topics such as static members, method overloading, inheritance, constructors, access specifiers, and polymorphism. It includes programming tasks and theoretical questions that require explanations and code snippets. The questions are designed to assess understanding of core Java concepts and object-oriented programming principles.

Uploaded by

faraazahmed2708
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Question Bank(Second internals):

1 Briefly explain static members of the class with suitable examples.(2)


2 Discuss method overloading. Write a program to overload a method area() to
compute area of a triangle and a circle.(2)
3 What are various access specifiers in Java with example and List out the
behaviour of each of them.(2)

4 What is inheritance? Discuss different types of inheritance with suitable


example.(3)

5 Discuss the behavior of constructors when there is a multilevel inheritance.


Give appropriate code to illustrate the process.(3)

6 Mention and explain the uses of super keyword in Java with example(3)

7 How do you pass arguments to superclass constructor through the subclass


constructor? Explain with a code snippet.(2)

8 Discuss usage of final keyword in Java. Give suitable examples.(2)

9 What do you mean by method overriding? Discuss with a programming


example.(3)

10 Explain abstract class and abstract method with suitable code snippet. (3)

11 Demonstrate dynamic dispatch using abstract class in– JAVA. (3)

12 Demonstrate the working of interface in JAVA. (3)

13 Write a note on: a. Extend keyword. b. Implement keyword. c. Private


interface methods d. Object Class e. Dynamic Method Dispatch (3)

14 Give the Comparision between abstract class and interface with programming
example?(3)
15 Differentiate between method overloading and method overriding with
example?(3)

16 Define a package . Explain the uses of package with example.(4)

17 Create an abstract class called Employee. Include the members: Name, EmpID
and an abstract method cal_sal(). Create two inherited classes SoftwareEng
(with the members basic and DA) and HardwareEng (with members basic and
TA). Implement runtime polymorphism (dynamic method dispatch) to display
salary of different employees by creating array of references to superclass.(3)

18 Develop a JAVA program to create a class named shape. Create three sub
classes
namely: circle, triangle and square, each class has two member functions
named draw () and erase (). Demonstrate polymorphism concepts by developing
suitable methods, defining member data and main program.(3)

19 Develop a JAVA program to create an abstract class Shape with abstract


methods
calculateArea() and calculatePerimeter(). Create subclasses Circle and
Triangle that extend the Shape class and implement the respective methods to
calculate the area and
perimeter of each shape.(3)

20. Develop a JAVA program to create an interface Resizable with methods


resizeWidth(int width) and resizeHeight(int height) that allow an object to be
resizeCreate a class Rectangle that implements the Resizable interface and
implements the resize methods.(3)

21. Demonstrate default interface methods with an example?(3)

22. Define recursion with example(2)?

23. With suitable example, demonstrate the working principle of Nested and inner
class?(2)

24. With suitable example, demonstrate how to pass an object as parameter? (2)
25. Show how to return an object in java with suitable example?(2)

26. Write a program to illustrate method overloading.


public void sub()-subtracts two integer values
public void sub(int a,int b)-subtracts two integer values
public void sub(double d1,double d2)-subtracts 2 double values
public void sub(int a)-decrements the value by 10
27. Create a class by name Person . Let it have the following data
Id. Name, Age
Create a class by name Student Let it extend the Person class.It should have the
following data:
rollno , avg, college
Let both the classes have the display() method to display the information
28. Explain the concept of parent child relationship with example.
29. Create a abstract class by name DistanceConvertor.Let it have the distance in
metres and the display method to display the value of metres. Let it have an ab-
stract method
public abstract void convert();
Create another class KMConvertor which inherits the DistanceConvertor class and
provides implementation for the convert() method-Metres to kilometres
Create another class MilesConvertor which inherits the DistanceConvertor class
and provides implementation for the convert() method-metres to miles
30. Write a program to create an interface by name Shape
Let it have the following methods
void area()
void volume()
Create a class by name Cylinder which implements the Shape interface
31. Develop a JAVA program to create a package named mypack and import and
implement it in a suitable class(4)

You might also like