Deck 3: A First Look at Classes and Objects

ملء الشاشة (f)
exit full mode
سؤال
"Shadowing" is the term used to describe how the field name is hidden by the name of a local or parameter variable.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Which symbol indicates that a member is public in a UML diagram?

A) -
B) *
C) #
D) +
سؤال
You should not define a class that is dependent on the values of other class fields

A) in order to keep it current
B) because it is redundant
C) in order to avoid having stale data
D) because it should be defined in another class
سؤال
A method that stores a value in a class's field or in some other way changes the value of a field is known as a mutator method.
سؤال
Using the blueprint/house analogy, you can think of a class as a blueprint that describes a house and __________ as instances of the house built from the blueprint.

A) methods
B) fields
C) objects
D) attributes
سؤال
The java.lang package is automatically imported into all Java programs.
سؤال
The public access specifier for a field indicates that the field may not be accessed by statements outside the class.
سؤال
A method that gets a value from a class's field but does not change it is known as a mutator method.
سؤال
A group of related classes is called a(n)

A) archive
B) package
C) collection
D) attachment
سؤال
Class objects normally have __________ that perform useful operations on their data, but primitive variables do not.

A) fields
B) relationships
C) methods
D) instances
سؤال
An access specifier indicates how a class may be accessed.
سؤال
When an object is created, the attributes associated with the object are called

A) instance fields
B) class instances
C) instance methods
D) fixed attributes
سؤال
The term "default constructor" is applied to the first constructor written by the author of the class.
سؤال
When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.
سؤال
Data hiding (which means that critical data stored inside the object is protected from code outside the object) is accomplished in Java by

A) using the public access specifier on the class methods
B) using the private access specifier on the class methods
C) using the private access specifier on the class fields
D) using the private access specifier on the class definition
سؤال
A class's responsibilities include

A) the things a class is responsible for knowing
B) the things a class is responsible for doing
C) both of these
D) neither of these
سؤال
Methods that operate on an object's fields are called

A) instance methods
B) instance variables
C) private methods
D) public methods
سؤال
Another term for an object of a class is a(n)

A) access specifier
B) instance
C) member
D) method
سؤال
The term "no-arg constructor" is applied to any constructor that does not accept arguments.
سؤال
A constructor is a method that is automatically called when an object is created.
سؤال
Which symbol indicates that a member is private a UML diagram?

A) -
B) *
C) #
D) +
سؤال
One or more objects may be created from a(n)

A) field
B) method
C) instance
D) class
سؤال
UML diagrams do not contain

A) fields
B) methods
C) class names
D) object names
سؤال
To indicate the data type of a variable in a UML diagram you specify

A) the variable name followed by the data type
B) the class name followed by the variable name followed by the data type
C) the variable name followed by a colon and the data type
D) the data type followed by the variable name
سؤال
For the following code, which statement is not true?
public class Sphere
{
Private double radius;
Public double x;
Private double y;
Private double z;
}

A) The z field is available to code written outside the Sphere class.
B) The radius field is not available to code written outside the Sphere class.
C) The radius, x, y, and z fields are members of the Sphere class.
D) The x field is available to code that is written outside the Sphere class.
سؤال
Which is the key word used to import a class?

A) import
B) assume
C) use
D) link
سؤال
A constructor is a method that

A) returns an object of the class
B) never receives any arguments
C) performs initialization or setup operations
D) removes the object from memory
سؤال
What does the following UML diagram entry mean? + setHeight(h : double) : void

A) a public method with a parameter of data type double that does not return a value
B) a private field called setHeight that is a double data type
C) a private method with no parameters that returns a double data type
D) a public field called Height that is a double data type
سؤال
When an argument is passed by value

A) the parameter variable holds the address of the argument
B) the parameter variable cannot be changed
C) the parameter variable holds a copy of the value passed to it
D) changes can be made to the argument variable
سؤال
For the following code, which statement is not true?
public class Circle
{
Private double radius;
Public double x;
Private double y;
}

A) The y field is available to code written outside the Circle class.
B) The radius field is not available to code written outside the Circle class.
C) The radius, x, and y fields are members of the Circle class.
D) The x field is available to code that is written outside the Circle class.
سؤال
If you do not provide initialization values for a class's numeric fields, they will

A) cause a runtime error
B) contain an unknown value
C) be automatically initialized to 0
D) cause a compiler error
سؤال
A constructor

A) always accepts two arguments
B) has the same name as the class
C) has the return type of void
D) always has a private access specifier
سؤال
Which of the following is not involved in identifying the classes to be used when developing an object-oriented application?

A) Describe the problem domain.
B) Write the code.
C) Refine the list of nouns to include only those relevant to the problem.
D) Identify all the nouns.
سؤال
The key word new

A) creates a new class
B) creates a new Java byte code file
C) creates an object in memory
D) creates a new variable in memory
سؤال
After the header, the body of the method appears inside a set of

A) braces, { }
B) parentheses, ( )
C) brackets, [ ]
D) double quotes, " "
سؤال
What is the following statement an example of?
import java.util.*;

A) an explicit import statement
B) an unconditional import statement
C) a wildcard import statement
D) a conditional import statement
سؤال
A method

A) may have zero or more parameters
B) never has parameter variables
C) must have at least two parameter variables
D) may not have only one parameter variable
سؤال
It is common practice in object-oriented programming to make all of a class's

A) fields private
B) methods private
C) fields public
D) fields and methods public
سؤال
The scope of a local variable is

A) inside the parentheses of a method header
B) the method in which it is defined
C) inside the class but not inside any method
D) the entire class
سؤال
What is the following statement an example of?
import java.util.Scanner;

A) an explicit import statement
B) an unconditional import statement
C) a wildcard import statement
D) a conditional import statement
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: A First Look at Classes and Objects
1
"Shadowing" is the term used to describe how the field name is hidden by the name of a local or parameter variable.
True
2
Which symbol indicates that a member is public in a UML diagram?

A) -
B) *
C) #
D) +
D
3
You should not define a class that is dependent on the values of other class fields

A) in order to keep it current
B) because it is redundant
C) in order to avoid having stale data
D) because it should be defined in another class
C
4
A method that stores a value in a class's field or in some other way changes the value of a field is known as a mutator method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
Using the blueprint/house analogy, you can think of a class as a blueprint that describes a house and __________ as instances of the house built from the blueprint.

A) methods
B) fields
C) objects
D) attributes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
The java.lang package is automatically imported into all Java programs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
The public access specifier for a field indicates that the field may not be accessed by statements outside the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
A method that gets a value from a class's field but does not change it is known as a mutator method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
A group of related classes is called a(n)

A) archive
B) package
C) collection
D) attachment
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
Class objects normally have __________ that perform useful operations on their data, but primitive variables do not.

A) fields
B) relationships
C) methods
D) instances
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
An access specifier indicates how a class may be accessed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
When an object is created, the attributes associated with the object are called

A) instance fields
B) class instances
C) instance methods
D) fixed attributes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
The term "default constructor" is applied to the first constructor written by the author of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
Data hiding (which means that critical data stored inside the object is protected from code outside the object) is accomplished in Java by

A) using the public access specifier on the class methods
B) using the private access specifier on the class methods
C) using the private access specifier on the class fields
D) using the private access specifier on the class definition
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
A class's responsibilities include

A) the things a class is responsible for knowing
B) the things a class is responsible for doing
C) both of these
D) neither of these
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
Methods that operate on an object's fields are called

A) instance methods
B) instance variables
C) private methods
D) public methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
Another term for an object of a class is a(n)

A) access specifier
B) instance
C) member
D) method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
The term "no-arg constructor" is applied to any constructor that does not accept arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
A constructor is a method that is automatically called when an object is created.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which symbol indicates that a member is private a UML diagram?

A) -
B) *
C) #
D) +
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
One or more objects may be created from a(n)

A) field
B) method
C) instance
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
UML diagrams do not contain

A) fields
B) methods
C) class names
D) object names
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
To indicate the data type of a variable in a UML diagram you specify

A) the variable name followed by the data type
B) the class name followed by the variable name followed by the data type
C) the variable name followed by a colon and the data type
D) the data type followed by the variable name
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
For the following code, which statement is not true?
public class Sphere
{
Private double radius;
Public double x;
Private double y;
Private double z;
}

A) The z field is available to code written outside the Sphere class.
B) The radius field is not available to code written outside the Sphere class.
C) The radius, x, y, and z fields are members of the Sphere class.
D) The x field is available to code that is written outside the Sphere class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which is the key word used to import a class?

A) import
B) assume
C) use
D) link
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
A constructor is a method that

A) returns an object of the class
B) never receives any arguments
C) performs initialization or setup operations
D) removes the object from memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
What does the following UML diagram entry mean? + setHeight(h : double) : void

A) a public method with a parameter of data type double that does not return a value
B) a private field called setHeight that is a double data type
C) a private method with no parameters that returns a double data type
D) a public field called Height that is a double data type
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
When an argument is passed by value

A) the parameter variable holds the address of the argument
B) the parameter variable cannot be changed
C) the parameter variable holds a copy of the value passed to it
D) changes can be made to the argument variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
For the following code, which statement is not true?
public class Circle
{
Private double radius;
Public double x;
Private double y;
}

A) The y field is available to code written outside the Circle class.
B) The radius field is not available to code written outside the Circle class.
C) The radius, x, and y fields are members of the Circle class.
D) The x field is available to code that is written outside the Circle class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
If you do not provide initialization values for a class's numeric fields, they will

A) cause a runtime error
B) contain an unknown value
C) be automatically initialized to 0
D) cause a compiler error
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
A constructor

A) always accepts two arguments
B) has the same name as the class
C) has the return type of void
D) always has a private access specifier
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following is not involved in identifying the classes to be used when developing an object-oriented application?

A) Describe the problem domain.
B) Write the code.
C) Refine the list of nouns to include only those relevant to the problem.
D) Identify all the nouns.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
The key word new

A) creates a new class
B) creates a new Java byte code file
C) creates an object in memory
D) creates a new variable in memory
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
After the header, the body of the method appears inside a set of

A) braces, { }
B) parentheses, ( )
C) brackets, [ ]
D) double quotes, " "
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
What is the following statement an example of?
import java.util.*;

A) an explicit import statement
B) an unconditional import statement
C) a wildcard import statement
D) a conditional import statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
A method

A) may have zero or more parameters
B) never has parameter variables
C) must have at least two parameter variables
D) may not have only one parameter variable
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
It is common practice in object-oriented programming to make all of a class's

A) fields private
B) methods private
C) fields public
D) fields and methods public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
The scope of a local variable is

A) inside the parentheses of a method header
B) the method in which it is defined
C) inside the class but not inside any method
D) the entire class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
What is the following statement an example of?
import java.util.Scanner;

A) an explicit import statement
B) an unconditional import statement
C) a wildcard import statement
D) a conditional import statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.