Code: DC-12                                                                                     Subject: OOPS THRU JAVA

Time: 3 Hours                                                                                                     Max. Marks: 100

NOTE: There are 11 Questions in all.

·      Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the boxes provided on page 1. Tear this sheet and attach it to the main answer book.

·       Answer any THREE Questions each from Part I and Part II.

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

                         

ROLL NO.

 

 

Q.1            State which of the statement is true and which are false. (Tick the box)            (2x8)

a.       Java is a free-form language.

TRUE

 

FALSE

 
         

 

b.      An object is an instance of a class.

TRUE

 
 FALSE
 

 


c.       When a simple type is passed to a method, it is done by use of call-by-reference.  Objects are passed by use of call-by-value. 

TRUE

 

FALSE

 
                                                                                   

                  

 

 

d.      The package statement defines a name space in which classes are stored.

FALSE

 

TRUE

 
        

 

 

e.       A throws clause lists the types of exceptions that a method might throw.

                  
 TRUE
          

FALSE

 

 

f.        The write() method  writes a byte to the output stream

TRUE

 

FALSE

 
 


       

 

g.       An interface is basically a kind of object.

TRUE FALSE 
 

 


             h.  Super may only be used within a subclass constructor method.

TRUE  FALSE 
 

 

 

 


            

CENTRE STAMP                

 

                                                                                                Signature of Suptd/invigilator

 
 

 

 

 

 

 

 

 


PART I

Answer any THREE Questions. Each question carries 14 marks.

 

 

  Q.2     a.   Discuss the basic concepts of object-oriented programming.                               (4)          

 

             b.    Why is Java known as platform-neutral language?                                              (3)

         

             c.   Define the following:

 

                                                                             i.      instance variables.

                                                                            ii.      class variables.

                                                                          iii.      local variables.

                                                                          iv.      static variables                                                                           (4)

 

             d.   Differentiate between instanceof  and  dot operator.                                            (3)          

 

  Q.3     a.   Write a program in java to compute the ‘power of 2’ using for loop.                   (4)          

 

             b.   Write a program to produce output as follows:

 

                   *

                   **

                   ***

                   ****                                                                                                                 (4)

 

             c.   What are the major differences between an interface and a class?                        (4)

 

             d.   What is package?                                                                                              (2)

 

          

  Q.4     a.   Discuss the different levels of access protection including for packages, available in Java.                (8)

 

             b.   Write a program in java to alphabetical order strings.                                          (6)

 

 

  Q.5     a.   What are exceptions?  Explain the importance of try, throw and catch keywords in handling exceptions.                                                                 (8)

 

             b.  What do you understand by operator overloading?  How does it differ from operator overriding?                                                                (6)

 

  Q.6           Write short notes on :

            

                   (i)   Polymorphism.

                   (ii)  Argument passing.

                   (iii) Subclass constructor.

                   (iv)  Garbage collection.                                                                    (3.5 x 4 = 14)          


         

PART II

Answer any THREE Questions. Each question carries 14 marks.

 

  Q.7     a.   What is the difference between static and final methods?  Explain with the help of examples.                                                                       (6)

 

             b.   Write a recursive method to compute a * b using + operator.  a and b are positive numbers.                                                                      (8)

            

  Q.8     a.   Explain in detail when constructors are called with the help of example.               (6)

 

             b.   Differentiate between late binding and early binding.                                            (4)

 

             c.   Differentiate between multiple and multilevel inheritance.                                      (4)

                  

  Q.9     a.   Write a program to copy bytes from one file to another.                                      (8)

 

b.      Distinguish between following:

 

(i)                  Byte streams.

(ii)                Character streams.                                                                           (6)                                                                                                                                                                                                                                                                                                                    

 

Q.10           a.                                                        Differentiate between the following operators:

                  

(i)                  >>>  and >>

(ii)                && and &                                                                                       (7)

 

             b.   Write a program to find area of rectangle and area of circle by implementing interfaces.                   (7)

            

Q.11                                                                      Write short notes on:

 

(i)        Applets.                                                                                               

(ii)       Encapsulation.                   

(iii)               Method overriding.           

(iv)              Abstract classes.                                                             (3.5 x 4 = 14)