SOLUTIONS RATED A+
✔✔Choose the answer that best describes the array created upon executing the
following:
Create array myStudents[30][6] - ✔✔Creates a 2D array with 30 rows and six columns
✔✔What value is stored in myNumbers[1][2] after the following code executes:
y←3
Create array myNumbers[3][4]FOR rows in myNumbersFOR columns in myNumbers
myNumbers ← y y ← y + 2
ENDFORENDFOR - ✔✔15
✔✔Select the code you would use to create a 2D array with 5 rows and 12 columns. -
✔✔Create array myNums[5][12]
✔✔The visibility level of a class field should be. - ✔✔private
✔✔A field can be of any data type that is legal in the language you are using. - ✔✔True
✔✔A class field is also known as a(n): - ✔✔attribute
✔✔A class is analagous to a(n) - ✔✔blueprint
✔✔An object is a(n) - ✔✔instance of the class
✔✔This is a method that is automatically called when an instance of a class is created. -
✔✔constructor
✔✔If you write a constructor for a class, it should initialize all class fields. - ✔✔True (not
false, "should")
✔✔This keyword is used to indicate a field belongs to a class, and not an instance. -
✔✔static
✔✔The new keyword makes a call to a class's constructor. - ✔✔True
✔✔Each instance of a class has its own set of fields. - ✔✔True
✔✔A class can have only one constructor. - ✔✔False
, ✔✔To find the classes that you need for an OO application, you identify all of the verbs
in a description of a problem. - ✔✔False
✔✔A method of a class is anything that an instance can do or have done to it. - ✔✔True
✔✔A method of a class cannot take in any parameters and cannot return any data. -
✔✔False
✔✔You should create your classes so that all fields of an instance can be accessed
from other parts of the program. - ✔✔False
✔✔A method of a class should never interact with its object. - ✔✔False
✔✔A constructor must have a return type. - ✔✔False
✔✔The class constructor that runs is determined by the parameters passed. - ✔✔True
✔✔Identify the keyword that an object can use to refer to itself. - ✔✔this or self
✔✔One or more objects may be created from a(n): - ✔✔Class.
✔✔Class objects normally have ________ that perform useful operations on their data.
- ✔✔methods
✔✔When you are working with a ________, you are using a storage location that holds
a piece of data. - ✔✔primitive variable
✔✔Data hiding, which means that critical data stored inside the object is protected from
code outside the object, is accomplished by: - ✔✔Using proper notation to set access to
private on the class fields.
✔✔Another term for an object of a class is: - ✔✔Instance.
✔✔For the following code, which statement is NOT true?
public class Circle
private radius
public x
private y - ✔✔y is available to code that is written outside the Circle class.
✔✔It is common practice in object-oriented programming to make all of a class's: -
✔✔Fields private.