OOP-I Question Bank
OOP-I Question Bank
(3140705)
Question Bank
Year: 2023-2024
Question Bank
Text Book: Y.Daniel Liang 10E Mark
s
4 Explain short circuited operators and shift operators. (June-11, May-13, June-14) 4
8 Draw and explain the process of building and running JAVA Program.(Dec-19) 7
15 Draw and explain the process of building and running JAVA Program (Dec-19) 7
18 List out and explain three main principles of object-oriented programming? (Dec-20) 4
2 Write a JAVA program to implement the Fibonacci series using for loop 7
control structure. (Nov-19)
5 Write a program that prompts the user to enter a three-digit integer and 7
determines whether it is a palindrome number. A number is palindrome if it
reads the same from right to left and from left to right
4 Write a problem is to read 100 numbers get the average of these numbers, and 7
find the number of the itemsgreater than the average. (Dec_15)
6 Write a program that creates and initializes a four integer element array. 7
Calculate and display the average of itsvalues (Dec_15)
12 Write a program which takes five numbers as command line argument from 4
user, store them in onedimensional array and display count of negative
numbers. (Nov 18)
13 When will you declare a method as a static? Explain static method with 3
suitable example (Nov-18)
14 Write a JAVA program to create a super class called figure that stores the 7
dimensions of a two- dimensional object. It also defines a method called area ()
that computes the area of an object. The program derives two sub classes from
figure. The first is rectangle and the second is Triangle. Each ofthese subclasses
overrides area (), so that it returns the area of a rectangle and a triangle
respectively. (Nov-19)
15 Describe the following methods related to String i) replace() ii) compareTo() (Nov-19) 3
1 Define time class with hour and minute. Also define addition method to add 7
two time objects.(Dec-15)
2 Differentiate the followings: (i) Constructor and method (Nov-11, May 18, Jan 13) 3
9 Explain constructor and finalizer with the help of example. (Dec-13, June-14) 7
11 With the help of program show how to pass object as an argument of method(Nov-17) 7
13 Write a program to create circle class with area function to find area of circle. (Dec-15) 7
21 Justify: 7
1. Why we declare main() method as public and static member.
2. Why we generally declare constructor as public member.
3. Why there is no destructor in java. (June 19)
22 Explain static keyword in detail using a sample program (Dec-19) 7
23 What is the purpose of ‘this’ and ‘static’ keyword? Write a java program 4
to explain this.(Dec-20)
3 Describe the following methods related to String i) replace() ii) compareTo() (Dec-19) 7
4 State whether any error exists in the following code. If so, correct the error 7
and give output. (Nov-11)
class Test {
public static void main(String args[])
{A a = new A();
a.print();
}}
Class A {
String s;
A(String s)
{
this.s=s;
}
public void print() {
System.out.println(s);}}
5 What are command line arguments? Write a java program which reads a line 3
03 from – command line and printsthat line in reverse.(Apr-17)
7 Write a program to find whether the given string is palindrome or not. (Nov-17) 7
8 Describe Inheritance and its type with suitable example. (May-18 ,May-16) 3
13 Explain following key words: this, super, instance of, static. .(Apr-17) 7
14 Declare a class called book having author_name as private data member. Extend 7
book class to have two sub classes called book_publication & paper_publication.
Each of these classes have private member called title. Write a complete program
to show usage of dynamic method dispatch (dynamic polymorphism) to display
book or paper publications of given author. Use command line arguments for
inputting data. . (May 13)
15 Write a JAVA program to create a super class called figure that stores the 7
dimensions of a two- dimensional object. It also defines a method called area () that
computes the area of an object. The program derives two subclasses from figure.
The first is rectangle and the second is Triangle. Each of these subclasses overrides
area (), so that it returns the area of a rectangle and a triangle respectively.(Dec-19)
16 The abstract vegetable class has three subclasses named Potato, Brinjal and 7
Tomato. Write a java program that demonstrates how to establish this class
hierarchy. Declare one instance variable of type String that indicates thecolor of a
vegetable. Crete and display instances of these objects. Override the toString()
method of object to return a string with the name of vegetable and its
color.(May-16)
21 Write an abstract class named Person and its two subclasses named Student and 7
Employee. A person hasa name, address, phone number, and email address. A
student has enrollment, course. An employee has an office, salary, and designation.
Define constructors and methods for input and display for both
classes. Write a main program to give demonstration of all.(May-19)
22 Explain Dynamic method dispatch with proper example. (Nov-17) (June 19) 7
23 Explain inner class with example.(Nov-18) 4
27 What is wrapper class? What is the use of wrapper class in Java? (Nov-18) 3
29 How package can be created in JAVA? Explain with suitable example. (Nov-19) 4
30 Differentiate between final, finally and finalize. What will happen if we make 7
class and method as final?
(June 19)
UNIT- 6 (Chapter 12,13) Exception Handling, I/O, abstract classes and interfaces CO3
14 Write a program that reads file name from user, through command line 3
argument and displays contentof the text file on console. (Dec-18)
(ii) The catch block is the preferred means for releasing resources to
prevent resource leaks.(F)
(iii) If capacity increment is not specified for Vector, the system will
double the size of Vector each timeadditional capacity is needed. (T)
(iv)An interface can extend an abstract class(F)
23 The abstract Vegetable class has three subclasses named Potato, Brinjal and Tomato. 7
Write an application that demonstrates how to establish this class hierarchy. Declare
one instance variable of type String that indicates the color of a vegetable. Create and
display
instances of these objects. Override the toString() method of Object to
return a string with the name of the vegetable and its color. . (Nov-11,
May-16)
24 Write an abstract class named Person and its two subclasses named student and 7
Employee. A person has a name, address, phone number and email address. A student
has enrolment course. An Employee has an office, salary, and designation. Define
constructors and methods for input and display for both classes. Define constructor
and
methods for input and display for both classes. Write a main program
to givedemonstration of all. (June-19)
29 Write an application that reads a file and counts the number of occurrences of 7
digit 5. Supply the filename as a command-line argument.(Dec-15)
30 Explain use of Interface with suitable example. (May-16)(Nov-16) 7
50 What is Stream Class? Explain input stream class and output stream class 7
in details. (Dec-19)
51 What is exception? List out and explain the keywords used to handle 7
e
x
c
e
p
t
i
o
n
s
.
(
D
e
c
2
0
)
55 What is runnable interface? How can you use this interface in creating thread?(Dec-20) 4
56 Write a java program to explain the use of File class and its methods.(Dec-20) 7
58 What are the wrapper classes? Explain the use of any one wrapper class (Dec-20) 3
3 What are the binding object types for int, long, float, double, and boolean? 3
12 What methods used to register handlers for key pressed, key released, and 7
key typed events? In which classesare these methods defined?
13 Explain Label and Button class and their methods in detail. (Dec-19) 7
field.
2 (Convert numbers) Write a program that converts between decimal, hex, and binary 7
numbers, as shown in Figure 16.37c. When you enter a decimal value in the
decimal value text field and press the Enter key, its corresponding hex and binary
numbers are displayed in the other two text fields. Likewise, you can enter values
in the other fields and convert them accordingly. (Hint: Use the Integer.parseInt(s,
radix) method to parse a string to a decimal and use Integer.toHexString(decimal)
and Integer.toBinaryString(decimal) to obtain a hex number or a binary number
from a
decimal.)
2 Write a program to read the content of a file into a character array and write 7
it into another file. Get names of thefiles from command line.
3 Write a program to create a file named example.dat if it does not exist. Append 7
new data to it if it already exists.Write 100 integers created randomly into the
file using
binary I/O.
UNIT- 10(Chapter 20) List, Stacks, Queues and Priority Queues CO4
3 Explain utility class ArrayList and Hashtable with example (May-13, Dec-15) 7
5 List the interfaces, abstract classes and concrete classes of collection hierarchy. 7
(Nov 11)
4 Write a program that counts the occurrences of words in a text and displays the 7
words and their occurrences inalphabetical order of the words. [hint: a TreeMap
to store an entry consisting of a word and its count]
UNIT- 12 Concurrency CO3
2 What are the methods to create thread? Write a multithreaded program to explain 7
the use of join() method. (May-17)
3 Explain Thread life cycle and describe creation of thread with suitable 7
example.(May 16)
4 What do you understand by thread? Describe the complete life cycle of thread. 4
(May 19)
6 What is multithreading? What are the ways in which you can create a 2
thread? Explain with Example. (Nov-18)
9 What are the different ways to create thread? Explain with example. (Nov-17) 7
15 What is a thread? Describe the complete life cycle of thread. (Nov-19) (Nov-19) 4
19 Write an application that creates and starts three threads. Each thread is 7
instantiated from the same class. It executes a loop with 10 iterations. Each
iteration displays string "HELLO", sleeps for 300 milliseconds.
Theapplication waits for all the threads to complete & displays the message
"Good Bye..." (Dec 13)
21 Write an application that executes two threads. One thread displays "Good 7
Morning" every 1000 milliseconds &another thread displays "Good Afternoon"
every 3000 milliseconds. Create the threads by implementing the Runnable
interface. (Dec-13, Nov 16, May-18)
24 Write a program to create two threads, one thread will check whether given 7
number is prime or not and secondthread will print prime numbers between 0 to
100. (May-18)
25 Write a program to create two thread one display alphabet from a to z and 7
other will display numbers from 1 to
100. (June-19)