How To Exam?

a knowledge trading engine...


West Bengal Institute of Technology (WBIT) 2008 M.C.A E503B Object Oriented Programming With Java ( ) - Question Paper

Thursday, 18 July 2013 04:45Web



ENGINEERING & MANAGEMENT EXAMINATIONS, DECEMBER - 2008 OBJECT ORIENTED PROGRAMMING WITH JAVA SEMESTER-5

Time: 3 Hours ]        I Full Marks : 70

GROUP-A (Multiple Choice Type guestions )

1. Answer any ten of the following questions :    10 x 1 = 10

i) Which of the following describes the difference between StringBuffer and Sring ?

a)    StringBuffer is used only to buffer data from an input or output stream

b)    StringBuffer allows text to be changed after instantiation

c)    StringBuffer holds zero length Strings

d)    StringBuffer supports Unicode.    4

11) class A {

int i, j, k;

.pub!ic A (int ii) { i=ii; > public A( ) {;,r k-l

>

>

Referring to the above, what code instantiates an object of class A ?

a) newA(this)    b) Aa = newA(3);

c) A (3) a;    d) A a = new A (4,8);

HI) Which of the following is not true about an interface ?

a)    It can be partially implemented by a class

b)    It can be implemented by an interface

c)    It can be implemented by several classes

d)    A particular class can implement several interfaces.

mwt aim!

CS / MCA / 8EM-B / MCAK-503B /08/ (09)    4

iv)    Which code declares class A to belong to the mypackage.financial package ?


a)    package mypackage; package financial;

b)    import mypackage.*;

c)    package mypackage.flnancial.A;

d)    package mypackage.financial;

v)    Which of the following is used as a part of method signature in Java ?

a)    threw    b) throws

c) try d) finally.

vi)    Which one of the following is a valid declaration of an applet ?

. a) public class MyApplet extends java.applet.Applet {

b)    public Applet MyApplet {

c)    public class MyApplet extends applet implements Runnable {

d)    abstract class MyApplet extends java.applet.Applet {

vii)    Qonsider the following class definition : class Student    '

{

abstract double result ( )

This code will not compile since a keyword is missing in the first line. What is the keyword ? <    ,

vlii) Give the output of the following code ; int m=100; while(true)

{

/

if(m<10)

continue;

m=m 10;    *

>

System.out.printIn("m is" +m);

C8/MCA/8EM-5/MCAE-503B/08/(09)    5    jT7|

Ix) Which of the classes in java.io package defines a method to delete a file ?

x)    Dynamic method dispatcher is useful for

a)    resolving method overriding

b)    resolving multilevel inheritance anomaly    *

c)    resolving multiple inheritance anomaly

d)    none of these.

xi)    Return type of class, constructor is

a) int    b) void

c) class type itself    d) none of these.

xii)    Which of the following are valid array declarations/definitions ? int iArray 2[];

int iArray3[] = new int[10];

int iArray 4(10)=new int[10];

a) 1    b) 2

c) 3    d) none of these.

' .. . '

GROUP-B

(Short Answer Type Questions )

Answer any three of the following.    3x5 = 15

2.    a) Can a superclass object reference a subclass object ? Explain.    2

b)    Illustrate the use of this and super with an example.    2

c)    What is the difference between an abstract class and an interface ?    1

' / -

3.    a) Explain the private, protected and private protected modifiers in brief.    3

b) What is the function offinally ?    2

4.    What are local applet and remote applet ? How do applets differ from application programs ?    *    3 + 2

CS / MCA / 8EM-5 / MCAE-B03B /08/ (09)    6

5.    Write applets to draw the following shape :


a)    Rectangle with rounded comer

t b) Square inside a qircle.    2 + 3

6.    Write a short on Life Cycle of an applet.

. ' % '

GROUP -C ( Long Answer Type Questions )

Answer any three of the following questions.    3x15-45

7.    a) What are constructors ? What is meant by constructor overloading ? Explain with

an example.    2 + 5

b)    Write a Java class CountAndPringArgs to print the number of arguments passed

. '

on the command line as well as the 1st letter of the arguments. For example, if the command line arguments are : Mango Cucumber Apple then the output will be

No. of Arguments - 3

MCA

Write a main method to test the class.    8

8.    a) What is the difference between method overloading and method overriding ?,

Illustrate with an example.    4

b)    What is partial implementation of an Interface ?    2

c)    ' Create a class called ThreeDObJect and derive the classes Box, Cube and Cylinder

' / from it. The class ThreeDObJect has methods wholeSurfaceAreai ) and volume ( ).

Override these two methods in each of the derived classes to calculate the volume and whole surface area of each type of three dimensional objects. The dimensions of the objects are to be taken from the user and passed through the respective ' constructors of each derived class. Write a main method to test these classes. 9

9. a) Discuss about the Vector Class. Vector objects cannot store primitive type data

2 + 1



7


CS / MCA / 8EM-S / MCAE-503B/OS / (09)


directly." Is it true ?

b) What are wrapper classes ? How can they be used to convert a data of primitive

2 + 2


type to object type ?

c) Write a program to implement a stack using the built-in Stack class in Java. 8

10. How do we define try and catch block ? Is it essential to catch all types of exceptions ? Explain. Explain how exception handling mechanism can be .used for debugging a program.

Define an exception called NoMatchException" that thrown when a string is not equal

to University. Wrtte a program that uses this exception.

3 + 2 + 3 + 7


11. What is package ? How do we add a class or an interface to a package ? Write a program to calculate the future value of an investment amount and years.

The formula for the calculation is as follows :

futurevalue = investment_amount x ( 1 + interest_rate )years

Use text fields for interest rate, investment amount and years. Display the future amount in a text field wheri clicking the calculate button.    -2 + 3+10

END

55436 (11/12)







Attachment:

( 0 Votes )

Add comment


Security code
Refresh

Earning:   Approval pending.
You are here: PAPER West Bengal Institute of Technology (WBIT) 2008 M.C.A E503B Object Oriented Programming With Java ( ) - Question Paper