Monday, 7 January 2019

Java Objective Test

     Free java Objective Test Question

                                   जावा इस थे मोस्ट पॉपुलर लैंग्वेज इन थे वर्ल्ड 

Free Java Project Mock Test 
1 .class Base {} 
    class Derived extends Base {
     public static void main(String args[]){ 
      Base a = new Derived();
     System.out.println(a instanceof Derived);
     } }
     Marked Answer :FALSECorrect 
      Answer : TRUE Total Marks : 2MARKS OBTAINED 0
 

2.Which of the following is not an operator in Java?
       Marked Answer : >>>=
      Correct Answer : sizeof 
      
  3. class Test {
       public static void swap(Integer i, Integer j) {
       Integer temp = new Integer(i); i = j;
        j = temp; }
       public static void main(String[] args) {
      Integer i = new Integer(10); 
       Integer j = new Integer(20); swap(i, j);
         System.out.println(“i = ” + i + “, j = ” + j); 
       } } 
     Marked Answer : i = 10, j = 20 
    Correct Answer : i = 10, j = 20 


 4.class Base 
  {
     public final void show() {
     System.out.println(“Base::show() called”); 
    } }
     class Derived extends Base {
    public void show() {
    System.out.println(“Derived::show() called”); }
     }
      public class Main {
      public static void main(String[] args)
    {
      Base b = new Derived();
     b.show(); 
    } }
     Marked Answer : Compiler Error 
     Correct Answer : Compiler Error Total Marks : 2MARKS OBTAINED 2 



5. Which of the following is/are true about packages in Java? 
    1) Every class is part of some package.
   2 ) All classes in a file are part of the same package. 
  3) If no package is specified, the classes in the file go into a special unnamed package
   4) If no package is specified, a new package is created with folder name of class and the class      is put in this package. 
   Marked Answer : Only 1, 2 and 4 
   Correct Answer : Only 1, 2 and 3 Total 


6. Which of the following is true about inheritance in Java?
     1) Private methods are final.
     2) Protected members are accessible within a package and inherited classes outside the                package.
     3) Protected methods are final.
     4 ) W e cannot override private methods. Marked Answer : 2, 3 and 4
       Correct Answer : 1, 2 and 4 Total Marks : 2MARKS OBTAINED 0 


7. class demo {
     int a, b, c;
      demo(int a, int b, int c) {
     this.a = a; this.b = b; } demo() {
     a = b = c = 0;
     }
    demo operator+(const demo &obj) {
     demo object;
    object.a = this.a + obj.a;
     object.b = this.b + obj.b; object.c = this.c + obj.c; return object; } }
    class Test {
    public static void main(String[] args) {

   demo obj1 = new demo(1, 2, 3);
   demo obj2 = new demo(1, 2, 3); demo obj3 = new demo(); 
    obj3 = obj1 + obj2;
   System.out.println (“obj3.a = ” + obj3.a); 
    System.out.println (“obj3.b = ” + obj3.c); 
    System.out.println (“obj3.c = ” + obj3.c); } }
   Marked Answer : Compile Error Correct Answer :
 Compile Error Total Marks : 




8.  Which of the following is FALSE about arrays on Java? 
       Marked Answer : Length of array can be changed after creation of array
      Correct Answer : Length of array can be changed after creation of array 






All Question  are important in the java Developer to Develop in java programmig
                          Thanks:
     by -er prince kumar

No comments:

Post a Comment

Featured post

Complete Concept of JQuery || What is jQuery and Example || by Er princ...

How to used Jquery in javaScript || comcept of javascript of jquery