Java MCQs with answers Page - 2

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 831.35K Points
Coach

Q. Java is a ........... language.

  • (A) weakly typed
  • (B) strongly typed
  • (C) moderate typed
  • (D) None of these

A

Admin • 831.35K Points
Coach

Q. How many primitive data types are there in Java?

  • (A) 6
  • (B) 7
  • (C) 8
  • (D) 9

A

Admin • 831.35K Points
Coach

Q. In Java byte, short, int and long all of these are

  • (A) signed
  • (B) unsigned
  • (C) Both of the above
  • (D) None of these

A

Admin • 831.35K Points
Coach

Q. Which of the following is not a maven goal?

  • (A) install
  • (B) clean
  • (C) debug
  • (D) package

A

Admin • 831.35K Points
Coach

Q. Size of int in Java is

  • (A) 16 bit
  • (B) 32 bit
  • (C) 64 bit
  • (D) Depends on execution environment

A

Admin • 831.35K Points
Coach

Q. The smallest integer type is ......... and its size is ......... bits.

  • (A) short, 8
  • (B) byte, 8
  • (C) short, 16
  • (D) short, 16

A

Admin • 831.35K Points
Coach

Q. Which is the Parent class of annotation class?

  • (A) Super
  • (B) Main
  • (C) Object
  • (D) Class

A

Admin • 831.35K Points
Coach

Q. Which of the following annotation is used to avoid execution of Junits?

  • (A) @ignore
  • (B) @avoid
  • (C) @explicit
  • (D) @NoTest

A

Admin • 831.35K Points
Coach

Q. Size of float and double in Java is

  • (A) 32 and 64
  • (B) 64 and 64
  • (C) 32 and 32
  • (D) 64 and 32

A

Admin • 831.35K Points
Coach

Q. Determine output:

Code:
class A{
        public static void main(String args[]){
	        int x;
 	        x = 10;
	        if(x == 10){
		        int y = 20;
		        System.out.print("x and y: "+ x + " " + y);
		        y = x*2;
	        }
	        y = 100;
	        System.out.print("x and y: " + x + " " + y);
        }
}
  • (A) 10 20 10 100
  • (B) 10 20 10 20
  • (C) 10 20 10 10
  • (D) Error

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ