Question Bank
Question Bank
QUESTION BANK
Sem: 3rd Semester
Branch: CSE, CSE-AI, CSE-DS, CST, CSIT
Sub: Object Oriented Programing using JAVA
PART-I
Unit-1 Mark BL CO PO
1) What gives java its “write once , run anywhere ” nature ? 2
2) Give an example of operator overloading in java 2
3) Pointers are eliminated from java because ________. 2
a) Pointer lead to confusion for a programmer
b) Pointers may crash a program easily
c)Pointers break security
d) All of the above
4) Assume double[][] x=new double[4][5], what are x.length and x[2].length ? 2
5) What are the default values for data field of a boolean type and object type? 2
6) What do you mean my portability of a program? Is java language portable? If 2
yes, Justify your answer.
7) Define Wrapper class. 2
8) Write the condition in which OUTPUT will be ELSE ? Justify your answer 2
public void foo( boolean a, boolean b)
{
if( a )
{
System.out.println("A"); /* Line 5 */
}
else if(a && b) /* Line 7 */
{
System.out.println( "A && B");
}
else /* Line 11 */
{
if ( !b )
{
System.out.println( "notB") ;
}
else
{
System.out.println( "ELSE" ) ;
}
}
}
Unit-3
1) Define an interface? 2
2) What is Abstraction in Java? 2
3) Write difference between String and StringBuffer. 2
4) Explain about Public and Private access specifiers. 2
5) What are the types of Exceptions? 2
6) Why abstract class has constructor even though you cannot create object? 2
7) Can I import the same package/class twice? Will the JVM load the package twice 2
at runtime?
8) What are the practical benefits, if any, of importing a specific class rather than 2
an entire package (e.g. import Java.net.* versus import Java.net.Socket) ?
9) Can a source file contain more than one class declaration? 2
10) What are the ways to compare string? 2
Unit-4
1) What is multithreading? 2
2) What are advantages of multithreading programming. 2
3) What is thread synchronization? 2
4) Write differences between sleep () and wait() methods . 2
5) Explain setPriority() and getPriotity() methods of Thread class. 2
6) Name the exception raised while invoking sleep() method. 2
7) What are the standard streams are available in Java? 2
8) What do you mean by Byte stream? Write name of two classes that support byte 2
stream.
9) What do you know by Character stream in Java? Write the name of two classes 2
that supports Character stream.
10) What do know by serialization in Java.
Unit-5 2
1) What is an applet program? 2
2) What is the difference between an Applet and a Java Application? 2
3) What is an event in java? 2
4) Explain Button class with example. 2
5) What is the use of paint() method in awt? 2
6) What is the need of Adapter classes for event handling? 2
7) What is the difference between TextField and TextArea components? 2
PART-II
Unit-1 Mark BL PO CO
1) Write a program in java to take an array and calculate sum of even and 4
multiplication of odd numbers in the array.
2) What is type casting ? Explain different types of type casting with 4
example .
3) Briefly explain various features of java. 4
4) Write a java program to print prime number up to 50. 4
5) Write program to swap value of two variables by accepting them using 4
Scanner class.
6) Write java program to input a temperature in Fahrenheit and convert it to 4
Celsius using the following conversion formula. C=(F-32)/1.8.
7) Write a java program to create and display a unit matrix of size 4. 4
Unit-2
1) Create a class for product with private instance variablesproduct_id,name,price. 4
Create two product objects. Using parameterized constructor initialize the
instance variables and display them using another method.
2) Write a program to differentiate the feature of static variable and instance 4
variable.
3) Create an object for complex numbers with real and imaginary part. Using 4
separate methods initialize and display the complex objects. Define another
method to perform the addition of two complex numbers and will return the
result complex object.
4) What is method overriding? Explain with a program. 4
Unit-3
1) Difference between Abstract class and Interface. 4
3) Write an applet program to display your name, branch and roll number 4
in applet window.
4) What do you know by wrapper class in java? Write the name of all 4
wrapper classes corresponding to all primitive types.
5) Explain the event delegation model used in java for event handling. 4
PART-III
Unit-1 Mark BL PO CO
1) a) a) Write a program to input 10 integers into an array and print the second 10
highest number ?
b) b) Write a program to reverse an input number and check whether or not
it is a palindrome ( The number is same as its reverse )
2) a) a) Write a program to print the sum of the following series. 10
4) a) What is super keyword and why it is used? Write a java program to find out 10
cost, weight and volume of a box using multilevel inheritance and use
super keyword at proper places?
b) Write a program in Java to read a file and count the number of occurrence of
digit 5. Supply the file name as command line argument.
Unit-3
1) a) What is the difference between exception and error? 10
b) Explain try, catch, throw, throws and finally keyword with example?
Unit-5
1) Explain the life cycle of an applet with state – transition diagram. Also 10
discuss all 5 methods responsible for maintaining life cycle of an applet.