Java Programming OOP Questions and Answers Set 5

Java Programming OOPs

Questions 41 to 50



41.
What would the output be of the above Program - III before and after it is called?
(a)   and b before call : 15  20                a and b after call : 30  10
(b)   a and b before call : 5   2                a and b after call : 15  20
(c)   a and b before call : 15  20 a and b after call : 15  20
(d)   a and b before call : 30  10 a and b after call : 15  20
(e)   a and b before call : 15  20 a and b after call :
42.
What would the argument passing method be which is used by the above Program - III?
(a)  Call by value                                    (b)  Call by reference
(c)  Call by java.lang class                      (d)  Call by byte code                           
(e)  Call by compiler.
43.
Consider the following program:
class prob1{
int puzzel(int n){

       int result;

       if (n==1)
          return 1;
       result = puzzel(n-1) * n;
         return result;
 }
}

class prob2{

public static void main(String args[])

  {

      prob1 f = new prob1();

      System.out.println(" puzzel of 6 is = " + f.puzzel(6));

   }
}
Which of the following will be the output of the above program?
(a)  6                       (b)  120                   (c)  30                     (d)  720                   (e)  12.
44.
The blank space in the following sentence has to be correctly filled :
Members of a class specified as ……………….. are accessible only to methods of that class.
(a)  Protected          (b)  Final                 (c)  Public               (d)  Private              (e)  Static.
45.
Java compiler javac translates Java source code into ………………………
(a)  Assembler language                         (b)  Byte code
(c)  Bit code                                          (d)  Machine code   
(e)  Platform dependent code.
46.
……………….. are used to document a program and improve its readability.
(a)  System cells      (b)  Keywords          (c)  Comments         (d)  Control structures         (e)  Blocks.
47.
In Java, a character constant’s value is its integer value in the ………………………character set.
(a)  EBCDIC            (b)  Unicode            (c)  ASCII                (d)  Binary               (e)  BCD.
48.
In Java, a try block should immediately be followed by one or more ……………….. blocks.
(a)  Throw       (b)  Run   (c)  Exit (d)  Catch          (e)  Error.
49.
An abstract data type typically comprises a …………… and a set of ……………... respectively.
(a)  Data representation, classes             (b)  Database, operations
(c)  Data representation, objects             (d)  Control structure, operations
(e)  Data representation, operations.
50.
In object-oriented programming, the process by which one object acquires the properties of another object is called
(a)  Encapsulation                                  (b)  Polymorphism   (c)  Overloading
(d)  Inheritance                                       (e)  Overriding.






Answers



41.
Answer : (c)
Reason : There wont be any change because of the scope.
42.
Answer : (a)
Reason : Call by value is the right choice.
43.
Answer : (d)
Reason : 720 is the output after the execution of the program
44.
Answer : (d)
Reason : Private access specifier property says that members of class of private are accessible only to the methods of that class.
45.
Answer : (b)
Reason : Byte Code is the file which is generated after java source file is compiled.
46.
Answer : (c)
Reason : Comments improve the readability of the program
47.
Answer : (b)
Reason : Java uses Unicode format.
48.
Answer : (d)
Reason : Try must be followed by catch block in exceptions in java.
49.
Answer : (e)
Reason : An abstract data type contains data representation and operations
50.
Answer : (d)
Reason : Inheritance is the mechanism in which one object acquires the properties of another object.



<< Prev   1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   16   17   18   19   20   21   22  

 23   24   25   26   27   28   29   30  Next >>


2 comments :