How To Hire Java Developers?

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Rrhhteravision
R
Rrhhteravision
Community Contributor
Quizzes Created: 1 | Total Attempts: 72
| Attempts: 72 | Questions: 13
Please wait...
Question 1 / 13
0 %
0/100
Score 0/100
1. A method name min() that needs two integer arguments is declared as

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.

Submit
Please wait...
About This Quiz
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!

Personalize your quiz and earn a certificate with your name on it!
2. You store java source code files with following extension?

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.

Submit
3. In Java language, the argument to the method is within 

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.

Submit
4. 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

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.

Submit
5. Java language has support for which following types of comments

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.

Submit
6. A subclass is also called as

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.

Submit
7. 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 it
overrides

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.

Submit
8. 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);  
  }
}

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.

Submit
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 instantiate
from is called derived class
(4) You cannot instantiate objects of interfaces or abstract classes

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.

Submit
10. 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);
 }
}

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.

Submit
11. 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);
  }
}

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.

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

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.

Submit
13. 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');
  }
 }

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.

Submit
View My Results

Quiz Review Timeline (Updated): Aug 23, 2023 +

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
Cancel
  • All
    All (13)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
A method name min() that needs two integer arguments is declared as
You store java source code files with following extension?
In Java language, the argument to the method is within 
State which of the following statements are true (1) A series of...
Java language has support for which following types of comments
A subclass is also called as
State which of the following statements are True (1) Each method...
What will be the outcome of executing following code.class...
State which of the following statements are True (1) Java...
What will be the outcome of executing following code. class...
What will be the outcome of executing following code. class...
Which are the valid declarations for an integer literal (1) 0(2)...
What will be the result of compiling following code  public...
Alert!

Advertisement