How To Hire Java Developers?

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Rrhhteravision
R
Rrhhteravision
Community Contributor
Quizzes Created: 1 | Total Attempts: 70
Questions: 13 | Attempts: 70

SettingsSettingsSettings
How To Hire Java Developers? - Quiz


Would you like to know everything in java developers? Take this quiz and test yourself now. All the best!


Questions and Answers
  • 1. 

    A method name min() that needs two integer arguments is declared as

    • A.

      Public void min();

    • B.

      Public void min (int a, b);

    • C.

      Public void min (int a, int b);

    • D.

      Public int min (a, b);

    • E.

      SKIP THE QUESTION

    Correct Answer
    C. Public void min (int a, int b);
    Explanation
    The correct answer is "public void min (int a, int b)" because it declares a method named "min" that takes two integer arguments, "a" and "b". The "public" keyword indicates that the method can be accessed from other classes. The "void" keyword means that the method does not return any value. The method is correctly declared with the correct parameter types for two integers.

    Rate this question:

  • 2. 

    You store java source code files with following extension?

    • A.

      .java

    • B.

      .class

    • C.

      .src

    • D.

      .javadoc

    • E.

      SKIP THE QUESTION

    Correct Answer
    A. .java
    Explanation
    The correct answer is ".java" because Java source code files are typically saved with this extension. This allows the Java compiler to recognize and process the file as a valid Java source code file. The other options, such as ".class", ".src", and ".javadoc", are not used to store Java source code files. ".class" files are generated by the Java compiler after successfully compiling the source code, while ".src" and ".javadoc" are not standard file extensions for Java source code files.

    Rate this question:

  • 3. 

    Java language has support for which following types of comments

    • A.

      Block, line and javadoc

    • B.

      Javadoc, literal and string

    • C.

      Javadoc, char and string

    • D.

      Single, multiple and quote

    • E.

      SKIP THE QUESTION

    Correct Answer
    A. Block, line and javadoc
    Explanation
    Java language supports three types of comments: block, line, and javadoc. Block comments are enclosed between /* and */, and can span multiple lines. Line comments start with // and only cover a single line. Javadoc comments are used to generate documentation and are enclosed between /** and */. They can also span multiple lines.

    Rate this question:

  • 4. 

    In Java language, the argument to the method is within 

    • A.

      Curly braces

    • B.

      Parenthesis

    • C.

      Square brackets

    • D.

      Single quote

    • E.

      SKIP THE QUESTION

    Correct Answer
    B. Parenthesis
    Explanation
    In Java language, the argument to the method is enclosed within parentheses. Parentheses are used to define and separate the arguments that are passed to a method. This is a fundamental syntax rule in Java and is necessary for the proper execution of methods.

    Rate this question:

  • 5. 

    State which of the following statements are true (1) A series of characters that appear in double quote is a Char literal(2) Java language is case sensitive(3) The Java programming language is both compiled and interpreted.(4) As long as a computer has a Java Virtual Machine, the same program written in the Java programming language can run on any computer

    • A.

      All four

    • B.

      2,3 and 4

    • C.

      2 and 4

    • D.

      2 and 3

    • E.

      SKIP THE QUESTION

    Correct Answer
    B. 2,3 and 4
    Explanation
    The given answer states that statements 2, 3, and 4 are true. Statement 2 is true because Java is a case-sensitive language, meaning that uppercase and lowercase letters are considered different. Statement 3 is true because Java is both compiled and interpreted. It is compiled into bytecode and then interpreted by the Java Virtual Machine. Statement 4 is true because Java programs can run on any computer that has a Java Virtual Machine installed, regardless of the underlying hardware or operating system.

    Rate this question:

  • 6. 

    What will be the result of compiling following code  public class MyClass  {  public static void main(String args[])  {    System.out.println("In first main()");  }  public static void  main(char args[])   {    System.out.println('a');  } }

    • A.

      (1) Code will not compile and will give "Duplicate main() method declaration" error

    • B.

      (2) Code will compile correctly but will give a runtime exception

    • C.

      (3) Code will compile correctly and will print "In first main()" (without quotes) when run with argument of 'a'.

    • D.

      (4) Code will compile correctly and will print "a" (without quotes) when run with argument of 'a'.

    • E.

      SKIP THE QUESTION

    Correct Answer
    C. (3) Code will compile correctly and will print "In first main()" (without quotes) when run with argument of 'a'.
    Explanation
    The code will compile correctly because it defines two main() methods with different parameter types. When the code is run with the argument of 'a', it will execute the main() method that accepts a char array as an argument. However, since the argument is a single character 'a', it will not match the char array parameter. Therefore, the code will not print anything.

    Rate this question:

  • 7. 

    Which are the valid declarations for an integer literal (1) 0(2) -5(3) 0416(4) 0xabcdef

    • A.

      All 4

    • B.

      1 and 2

    • C.

      1,2 and 3

    • D.

      SKIP THE QUESTION

    Correct Answer
    A. All 4
    Explanation
    All 4 options are valid declarations for an integer literal. Option 1 represents the decimal number 0, option 2 represents the negative decimal number -5, option 3 represents the octal number 0416, and option 4 represents the hexadecimal number 0xabcdef.

    Rate this question:

  • 8. 

    A subclass is also called as

    • A.

      Inner class

    • B.

      Nested class

    • C.

      Derived class

    • D.

      Hidden class

    • E.

      SKIP THE QUESTION

    Correct Answer
    C. Derived class
    Explanation
    A subclass is also known as a derived class. In object-oriented programming, a subclass is a class that inherits properties and behaviors from a parent class (also known as a superclass). The subclass can add additional features or modify the inherited ones. Therefore, derived class is the correct term to describe a subclass.

    Rate this question:

  • 9. 

    State which of the following statements are True (1) Java language support multi-dimentional arrays (2) StringBuffer  class is alternative to String class (3) A class which you create only to extend from, but not to instantiatefrom is called derived class(4) You cannot instantiate objects of interfaces or abstract classes

    • A.

      All 4

    • B.

      1 and 2

    • C.

      1,2 and 4

    • D.

      SKIP THE QUESTION

    Correct Answer
    C. 1,2 and 4
    Explanation
    The given answer states that statements 1, 2, and 4 are true.

    Statement 1 is true because Java language does support multi-dimensional arrays.

    Statement 2 is true because the StringBuffer class in Java is an alternative to the String class. It provides mutable strings and additional methods for string manipulation.

    Statement 4 is true because interfaces and abstract classes cannot be instantiated directly. They can only be implemented by classes or extended by other classes.

    Therefore, the correct answer is 1, 2, and 4.

    Rate this question:

  • 10. 

    State which of the following statements are True (1) Each method in a parent class can be overridden at most once in any one subclass(2) A method can be overloaded in the class it is defined as well as in the subclass of its class(3) Overriding methods must return exactly the same type as the method they override(4) An overriding method must not be less accessible than the method itoverrides

    • A.

      All 4

    • B.

      1 and 2

    • C.

      1,2 and 4

    • D.

      SKIP THE QUESTION

    Correct Answer
    A. All 4
    Explanation
    All 4 statements are true.

    (1) Each method in a parent class can be overridden at most once in any one subclass, meaning that a subclass can override a method from its parent class only once.

    (2) A method can be overloaded in the class it is defined as well as in the subclass of its class, meaning that a method can have multiple versions with different parameters within the same class or in its subclasses.

    (3) Overriding methods must return exactly the same type as the method they override, meaning that the return type of the overriding method must be the same as the return type of the method it is overriding.

    (4) An overriding method must not be less accessible than the method it overrides, meaning that the access modifier of the overriding method should be the same or more accessible than the method it is overriding.

    Rate this question:

  • 11. 

    What will be the outcome of executing following code. class MyClass{ public static void main(String []args) {   final int i = 100;   byte b = i;   System.out.println(b); }}

    • A.

      Will give compilation error

    • B.

      Will compile and print 100

    • C.

      Will throw an exception

    • D.

      SKIP THE QUESTION

    Correct Answer
    B. Will compile and print 100
    Explanation
    The code will compile and print 100 because the variable "i" is declared as final, which means its value cannot be changed. When the value of "i" is assigned to the byte variable "b", it will be automatically converted to a byte value. Since the value of "i" (100) can be represented as a byte, there will be no compilation error and the value 100 will be printed.

    Rate this question:

  • 12. 

    What will be the outcome of executing following code. class MyClass{  public static void main(String []args)  {   int i = 100;   byte b = i;   System.out.println(b);  }}

    • A.

      Will give compilation error

    • B.

      Will compile and print 100

    • C.

      Will throw an exception

    • D.

      SKIP THE QUESTION

    Correct Answer
    A. Will give compilation error
    Explanation
    The code will give a compilation error because a byte cannot directly hold the value of an integer without explicit casting. In this code, the variable "i" is of type integer and the variable "b" is of type byte. When the value of "i" is assigned to "b", there is a type mismatch because the range of a byte is smaller than the range of an integer. Therefore, the code will not compile.

    Rate this question:

  • 13. 

    What will be the outcome of executing following code.class MyClass{  public static void main (String args[])  {          String s1[] = new String[5];   String str = s1[0].toUpperCase();   System.out.println(str);    }}

    • A.

      Will print null

    • B.

      Will give NullPointerException

    • C.

      Will not compile

    • D.

      Will print NULL

    • E.

      SKIP THE QUESTION

    Correct Answer
    B. Will give NullPointerException
    Explanation
    The code initializes an array of Strings, but it does not assign any values to the elements of the array. Therefore, when the code tries to access the first element of the array (s1[0]) and call the toUpperCase() method on it, a NullPointerException will occur because the element is null. This will result in a runtime error and the program will terminate.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 23, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jul 16, 2010
    Quiz Created by
    Rrhhteravision
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.