Full width home advertisement

Travel the world

Climb the mountains

Post Page Advertisement [Top]


Java Questions

  1. To override a method in Java, we need to define a method in sub class with the

    1. same name, same number of arguments having the same data types as a method in the super class (Ans)
    2. different name, same number of arguments having the same data type as a method in the super class
    3. same name but different number of arguments as a method in the super class
    4. same name, same number of arguments but different data types as a method in the super class
  1. A constructor that is automatically generated in the absence of explicit constructors called?

    1. Default Constructor
    2. Nullary Constructor
    3. Empty Constructor
    4. All the above (Ans)
  1. Choose best option that describes Constructor.

    1. Have no return type
    2. Use name of the class and have no return type (Ans)
    3. Use name of the class
    4. None of the above
  1. Overloaded methods are differentiated by

    1. Number of arguments
    2. Data type of arguments
    3. Number and the Data type of the arguments (Ans)
    4. None of the above
  1. Which keyword is used to inherit class?

    1. inherit
    2. extends (Ans)
    3. inheritance
    4. extend
  1. Which method of System class is used to copy array?

    1. copyArray
    2. arrayCopy
    3. arraycopy (Ans)
    4. arrCopy
  1. Which is right way to creating an array of integer?

    1. javaArray = new int[10];
    2. javaArray new = myArray[10];
    3. int[] javaArray = new int[10];
    4. A and C Both (Ans)
  1. Which is right way to declare Array?

    1. int[] myArray;
    2. int myArray[];
    3. int []myArray;
    4. A and B Both (Ans)
  1. How integer literal can expressed binary data?

    1. int binaryData = b11010;
    2. int binaryData = bx11010;
    3. int binaryData = 0b11010; (Ans)
    4. int binaryData = xb11010;
  1. If you access an uninitialized local variable will result?

    1. Syntax Error
    2. Compile Time Error (Ans)
    3. Run Time Error
    4. No Error
  1. How many type of Primitive Data Types exist in Java?

    1. 5
    2. 7
    3. (Ans)
    4. 10
  1. A collection of methods with no implementation is called an ________.

    1. Polymorphism
    2. Inheritance
    3. Interface (Ans)
    4. Data Binding
  1. What is the correct signature of the main method?

    1. public static void main(String[] args)
    2. static public void main(String[] args)
    3. public void main(String[] args)
    4. A and B Both (Ans)
  1. Which is not a valid comment style in Java

    1. /* comment */
    2. /* comment (Ans)
    3. /** comment */
    4. // comment
  1. The Java programming language is a ________?

    1. Machine Level Language
    2. High Level Language (Ans)
    3. Assembly Level Language
    4. None of the above
  1. Which is not a valid keyword in java?

    1. null (Ans)
    2. transient
    3. synchronized
    4. native

No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib