InterviewMocks : Online Interview Questions
25th
Jul
Java MCQ

Java MCQ

  • Admin
  • 25th Jul, 2020
  • 871 Followers

Take Java Quiz To test your Knowledge 

Below are few Java MCQ test that checks your basic knowledge of Java. This Java Test contains around 20 questions of multiple choice with 4 options. You have to select the right answer to a question. You can see the correct answer by clicking view answer link.

Also, Read Best Java interview questions.

Java MCQ Quiz

1) Java was originally developed by -

  • A. Brendan Eich
  • B.James Gosling
  • C.Tim Berners-Lee
  • D.Guido van Rossum

2) Which of the following function is used to find and fix bugs in the Java programs ?

  • A. JVM
  • B.JDK
  • C.JRE
  • D.JDB

3) _________is the return type of the hashCode() method in the Object class?

  • A. int
  • B.Object
  • C.void
  • D.long

4) Which of the following option is a valid long literal?

  • A. L990023
  • B.ABH8097
  • C.904423
  • D.0xnf029L

5) A single read/write operation performs _____ In character stream I/O.

  • A. Eight bytes read/write at a time
  • B.Two bytes read/write at a time
  • C.One byte read/write at a time
  • D.Five bytes read/ write at a time

6) ______________ is the order of variables in Enum?

  • A. Descending order
  • B.Ascending order
  • C.Random order
  • D.Depends on the order

7) Which of the following method returns the elements of Enum class?

  • A. getEnumList()
  • B.getEnum()
  • C.getEnumConstants()
  • D.getEnums()

8) Which of the following is the limitation of toString() method of BigDecimal?

  • A. toString returns null
  • B.toString uses scientific notation
  • C.toString returns the number in expanded form
  • D.None of the above

9) BigDecimal is a part of___________ package?

  • A. java.math
  • B.java.lang
  • C.java.util
  • D.java.io

10) The LocalTime represents -

  • A. Time without Date
  • B.Date without time
  • C.Date and Time
  • D.Date and Time with timezone

11) How to get UTC time using Java ?

  • A. Date.getUTC();
  • B.Time.getUTC();
  • C.Instant.now();
  • D.TimeZone.getUTC();

12) Literals in java must be appended by -

  • A. D
  • B.I
  • C.L
  • D.L & l

13) Which of the following is Truncation is Java?

  • A. Integer value assigned to floating type
  • B.Integer value assigned to floating type
  • C.Floating-point value assigned to an integer type
  • D.Floating-point value assigned to an Floating type

14) Arrays are _______ in Java?

  • A. primitive data type
  • B.objects
  • C.object references
  • D.None of These

15) _____ legally declare, construct and initialize an array

  • A. int [] myList = (5, 8, 2);
  • B.int myList [] = {4, 3, 7};
  • C.int myList [] [] = {4,9,7,0};
  • D.None of These

16) When you passed an array to a method, the method receives -

  • A. A copy of the array
  • B.The length of the array
  • C.A copy of the first element
  • D.The reference of the array

17) An attempt to add null key to a TreeMap will result in

  • A. Runtime - NullPointerException
  • B.Compile time Exception
  • C.Eror
  • D.None of These

18) Which of the following keywords is used to define packages in Java?

  • A. Pkg
  • B.pkg
  • C.package
  • D.Package

19) _________is the correct way of importing an entire package ‘pkg’.

  • A. Import pkg.
  • B.import pkg.
  • C.Import pkg.*
  • D.import pkg.*

20) Which of the following method of class String is used to obtain length of String object?

  • A. lengthof()
  • B.Sizeof()
  • C.length()
  • D.lengthof()

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related Articles

01st
Jul
Laravel MCQ
01st
Aug
React JS MCQ
01st
Jul
AngularJs MCQ
01st
Jul
Node js MCQ
01st
Jul
Angular 2 MCQ
01st
Jul
JSON MCQ