Page | 1
java test 3 Questions and Answers (Expert
Solutions)
Q: Java developers don't need to know an object's location in memory, 🗹🗹: true
Q: Java automatically clears the memory once occupied by an object using garbage
collection, 🗹🗹: true
Q: Variables created within a method maintain scope outside that method, 🗹🗹: false
Q: If you need to make a particular variable belong to a class rather than any individual
instance, what type of variable should you use?, 🗹🗹: static variable
Q: The purpose of a setter method is to allow private data to be modified safely, 🗹🗹:
true
Q: The purpose of a getter method is to return the value of a private field, 🗹🗹: true
Q: Setters are void return type methods, 🗹🗹: true
Q: Encapsulation, 🗹🗹: A technique for limiting one class's visibility to another
Q: When you write your own constructor, the default constructor is no longer available,
🗹🗹: true
Q: Which keyword is used to allocate memory for a newly created object?, 🗹🗹: new
, Page | 2
Q: A constructor is a special method which is commonly used to set the initial values of
an object's fields., 🗹🗹: true
Q: Class name should follow Camel casing rules., 🗹🗹: true
Q: What will happen when you try to access an object reference with a null value?,
🗹🗹: null pointer exception
Q: If fields aren't initialized, they take on a default value, 🗹🗹: true
Q: Objects are accessed using reference variables., 🗹🗹: true
Q: What is stored within the stack memory?, 🗹🗹: local variables
Q: what is stored in heap memory?, 🗹🗹: objects
Q: An object reference with a null value points to an empty location in memory, 🗹🗹:
true
Q: In Java, the this keyword can be used to reference the current object's fields and
methods., 🗹🗹: true
Q: To make fields directly accessible to other classes, the class fields must be marked
public, 🗹🗹: true
Q: You can write more than one constructor in a class, 🗹🗹: true
Q: An object must be instantiated before its non-static fields and methods can be
accessed., 🗹🗹: true
Q: All objects of the same class have the same methods., 🗹🗹: true
java test 3 Questions and Answers (Expert
Solutions)
Q: Java developers don't need to know an object's location in memory, 🗹🗹: true
Q: Java automatically clears the memory once occupied by an object using garbage
collection, 🗹🗹: true
Q: Variables created within a method maintain scope outside that method, 🗹🗹: false
Q: If you need to make a particular variable belong to a class rather than any individual
instance, what type of variable should you use?, 🗹🗹: static variable
Q: The purpose of a setter method is to allow private data to be modified safely, 🗹🗹:
true
Q: The purpose of a getter method is to return the value of a private field, 🗹🗹: true
Q: Setters are void return type methods, 🗹🗹: true
Q: Encapsulation, 🗹🗹: A technique for limiting one class's visibility to another
Q: When you write your own constructor, the default constructor is no longer available,
🗹🗹: true
Q: Which keyword is used to allocate memory for a newly created object?, 🗹🗹: new
, Page | 2
Q: A constructor is a special method which is commonly used to set the initial values of
an object's fields., 🗹🗹: true
Q: Class name should follow Camel casing rules., 🗹🗹: true
Q: What will happen when you try to access an object reference with a null value?,
🗹🗹: null pointer exception
Q: If fields aren't initialized, they take on a default value, 🗹🗹: true
Q: Objects are accessed using reference variables., 🗹🗹: true
Q: What is stored within the stack memory?, 🗹🗹: local variables
Q: what is stored in heap memory?, 🗹🗹: objects
Q: An object reference with a null value points to an empty location in memory, 🗹🗹:
true
Q: In Java, the this keyword can be used to reference the current object's fields and
methods., 🗹🗹: true
Q: To make fields directly accessible to other classes, the class fields must be marked
public, 🗹🗹: true
Q: You can write more than one constructor in a class, 🗹🗹: true
Q: An object must be instantiated before its non-static fields and methods can be
accessed., 🗹🗹: true
Q: All objects of the same class have the same methods., 🗹🗹: true