AllInfoHub Logo

AllInfoHub – MCQ Practice

Variables and Data Types – Multiple Choice Questions (MCQs)

  1. 1. Which of the following is a primitive data type in Java?

    • A. String
    • B. Class
    • C. Object
    • D. int
  2. 2. Which of the following is a reference data type in Java?

    • A. byte
    • B. short
    • C. long
    • D. String
  3. 3. What is the size of an `int` data type in Java?

    • A. 8 bits
    • B. 16 bits
    • C. 32 bits
    • D. 64 bits
  4. 4. What is the size of a `byte` data type in Java?

    • A. 8 bits
    • B. 16 bits
    • C. 32 bits
    • D. 64 bits
  5. 5. What is the size of a `short` data type in Java?

    • A. 8 bits
    • B. 16 bits
    • C. 32 bits
    • D. 64 bits
  6. 6. What is the size of a `long` data type in Java?

    • A. 8 bits
    • B. 16 bits
    • C. 32 bits
    • D. 64 bits
  7. 7. What is the size of a `float` data type in Java?

    • A. 32 bits
    • B. 64 bits
    • C. 80 bits
    • D. 128 bits
  8. 8. What is the size of a `double` data type in Java?

    • A. 32 bits
    • B. 64 bits
    • C. 80 bits
    • D. 128 bits
  9. 9. What is the size of a `boolean` data type in Java?

    • A. 1 bit
    • B. 8 bits
    • C. JVM-dependent
    • D. 16 bits
  10. 10. What is the size of a `char` data type in Java?

    • A. 8 bits
    • B. 16 bits
    • C. 32 bits
    • D. 64 bits
  11. 11. What is the default value of a numeric primitive data type in Java?

    • A. null
    • B. undefined
    • C. depends on the type
    • D. 0
  12. 12. What is the default value of a `boolean` data type in Java?

    • A. TRUE
    • B. FALSE
    • C. null
    • D. 0