1. Question: Which option lists Java access modifiers in the right order from the most permissive to the most restrictive?

    A
    public, protected, no modifier/default/package, private

    B
    public, no modifier/default/package, protected, private

    C
    no modifier/default/package, public, protected, private

    D
    public, protected, private, no modifier/default/package

    E
    None

    Note: Not available
    1. Report
  2. Question: What should be the replacement of "//ABC" in the following code?
    class Krit
    {
        String str= new String("OOPS !!! JAVA");
        public void KritMethod(final int iArgs)
        {
          int iOne;
          class Bicycle
          {
            public void sayHello()
            {
              //ABC
            }
          }
        }
        public void Method2()
        {
          int iTwo;
        }
    }

    A
    System.out.print(str);

    B
    System.out.print(iOne);

    C
    System.out.print(iTwo);

    D
    System.out.print(iArgs);

    Note: Not available
    1. Report
  3. Question: Assuming that val has been defined as an int for the code below, which values of val will result in "Test C" being printed?
    if( val > 4 ) {
    
     System.out.println("Test A");
    
    } else if( val > 9 ) {
    
     System.out.println("Test B");
    
    } else
    
     System.out.println("Test C");

    A
    val < 0

    B
    val between 0 and 4

    C
    val between 4 and 9

    D
    val > 9

    E
    val = 0

    F
    No values for val will result in "Test C" being printed.

    Note: Not available
    1. Report
  4. Question: What is the output of the given program?
    public class Test118 extends _Test118 {
            {
                    System.out.print("_INIT");
            }
            static {
                    System.out.print("_STATIC");
            }
            Test118() {
                    System.out.print("_CONST");
            }
            public static void main(String[] args) {
                    System.out.print("_MAIN");
                    new Test118();
            }
    }
    class _Test118 {
            _Test118() {
                    System.out.print("_BASE");
            }
    }

    A
    _STATIC_MAIN_BASE_INIT_CONST

    B
    _STATIC_MAIN_INIT_BASE_CONST

    C
    _INIT_STATIC_MAIN_BASE_CONST

    D
    _INIT_STATIC_MAIN_BASE_CONST

    Note: Not available
    1. Report
  5. Question: What will be the output, if the following program is run?
    public class Test8 {
        public static void main(String[] args) {
            System.out.println(Math.sqrt(-4));
        }
    }

    A
    null

    B
    2

    C
    NaN

    D
    -2.0

    Note: Not available
    1. Report
  6. Question: What will be the output of this program?
    public class Test {
    
     public static void main(String args[]) {
    
      int a, b;
      a = 2;
      b = 0;
      System.out.println(g(a, new int[] { b }));
     }
    
     public static int g(int a, int b[]) {
    
      b[0] = 2 * a;
      return b[0];
     }
    }

    A
    0

    B
    1

    C
    An exception will occur

    D
    4

    Note: Not available
    1. Report
  7. Question: There are three classes named A, B, and C. The class B is derived from class A and class C is derived from B. Which of the following relations are correct for the given classes?

    A
    Any instance of A is an instance of B.

    B
    Any instance of B is an instance of A.

    C
    Any instance of C is an instance of B.

    D
    Any instance of B is an instance of C.

    Note: Not available
    1. Report
  8. Question: What is the output of the given console application?
    public class Test19 {
            public static void main(String[] args) {
                    final int X = 9;
                    int[][] a = {{5, 4, 3}, {9, 7, 2}, {1, 6, 8}};
                    for (int i=0; i<3; i++) {
                            for (int j=0; j<3; j++) {
                                    if (a[i][j] == X) break;
                                    System.out.print(a[i][j] + "" "");
                            }
                    }
            }
    }

    A
    5

    B
    5 4 3

    C
    5 4 3 1 6 8

    D
    5 4 3 7 2 1 6 8

    Note: Not available
    1. Report
  9. Question: Which of the following statements is true?

    A
    public interface RemoteTrain extends java.rmi.Remote

    B
    public class RemoteTrain extends java.rmi.Remote

    C
    public interface RemoteTrain extends java.net.Remote

    D
    public class RemoteTrain extends java.net.Remote

    E
    private class RemoteTrain extends java.net.Remote

    Note: Not available
    1. Report
  10. Question: The JDK comes with a special program that generates skeleton and stub objects that is known as:

    A
    java.rmi.Remote

    B
    rmi

    C
    rmic

    D
    rmijava

    E
    javac

    Note: Not available
    1. Report
Copyright © 2024. Powered by Intellect Software Ltd