DipIETE – CS (OLD SCHEME)

 

Flowchart: Alternate Process: JUNE 2009Code: DC12                                                                                      Subject: OOPS THRU JAVA

Time: 3 Hours                                                                                                     Max. Marks: 100

 

NOTE: There are 9 Questions in all.

·      Question 1 is compulsory and carries 20 marks. Answer to Q. 1. must be written in the space provided for it in the answer book supplied and nowhere else.

·      Out of the remaining EIGHT Questions answer any FIVE Questions. Each question carries 16 marks.

·      Any required data not explicitly given, may be suitably assumed and stated.

 

 

 

Q.1       Choose the correct or the best alternative in the following:                                 (2 10)

       

a.          In Java int data type takes

 

        (A)  1 byte.                                      (B)  2 bytes.

        (C)  4 bytes.                                     (D)  8 bytes.

 

b.         JDK is product of______________

  

        (A)  IBM                                          (B)  Sun Microsystems

        (C)  Microsoft                                  (D)  ORACLE INC

 

c.          What will be the output of the following program code?

           int m=100;

           int n=300;

           while (++m<--n);

           system.out.println(m);

          

        (A)  300                                           (B)  100

        (C)  400                                           (D)  200

 

d.         With javadoc, which of the following denotes a javadoc comment?

 

        (A)  //#                                             (B)  /*

        (C)  /**                                            (D)  //**

 

e.          Which of the following keyword is used to prevent inheritance of a class?

          

        (A)  static                                         (B)  abstract

        (C)  public                                       (D)  final                                                      

 

f.           Which of the following methods can be used to remove a component from the display?

                    

     (A)  delete()                                     (B)  remove()

     (C)  disappear()                               (D)  hide()

 

 

g.          What is the error in the following code?

 

                        class Test

                        {

                            abstract void display();

                        }

 

        (A)  No error                                  

        (B)  Method display() should be declared as static

(C)    Test class should be declared as abstract                                                      

(D)  Test class should be declared as public

 

h.          If a Java program has a class with the name factorialDemo having main( ) method then the name of the file must be

 

        (A)  factorialdemo.java                     (B)  factorialDemo.java

        (C)  factorialdemo.class                    (D)  factorialDemo.class

       

i.            A subclass constructor can invoke the default constructor of its superclass using

          

(A)     super.constructor()                    (B)  superclass()

(C)  super()                                      (D)  superconstructor()

 

j.           A package is a collection of_____________

 

        (A)  class and interfaces                     (B)  classes

        (C)  interfaces                                    (D)  editing tools

 

 

Answer any FIVE Questions out of EIGHT Questions.

Each question carries 16 marks.

 

 

  Q.2     a.   List the eight basic data types in Java. Explain their width and range.                   (7)

 

             b.   Explain the three OOP Principles.                                                                     (9)

                  

  Q.3     a.   Explain the bitwise logical operators with examples.                                            (6)

 

             b.   Differentiate between X++ and ++X with examples.                                           (4)

       

             c.   What is the difference between a break and a continue statement, when used in a loop?                  (3)

            

             d.   What is the use of the following form of break statement?

                   break label                                                                                                        (3)

                  

  Q.4     a.   Write a Java program that generate a random integer in the range 2 to 600 inclusive, and then uses nested if_______else statement to determine whether it is divisible by 2,3,5,6,10,15 or 30.           (8)       

                  

             b.   What is class? How does it accomplish data hiding?                                            (5)          

 

             c.   What is constructor? What are its special properties?                                         (3)

 

  Q.5     a.   What do you understand by garbage collection? Explain.                                    (4)

 

b.      Define an object.  What is the significance of object class?                                 (4)

 

c.       What is method overloading? Define a class shapes having two overloaded methods with the name area, to compute area for a circle and a rectangle.                                                           (8)

 

  Q.6     a.   What is recursion? Write a recursive program to compute the fibonacci of any given number.                                                                     (8)

            

             b.   Why it is illegal for a static method to invoke a non static method?                       (3)

 

             c.   When do we declare a function final?   (2)

 

              d.   Differentiate between public member and a private member of a class.                (3)

 

  Q.7     a.   Define necessary classes for the following hierarchy

 

                                                                              bankAccount

 

 

 


                                                  savingsAccount                  currentAccount 

 

                   Assume necessary members and methods for the classes.                                 (10)

 

             b.   What is overriding method? Explain with example. Differentiate between overriding and overloading a method.                                               (6)

                                                                             

  Q.8     a.   What are the uncaught exceptions? Show by example how an exception can be handled using try and catch method.                                               (8)

       

             b.   Define package. What are the most common Java’s inbuilt packages? Write steps to create a package. What are the steps involved in importing a package?                                                                    (8)

 

  Q.9           Write short notes on the following:

 

(i)         Printer Writer Class

(ii)        The predefined streams

(iii)        Java applets

(iv)       Abstract classes                                                                     (4  4 = 16)