placeholder image to represent content

Ab

Quiz by LAURA ANDREATTA

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
14 questions
Show answers
  • Q1
    What is the difference between instance variables and local variables in Java?
    Instance variables are only accessible within the main method. Local variables are declared within a class but outside any method.
    Instance variables and local variables are two different terms used to refer to the same concept.
    Instance variables are declared within a method or block and can be accessed from anywhere in the class. Local variables are declared within a class but outside any method.
    Instance variables are declared within a class but outside any method, and they have separate copies for each object instance. Local variables are declared within a method or block, and they are only accessible within that method or block.
    Instance variables are used for temporary storage of data. Local variables hold data that needs to persist throughout the entire execution of a class.
    30s
  • Q2
    Which keyword is used to implement inheritance in Java?
    extends
    implements
    inherits
    30s
  • Q3
    Which of the following is true about abstract classes in Java?
    An abstract class can only have static methods
    An abstract class can have both abstract and non-abstract methods
    An abstract class can be directly instantiated
    An abstract class cannot have any fields or variables
    30s
  • Q4
    What is the difference between an abstract class and an interface in Java?
    An abstract class can have method implementations and fields, while an interface cannot
    An abstract class cannot have any abstract methods, while an interface can
    An abstract class can be directly instantiated, while an interface cannot
    An abstract class can implement multiple interfaces, while an interface cannot
    30s
  • Q5
    Which of the following is NOT a valid statement about interfaces in Java?
    An interface can have method implementations
    An interface cannot be directly instantiated
    An interface can extend multiple interfaces
    An interface can define constants
    30s
  • Q6
    What is the purpose of an abstract class in Java?
    To restrict access to class members
    To implement multiple interfaces
    To create objects directly
    To serve as a superclass for other classes
    30s
  • Q7
    Which of the following statements accurately describes an abstract method in Java?
    An abstract method is always declared private
    An abstract method must have a return type of void
    An abstract method has no method body
    An abstract method cannot be overridden
    30s
  • Q8
    Which of the following is a valid statement about abstract classes in Java?
    An abstract class can be directly instantiated
    An abstract class can have both abstract and non-abstract methods
    An abstract class can only have static methods
    An abstract class cannot have any fields or variables
    30s
  • Q9
    Which of the following statements about abstract methods in Java is true?
    An abstract method must be declared private
    An abstract method cannot be overridden
    An abstract method can have a return type of void
    An abstract method has no implementation
    30s
  • Q10
    In Java, what is the keyword used to declare an abstract class?
    interface
    class
    extends
    abstract
    30s
  • Q11
    Which of the following statements about abstract classes in Java is true?
    An abstract class must have all abstract methods
    An abstract class does not allow method implementation
    An abstract class cannot be directly instantiated
    An abstract class can implement interfaces
    30s
  • Q12
    What does extending a class mean in Java?
    Extending a class means copying all the properties and methods of another class.
    Extending a class means creating a duplicate class with the same properties and methods.
    Extending a class means creating a separate class that has its own properties and methods independent of any other class.
    Extending a class means creating a new class (child class) that inherits all the properties and methods of an existing class (parent class).
    30s
  • Q13
    What is the difference between method overloading and method overriding in Java?
    Method overloading and method overriding have the same functionality in Java.
    Method overloading is the process of creating multiple objects from a class. Method overriding is the bundling of data and methods together within a class.
    Method overloading is the ability of a subclass to provide its own implementation of a method defined in its superclass. Method overriding is having multiple methods with the same name but different parameters in the same class.
    Method overloading is having multiple methods with the same name but different parameters in the same class. Method overriding is the ability of a subclass to provide its own implementation of a method defined in its superclass.
    30s
  • Q14
    What is the purpose of getter and setter methods in Java?
    Getter and setter methods are used to access and modify the values of private class variables.
    Getter and setter methods are used to print information to the console.
    Getter and setter methods are used to create new objects in Java.
    Getter and setter methods are used to define the behavior of a class.
    30s

Teachers give this quiz to your class