Java 5000 MCQ questions and answers for freshers | Java MCQ for Placement

In this page get all the latest java MCQ questions and answers which will help you at the time of interview. We covered the most frequently asked java questions in interview, aptitude and even GATE exams.

01) What is the range of short data type in JAVA?

  1. -127 to +127
  2. -212355 to +342355
  3. -32768 to +32767
  4. none of the above

Correct answer: -32768 to +32767

02) What is the range of char data type in JAVA?

  1. -128 to +127
  2. 0 to 256
  3. 0 to 844747
  4. 0 to 65535

Correct answer: 0 to 65535(It’s 2^16)

03) What is the order of variables in Enum?

  1. Ascending
  2. Descending
  3. Random
  4. None of the above

Correct answer: Ascending order

04) Which of the following is the advantage of BigDecimal over double?

  1. Syntax
  2. Memory usage
  3. High precision
  4. None of the above

Correct answer: High Precision

05) How to format date from one form to another?

  1. DateFormat
  2. SimpleFormat
  3. SimpleDateFormat
  4. None of the above

Correct answer: SimpleDateFormat

06) Which of the below are long data type literal?

  1. 0x99fffL
  2. ABCDEFGH
  3. s0x9998U
  4. none of the above

Correct answer: 0x99fffL

07) Which of these is necessary condition for automatic type conversion in JAVA?

  1. The destination type is larger than source type
  2. The destination type is smaller than source type
  3. The destination type is larger or smaller than source type
  4. None of the above

Correct answer: The destination type is larger than source type

08) Which of the below operators is used to allocate memory to array variable in JAVA?

  1. alloc
  2. malloc
  3. new
  4. none of the above

Correct answer: new(new operator allocates a block of memory specified by the size of an array)

09) Which of the following can be operands of arithmetic operators?

  1. Numeric
  2. Boolean
  3. Both numeric and characters
  4. None of the above

Correct answer: Both numeric and characters

10) Which of the below is not a bitwise operator?

  1. <=
  2. &
  3. &=
  4. All of the above

Correct answer: <= is a relational operator