My Daypo


Title of test:

SS_Java_Term 2

Sameh M Samir
(Other tests from this author)

Creation Date:


Number of questions: 75
Share the Test:
Share the Test:
Last comments
No comments about this test.
Anonymous object is an object without a name True False.
A class defines only the attributes (data) for objects True False.
Creating an object is referred to as instantiation True False.
A constructor must have the same name as the class itself True False.
Constructors can be overloaded for making it easy to construct objects with different initial data values True False.
A class may be defined without constructors True False.
A class is essentially a built-in primitive type True False.
Reference data fields in class are initialized by default to the zero value True False.
Static variables are also known as class variables True False.
All objects of a class share its instance data fields (variables). True False.
A class method cannot access instance members (i.e., instance data fields and instance methods) of the class True False.
Static methods of a class can be used without creating an object of the class True False.
All objects of a class share constants in the class True False.
Static methods and static data fields can be accessed by their class name True False.
An instance method can invoke an instance or static method, and access an instance or static data field True False.
Java provides the private and protected visibility modifiers for class and class members True False.
If we want to prevent the user from creating an instance of a class, we should use a private constructor True False.
To enable a private data field to be updated, we should provide an accessor method to set a new value in it. True False.
The object is actually passed by value to a method True False.
When an array of objects is created, each element in the array is a reference variable with a default value of null. True False.
An object whose contents cannot be changed once the object has been created is called immutable object True False.
A class with all private data fields and no mutators is necessarily immutable. True False.
A variable defined inside a method is referred to as a local variable True False.
The scope of a class’ variables (instance and static) is the entire class, regardless of where the variables are declared True False.
If a local variable has the same name as a class’s variable, the class’s variable takes precedence and the local variable with the same name is hidden True False.
The keyword this refers to a class's data field hidden by a method or constructor local parameter, or to invoke an overloaded constructor by the calling object itself True False.
In OOP, class abstraction concept separates class implementation details from how the class is used True False.
A String object is mutable True False.
Inheritance is used to model the has-a relationship between classes True False.
Private members of a super class can be used directly in a subclass True False.
A Java class may inherit directly from only one superclass. True False.
A subclass is not a subset of a superclass because it usually contains more variables and methods than its superclass True False.
When constructing an object of a subclass, the subclass constructor must first invoke its superclass constructor before performing its own tasks True False.
To override a method, the method must be defined in the subclass using only the same signature as in its superclass True False.
A private method in a superclass cannot be overridden in a subclass True False.
A static method in a superclass can be overridden in a subclass. True False.
Method overloading means to provide a new implementation for a method in the subclass True False.
Overridden methods can be either in the same class, or in different classes related by inheritance. True False.
Every class in Java is by default extending from the Object class True False.
Polymorphism means that a reference variable of a superclass can refer to a subclass object True False.
You can always successfully cast an instance of a superclass to a subclass reference variable True False.
The == operator can be used to check whether two objects have the same contents or not. True False.
ArrayList object is used to store a dynamic list of primitive values or objects True False.
Subclass cannot weaken the accessibility of a method defined in the superclass True False.
A class with no modifier is accessible by classes from other packages True False.
The protected visibility modifier enables the members of the class to be accessed by the subclasses in any package or classes in the same package True False.
A method defined as final in a superclass cannot be overridden in the subclasses. True False.
An abstract class can be used to create objects True False.
It is not possible to define an abstract class that does not contain any abstract methods True False.
A subclass can be abstract even if its superclass is non-abstract True False.
Abstract methods must not be static True False.
Each interface is compiled into a separate bytecode file, just like a regular class True False.
You cannot create a new instance from an interface True False.
A class cannot implement multiple interfaces. True False.
In abstract class definition, all variables must be public static final. True False.
An interface can inherit other multiple interfaces using extends keyword. True False.
Interface must not contain constructors. True False.
Interface can be as a data type for a reference variable, as the result of casting, and so on. True False.
The operator …….. is used to access a data field or invoke a method from an object. – (Dash) . (Dot) -> (Arrow) _ (Underscore).
A class provides method of a special type, known as ………, which is invoked to create a new instance final static abstract constructor.
……… method does not have a return type. Instance static abstract constructor.
Constructor is invoked using the ……… keyword when an instance is created. new instanceof super this.
A public no-argument constructor is provided automatically only if no constructors are explicitly defined in the class, and in this case it is called the ……… constructor final default abstract super.
The ……… visibility modifier allows classes, methods, and data fields to be accessible by any class in the same package only. public default protected private.
The keyword ……… can also be used inside a constructor to invoke another constructor of the same class super this new instanceof.
If a method has the public visibility modifier in a superclass then its overridden version in the subclass must have the ……… visibility modifier public protected default private.
The ……… package is imported by default in any java project. java.lang java.util java.math javafx.geometry.
In OOP, the ………. relationship allows you to define new classes from existing classes. association aggregation inheritance composition.
When multiple methods have the same name but different signatures, this is called method ……... overriding overloading encapsulation abstraction.
To prevent a class from being inherited, it should be defined as ………. abstract static final private.
Defining data fields of a class as private is known in OOP as the concept of data ………. encapsulation inheritance polymorphism abstraction.
………. means that a reference variable of a superclass can refer to a subclass object. Encapsulation Inheritance Polymorphism Abstraction.
Constructor of abstract class should be defined as ……… because it is used only by subclasses private protected default public.
To prevent a method in a superclass from being overridden in any subclass, it should be defined as ………. abstract static final private.
The early (static) binding of a superclass reference variable that refers to a subclass instance, causes a static method of a superclass is executed rather than an overriding static method of the subclass, and this is called method ……... overriding overloading hiding abstraction.
Report abuse Consent Terms of use