java test 3 UPDATED ACTUAL Exam Questions and CORRECT
Answers
Class name should follow Camel casing rules. - true
What will happen when you try to access an object reference with a null value? - null pointer
exception
If fields aren't initialized, they take on a default value - true
Objects are accessed using reference variables. - true
What is stored within the stack memory? - local variables
what is stored in heap memory? - objects
An object reference with a null value points to an empty location in memory - true
In Java, the this keyword can be used to reference the current object's fields and methods. - true
To make fields directly accessible to other classes, the class fields must be marked public - true
You can write more than one constructor in a class - true
An object must be instantiated before its non-static fields and methods can be accessed. - true
All objects of the same class have the same methods. - true
, Each new instance of an object will have a different location in memory. - true
Static variables of a class can be accessed, even if the class has not been instantiated. - true
How can you retrieve a value from a method? - Use a return statement and define the method's
return type as non-void
What are access modifiers? - public and private
A constructor can be written to accept arguments. - true
The fields and methods of the Math class cannot be directly accessed as they are static. - false
Access and visibility of a class should be limited as much as possible. - true
An object can access another object's public methods. - true
An object can access another object's public fields. - true
All overloaded methods share the same name. - true
what can be used as a parameter? - Strings, arrays, ints, objects
The basic unit of encapsulation in Java is the - class
Static methods can read static variables - true
Answers
Class name should follow Camel casing rules. - true
What will happen when you try to access an object reference with a null value? - null pointer
exception
If fields aren't initialized, they take on a default value - true
Objects are accessed using reference variables. - true
What is stored within the stack memory? - local variables
what is stored in heap memory? - objects
An object reference with a null value points to an empty location in memory - true
In Java, the this keyword can be used to reference the current object's fields and methods. - true
To make fields directly accessible to other classes, the class fields must be marked public - true
You can write more than one constructor in a class - true
An object must be instantiated before its non-static fields and methods can be accessed. - true
All objects of the same class have the same methods. - true
, Each new instance of an object will have a different location in memory. - true
Static variables of a class can be accessed, even if the class has not been instantiated. - true
How can you retrieve a value from a method? - Use a return statement and define the method's
return type as non-void
What are access modifiers? - public and private
A constructor can be written to accept arguments. - true
The fields and methods of the Math class cannot be directly accessed as they are static. - false
Access and visibility of a class should be limited as much as possible. - true
An object can access another object's public methods. - true
An object can access another object's public fields. - true
All overloaded methods share the same name. - true
what can be used as a parameter? - Strings, arrays, ints, objects
The basic unit of encapsulation in Java is the - class
Static methods can read static variables - true