Java Data Types and Variables - MCQ

Programming Language > Java Programming Language

Test your knowledge of Java data types and variables with these multiple choice questions. Learn about the different data types in Java and how to use variables to store values. Take the quiz now! ➲ Java Data Types and Variables - MCQ - Quiz


  • A signed
  • B unsigned
  • C Both of the above
  • D None of these
  • A short, 8
  • B byte, 8
  • C short, 16
  • D short, 16
  • A 32 and 64
  • B 64 and 64
  • C 32 and 32
  • D 64 and 32
  • A Two type are compatible and size of destination type is shorter than source type.
  • B Two type are compatible and size of destination type is equal of source type.
  • C Two type are compatible and size of destination type is larger than source type.
  • D All of the above
  • A short to int
  • B byte to int
  • C int to long
  • D long to int
  • A Prints 2.5
  • B Rraises an error as STATIC is used as a variable which is a keyword
  • C Raises an exception
  • D None of these
  • A Does not compile as Integer and String are API class names.
  • B Throws exception.
  • C 34
  • D 34 S
  • A Prints true
  • B Prints false
  • C Will not compile as boolean is not initialized
  • D Will not compile as boolean can never be static
  • A A Java keyword
  • B A Boolean literal
  • C Same as value 1
  • D Same as value 0
  • A 14 21
  • B 14 13
  • C Compilation fails with an error at line 6
  • D Compilation fails with an error at line 4
  • A 128
  • B 0
  • C Compilation fails with an error at line 3
  • D None of these
  • A long
  • B int
  • C short
  • D byte
  • A int
  • B short
  • C byte
  • D enum
  • A double
  • B long
  • C short
  • D byte
  • A Special Character
  • B Letter
  • C Digit
  • D String
  • A -128 to 256
  • B -127 to 128
  • C -128 to 255
  • D -128 to 127
  • A 3 Bytes
  • B 4 Bytes
  • C 2 Bytes
  • D 8 Bytes
  • A int
  • B float
  • C long
  • D double
  • A -2,147,483,648
  • B -32,768
  • C -32,767
  • D -127
  • A 0
  • B 0.0
  • C null
  • D 0.0d
  • A char
  • B boolean
  • C String
  • D int
  • A None of these
  • B java.lang.Boolean
  • C java.util.Boolean
  • D java.io.Boolean
  • A None of these
  • B Boolean Object
  • C Floating Object
  • D Integer Object