Java Mastery Audio Quiz Quiz

  1. Java Data Types

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

    1. int
    2. integer
    3. Int
    4. doublet
    5. duble
  2. Object-Oriented Concepts

    Which keyword is used to inherit a class in Java?

    1. extends
    2. inherit
    3. implements
    4. expands
    5. extnd
  3. Writing Methods

    What is the correct way to declare a method that returns an integer value in Java?

    1. public int calculate()
    2. public void calculate()
    3. int calculate void()
    4. calculate int()
    5. public Integer calculate void()
  4. Java Collections

    Which collection type automatically prevents duplicate elements in Java?

    1. Set
    2. List
    3. ArrayList
    4. Map
    5. AraySet
  5. Exception Handling

    Which keyword is used to handle exceptions in Java?

    1. catch
    2. tryy
    3. excep
    4. handle
    5. cacth
  6. Access Modifiers

    Which access modifier allows a class member to be accessed only within the same package and subclass?

    1. protected
    2. private
    3. default
    4. public
    5. protectd
  7. Java Loops

    Which loop is best to use in Java when the number of iterations is known in advance?

    1. for
    2. while
    3. do-while
    4. foreach
    5. fro
  8. Interfaces vs Abstract Classes

    Which Java feature allows a class to provide implementations for multiple behaviors but not store variables?

    1. Interface
    2. Abstract class
    3. Class
    4. Struct
    5. Inerface
  9. Java String Comparison

    Which method should be used to compare two String values for content equality in Java?

    1. equals
    2. ==
    3. compareTo
    4. equalto
    5. equalsIgnoreCase
  10. Java Method Overloading

    What is method overloading in Java?

    1. Defining multiple methods with the same name but different parameters
    2. Calling a method from its superclass
    3. Writing the same method in two different classes
    4. Implementing a method from an interface
    5. Creating a method with different return types only