CS/MCA(A)/EVEN/SEM-2/2520/2022-2023/I040
MAULANA ABUL KALAM AZAD UNIVERSITY OF TECHNOLOGY, WEST BENGAL
Paper Code : MCAN-203 Object Oriented Programming with JAVA
UPID : 002520
Time Allotted : 3 Hours Full Marks :70
The Figures in the margin indicate full marks.
Candidate are required to give their answers in their own words as far as practicable
Group-A (Very Short Answer Type Question)
1. Answer any ten of the following : [ 1 x 10 = 10 ]
(I) Give an example of an Unchecked exception.
(II) Which is a special program that is embedded in the webpage to generate the dynamic content?
(III) Name the class used to represent a GUI application window, which is optionally resizable and can have a title
bar, an icon, and menus.
(IV) What is the purpose of J2SE?
(V) What is an exception in Java Application?
(VI) Which of the function is called to display the output of an applet?
(VII) Which is a component in AWT that can contain another component like buttons, text fields, labels etc.?
(VIII) Consider the following code
StringBuffer buff = new StringBuffer();
System.out.println("Buffer size = "+buff.length());
System.out.println("Buffer capacity = "+buff.capacity());
What is the difference between the length of StringBuffer and the capacity of String Buffer?
(IX) How to initialize the final variable?
(X) Which of the exception is thrown by close() and read() methods?
(XI) “If you want to have only one piece of storage for a particular piece of data, regardless of how many objects are
created, or even if no objects are created. “—Consider the statement and then specify what type of modifier
can be associated with the variable.
(XII) What will be the output of the following code?
public class Base {
public void f1(){
System.out.println("Base :f1()");
}
}
public class Child extends Base{
public void f1(){
System.out.println("Child: f1()");
}
}
public class Test {
public static void main(String[] args) {
Base b1 = new Child();
b1.f1();
}//end of main
}//end of class
Group-B (Short Answer Type Question)
Answer any three of the following : [ 5 x 3 = 15 ]
2. A) If a class has multiple methods having the same name but different parameters, it is known as Method [5]
Overloading. Illustrate it with an example.
B) In Function overloading is there any dependency over the return type of the function?
3. Compare the final, finally, and finalize keywords. [5]
4. An exception (or exceptional event) is a problem that arises during the execution of a program. When an [5]
Exception occurs the normal flow of the program is disrupted.
1/2
What is a checked exception?
How to define a user-defined exception?
5. Write a Java Application that reads the file content line by line. [5]
6. What is serialization and deserialization? Illustrate with an example. [5]
Group-C (Long Answer Type Question)
Answer any three of the following : [ 15 x 3 = 45 ]
7. (a) What is an abstract class? Illustrate with an example. [4]
(b) What is an exception in Java? Illustrate with an example. [3]
(c) What is a throws clause? Illustrate with an example. [4]
(d) What is the utility of finally block? Illustrate with an example. [4]
8. (a) There are two ways to create a new thread of execution. One is to declare a class to be a subclass [7]
of the Thread class. The other way to create a thread is to declare a class that implements the
Runnable interface. That class then implements the run method.
Illustrate with an example how to create a thread using thread class and also using Runnable
interface.
(b) What is the purpose of join method? [3]
(c) Describe the different Thread states. [5]
9. (a) When the child class(subclass) has the method which has the same name, same parameters and [5]
same return type (or covariant return type) as a method in its parent class(or super-class), then the
child method has overridden the parent class method. Illustrate with an example.
(b) The access level can't be more restrictive than the overridden method. Illustrate this with an [5]
example.
(c) The overriding method can throw any unchecked (runtime) exception regardless of whether the [5]
overridden method declares the exception. Illustrate with an example.
10. (a) Write a Java application that appends the information to the file named File1.txt. [8]
(b) Write a Java application that reads the information from the console for the String data type. [4]
(c) What are the limitations of the Java Applet? [3]
11. Write a Java application that has two labels. One label has “Enter the subject preference” and another [ 15 ]
one has the “Given Preference”. The first Label is associated with an input text box and the second label is
associated with a combo box. There is an ADD button. When the Button has been pressed the content of
the text box is appended in the combo box and the text box is cleared with a blank string.
*** END OF PAPER ***
2/2