Deck 4: More Object Concepts
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/67
العب
ملء الشاشة (f)
Deck 4: More Object Concepts
1
When you write your own constructors, you cannot write versions that receive parameters.
False
2
You can use the keyword final with methods or classes.
True
3
If you give the same name to a class's instance field and to a local method variable, the instance variable overrides the method's local variable.
False
4
As long as you do not make any ambiguous method calls, a program that contains a potentially ambiguous situation will execute correctly.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
5
Object-oriented programmers use the term ____ when a child class contains a field or method that has the same name as one in the parent class.
A) out of scope
B) ambiguous
C) override
D) parent friendly
A) out of scope
B) ambiguous
C) override
D) parent friendly
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
6
A block can exist entirely within another block or entirely outside and separate from another block, and sometimes blocks can overlap.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
7
A locally declared variable always ____ another variable with the same name elsewhere in the class.
A) creates
B) masks
C) deletes
D) uses
A) creates
B) masks
C) deletes
D) uses
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
8
If an integer is passed to a method with a double parameter, the double is promoted to an integer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
9
It is illegal to declare the same variable name more than once within a block.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
10
It is a convenience to be able to use one reasonable name for ____ that are functionally identical except for argument types.
A) arguments
B) classes
C) tasks
D) packages
A) arguments
B) classes
C) tasks
D) packages
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
11
A disadvantage of Java is the large memory requirements to store a separate copy of each variable and method for each instantiation of a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
12
When you properly ____ a method, you can call it providing different argument lists, and the appropriate version of the method executes.
A) declare
B) overload
C) name
D) delete
A) declare
B) overload
C) name
D) delete
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
13
Within any class or method, the code between a pair of curly braces is called a(n) ____.
A) overload
B) argument
C) scope
D) block
A) overload
B) argument
C) scope
D) block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
14
____ involves using one term to indicate diverse meanings, or writing multiple methods with the same name but with different parameter lists.
A) Referencing
B) Overloading
C) Nesting
D) Signing
A) Referencing
B) Overloading
C) Nesting
D) Signing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
15
When they have the same name, variables within ____ of a class override the class's fields.
A) packages
B) statements
C) fields
D) methods
A) packages
B) statements
C) fields
D) methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
16
A variable comes into existence, or ____, when you declare it.
A) goes out of scope
B) comes into scope
C) overrides scope
D) is referenced
A) goes out of scope
B) comes into scope
C) overrides scope
D) is referenced
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
17
An alternative to importing a class is to import an entire package of classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
18
When an application contains just one version of a method, you can call the method using a(n) ____ of the correct data type.
A) parameter
B) scope
C) output
D) constructor
A) parameter
B) scope
C) output
D) constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
19
A method can receive ____ arguments, even if it is defined as needing double arguments.
A) string
B) integer
C) constructor
D) send
A) string
B) integer
C) constructor
D) send
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
20
When you overload a Java method, you write multiple methods with a shared name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
21
It is not necessary to create an instance of the Math class because the constants and methods of the class are ____.
A) void
B) final
C) static
D) public
A) void
B) final
C) static
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
22
When calling this() from a constructor, it must be the ____ statement within the constructor.
A) first
B) ending
C) second
D) indented
A) first
B) ending
C) second
D) indented
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
23
When you instantiate an object from a class, ____ is reserved for each instance field in the class.
A) a constructor
B) a signature
C) memory
D) a field name
A) a constructor
B) a signature
C) memory
D) a field name
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
24
____ variables are variables that are shared by every instantiation of a class.
A) Integer
B) Instance
C) Class
D) Time
A) Integer
B) Instance
C) Class
D) Time
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
25
If a class's only constructor requires an argument, you must provide an argument for every ____ of the class that you create.
A) parameter
B) type
C) object
D) method
A) parameter
B) type
C) object
D) method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
26
When you ____________________ methods, you risk creating an ambiguous situation-one in which the compiler cannot determine which method to use.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
27
Another name for a nonstatic member class is a(n) ____.
A) static member class
B) inner class
C) local class
D) anonymous class
A) static member class
B) inner class
C) local class
D) anonymous class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
28
When an object of one class is a data field within another class, they are related by ____.
A) extension
B) scope
C) composition
D) is-a
A) extension
B) scope
C) composition
D) is-a
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
29
You can use the asterisk (*) as a ____, which indicates that it can be replaced by any set of characters.
A) magic number
B) wildcard symbol
C) character symbol
D) placeholder
A) magic number
B) wildcard symbol
C) character symbol
D) placeholder
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
30
You can use ____ arguments to initialize field values, but you can also use arguments for any other purpose.
A) object
B) constructor
C) data
D) field
A) object
B) constructor
C) data
D) field
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
31
The compiler determines which version of a method to call by the method's ____.
A) name
B) signature
C) output
D) constructor
A) name
B) signature
C) output
D) constructor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
32
In a Java ____________________ statement, you use a wildcard symbol to represent all the classes in a package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
33
The keyword ____ indicates that a field value is unalterable.
A) end
B) final
C) permanent
D) static
A) end
B) final
C) permanent
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
34
A(n) ____________________ begins immediately after the method declaration and ends at the end of the method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
35
A(n) ____________________ is simply a folder that provides a convenient grouping for classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
36
Due to automatic type promotion, when a method with a double parameter is passed an integer, the integer will be promoted to a(n) ____.
A) integer
B) short
C) boolean
D) double
A) integer
B) short
C) boolean
D) double
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
37
The ____ statement notifies the program that you will be using the data and method names that are part of the imported class or package.
A) use
B) package
C) class
D) import
A) use
B) package
C) class
D) import
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
38
The reference to an object that is passed to any object's nonstatic class method is called the ____.
A) magic number
B) this reference
C) literal constant
D) reference
A) magic number
B) this reference
C) literal constant
D) reference
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
39
The ____ package contains frequently used classes and is implicitly imported into Java programs.
A) javax.swing
B) java.lang
C) JOptionPane
D) System
A) javax.swing
B) java.lang
C) JOptionPane
D) System
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
40
When you pass a(n) ____________________, you pass a memory address.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
41
int aMethod(int x)
void aMethod(int x)
In the above statements, explain why these two methods are illegal in the class.
void aMethod(int x)
In the above statements, explain why these two methods are illegal in the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
42
Describe the impact that blocks and methods have on variables with the same name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
43
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Useful when working with dates and times
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Useful when working with dates and times
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
44
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Variables associated with individual objects
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Variables associated with individual objects
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
45
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
An illegal action
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
An illegal action
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
46
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Defines mathematical constants such as PI
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Defines mathematical constants such as PI
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
47
What are the four types of nested classes?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
48
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
No object associated with them
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
No object associated with them
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
49
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Created using the keyword final
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Created using the keyword final
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
50
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
A variable comes into existence
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
A variable comes into existence
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
51
Describe and provide an example of overloading.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
52
Using an example, explain how nested blocks are created.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
53
What does a programmer need to know in order to use two variables with the same name in a class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
54
What is a reference and what is the meaning of the keyword this?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
55
What is the difference between class variables and instance variables?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
56
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Using one term to indicate diverse meanings
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Using one term to indicate diverse meanings
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
57
Describe how a programmer can make a variable in or out of scope.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
58
Match each term with the correct statement below.
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Must be explicitly named in an import statement
a.optional classes
f.Math class
b.instance variables
g.redeclaring a variable
c.comes into scope
h.GregorianCalendar
d.class methods
i.constant
e.overloading
Must be explicitly named in an import statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
59
What are the three methods that enable you to incorporate prewritten classes with your programs?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
60
How does an overloaded method become ambiguous, and why might a programmer not be able to see a problem?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
61
Describe the purpose of creating and calling constructors that receive parameters. Why would you overload constructors?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
62
Explain the java.lang package and why it is important. How does this relate to the java.lang.Math class?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
63
Declare a GregorianCalendar object named year. Use the GregorianCalendar class and the get() method to display the current year in a println statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
64
public class StudentScores
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Using the code above, fill in the blank lines provided to create a constructor that will require parameters for the three score data fields. Be sure to include the necessary brackets and semicolons.
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Using the code above, fill in the blank lines provided to create a constructor that will require parameters for the three score data fields. Be sure to include the necessary brackets and semicolons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
65
public class StudentScores
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Suppose you want to assign all students a score of 95 on the third test. Using the code above, fill in the blank lines provided to create a two-parameter constructor that will require parameters for the first and second test score data fields, and will assign a value of 95 to the third test score data field. Be sure to include the necessary brackets and semicolons.
{
private int ScoreOne;
private int ScoreTwo;
private int ScoreThree;
____
____
____
____
____
}
Suppose you want to assign all students a score of 95 on the third test. Using the code above, fill in the blank lines provided to create a two-parameter constructor that will require parameters for the first and second test score data fields, and will assign a value of 95 to the third test score data field. Be sure to include the necessary brackets and semicolons.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
66
What does it mean when a variable overrides another variable? Describe the process of declaring variables in methods and memory locations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck
67
When working with the GregorianCalendar class, what is the statement that will import the GregorianCalendar class using the full class path? Likewise, what statement will import the GregorianCalendar class and any other java.util classes?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 67 في هذه المجموعة.
فتح الحزمة
k this deck