Deck 3: Object-Oriented Programming, Part 1: Using Classes

ملء الشاشة (f)
exit full mode
سؤال
The automatic conversion from a primitive numeric type to its wrapper class is called:

A) boxing.
B) unboxing.
C) autoboxing.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The automatic conversion from a numeric wrapper class to the corresponding primitive numeric type is called:

A) boxing.
B) unboxing.
C) autoboxing.
سؤال
A way to convert a primitive data type into an object is to use __________ classes.
سؤال
In order to test if a character is a digit, we can use the Character class and its ________ method.
سؤال
The identifier of the object is called the:

A) instance variable.
B) instantiating object.
C) object reference.
D) instance of the class.
سؤال
Object references can refer to any object of its class.
سؤال
What is the relationship between an object and a class?

A) An object is used to debug a class.
B) A class describes a generic template for creating, or instantiating, objects.
C) A class can refer to any object of its object reference.
D) Object diagrams can refer to any object of its class.
سؤال
DaysOffWork ( ) a default constructor because its parameter list is empty.
سؤال
The argument list of a constructor consists of a comma-separated list of initial data values to assign to the object.
سؤال
The mutators are the _______ methods.

A) set
B) get
C) let
D) All of these are correct.
سؤال
nextDay ( ) can be used in an expression (the method header is public void nextDay( ) ).
سؤال
Java does not provide support for explicitly deleting an object.
سؤال
Java would generate a compiler error and a run-time error if you attempt to call a method using an object reference whose value is null.
سؤال
A Scanner object divides its input into sequences of characters called:

A) delimiters.
B) white spaces.
C) tokens.
D) object references.
سؤال
When writing code, you can include two forward slashes for a comment and then later replace them with back slashes to uncomment.
سؤال
Many of the commonly used classes, such as String and Math, reside in the java.lang package.
سؤال
indexOf methods are useful for searching a String for a specific String or character.
سؤال
In which package is the class Math?

A) java.lang
B) java.number
C) java.math
D) java.text
E) java.util
سؤال
Which keyword allows you to use a Java class inside a program?

A) include
B) class
C) import
D) package
E) with
سؤال
The charAt method returns the character at a particular index in a String.
سؤال
The constructor for the Random class is:

A) Random ( ).
B) int (Random).
C) nextRandom.
D) nullRandom.
سؤال
Computers are deterministic, so given a specific input to a specific set of instructions, a computer will always produce the same output.
سؤال
In Math.abs( -5 ), abs is a static method.
سؤال
The System class is in the java.lang package.
سؤال
What is the value of the expression Math.sqrt( 4 )?

A) 2.0
B) 0.0
C) 4.0
D) 1.0
سؤال
What is the value of the expression Math.pow( 3, 2 )?

A) 2.0
B) 3.0
C) 6.0
D) 8.0
E) 9.0
سؤال
We can instantiate an object from the NumberFormat class using the new keyword.
سؤال
Wrapper classes define an instance variable of a primitive data type and provide useful methods for converting the primitive data types into objects.
سؤال
In what package is the class Scanner?

A) java.lang
B) java.scanner
C) java.io
D) java.text
E) java.util
سؤال
What is the output of this code sequence?
String word = "Java";
System.out.println( word.length( ) );

A) 0
B) 1
C) 4
D) 5
سؤال
What is the output of this code sequence?
String word = "Java";
System.out.println( word.charAt( 1 ) );

A) J
B) a
C) v
D) "
سؤال
When an object reference is first declared, its value is null.
سؤال
Using a null object reference to call a method will not generate an error.
سؤال
String is in the java.string package.
سؤال
The length method of the String class takes no argument and returns an int.
سؤال
The first index of a String is 1.
سؤال
The DecimalFormat can be used to format a number by specifying a number of digits after the decimal point.
سؤال
The wrapper class for char is Char.
سؤال
The _________ class is used to get user input from the Java console.
سؤال
API stands for __________.
سؤال
The special method called when instantiating an object is a(n) __________.
سؤال
What keyword is used when instantiating an object?

A) Create
B) =
C) new
D) Object
E) is
سؤال
In which package is the class DecimalFormat?

A) java.lang
B) java.number
C) java.format
D) java.text
E) java.util
سؤال
The data type of System.out is:

A) Print.
B) PrintStream.
C) System.
D) Out.
E) IO.
سؤال
In which package is the class NumberFormat?

A) java.lang
B) java.number
C) java.format
D) java.text
E) java.util
سؤال
By convention, method names, instance variables, and object names start with a lowercase letter.
سؤال
The parameter list of a default constructor is empty.
سؤال
E and PI are two static data members of the Math class.
سؤال
The accessors are the get methods.
سؤال
The data associated with an object of a class are called __________.
سؤال
The operations for a class are called __________.
سؤال
The API of class methods has the keyword __________ before the return type.
سؤال
Java classes are organized in __________.
سؤال
One can generate random numbers using the ___________ class.
سؤال
What are the main benefits of using classes?
سؤال
Write a Java statement to import the DecimalFormat class from the appropriate package.
سؤال
Give one reason you would use the NumberFormat class.
سؤال
What does the following code do?
String s = "Hello";
s = s.toUpperCase( );
سؤال
Identify when you would use nextLine( ) in the Scanner class.
سؤال
Why do you think the String class is in the java.lang package?
سؤال
What would you automatically use to assign the char variable to a Character object reference?
سؤال
Which methods of the String class would you use to retrieve the user name from an email address whose format is username@provider?
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/62
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: Object-Oriented Programming, Part 1: Using Classes
1
The automatic conversion from a primitive numeric type to its wrapper class is called:

A) boxing.
B) unboxing.
C) autoboxing.
C
2
The automatic conversion from a numeric wrapper class to the corresponding primitive numeric type is called:

A) boxing.
B) unboxing.
C) autoboxing.
B
3
A way to convert a primitive data type into an object is to use __________ classes.
wrapper
4
In order to test if a character is a digit, we can use the Character class and its ________ method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
5
The identifier of the object is called the:

A) instance variable.
B) instantiating object.
C) object reference.
D) instance of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
6
Object references can refer to any object of its class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
7
What is the relationship between an object and a class?

A) An object is used to debug a class.
B) A class describes a generic template for creating, or instantiating, objects.
C) A class can refer to any object of its object reference.
D) Object diagrams can refer to any object of its class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
8
DaysOffWork ( ) a default constructor because its parameter list is empty.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
9
The argument list of a constructor consists of a comma-separated list of initial data values to assign to the object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
10
The mutators are the _______ methods.

A) set
B) get
C) let
D) All of these are correct.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
11
nextDay ( ) can be used in an expression (the method header is public void nextDay( ) ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
12
Java does not provide support for explicitly deleting an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
13
Java would generate a compiler error and a run-time error if you attempt to call a method using an object reference whose value is null.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
14
A Scanner object divides its input into sequences of characters called:

A) delimiters.
B) white spaces.
C) tokens.
D) object references.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
15
When writing code, you can include two forward slashes for a comment and then later replace them with back slashes to uncomment.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
16
Many of the commonly used classes, such as String and Math, reside in the java.lang package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
17
indexOf methods are useful for searching a String for a specific String or character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
18
In which package is the class Math?

A) java.lang
B) java.number
C) java.math
D) java.text
E) java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which keyword allows you to use a Java class inside a program?

A) include
B) class
C) import
D) package
E) with
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
20
The charAt method returns the character at a particular index in a String.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
21
The constructor for the Random class is:

A) Random ( ).
B) int (Random).
C) nextRandom.
D) nullRandom.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
22
Computers are deterministic, so given a specific input to a specific set of instructions, a computer will always produce the same output.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
23
In Math.abs( -5 ), abs is a static method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
24
The System class is in the java.lang package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
25
What is the value of the expression Math.sqrt( 4 )?

A) 2.0
B) 0.0
C) 4.0
D) 1.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
26
What is the value of the expression Math.pow( 3, 2 )?

A) 2.0
B) 3.0
C) 6.0
D) 8.0
E) 9.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
27
We can instantiate an object from the NumberFormat class using the new keyword.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
28
Wrapper classes define an instance variable of a primitive data type and provide useful methods for converting the primitive data types into objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
29
In what package is the class Scanner?

A) java.lang
B) java.scanner
C) java.io
D) java.text
E) java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
30
What is the output of this code sequence?
String word = "Java";
System.out.println( word.length( ) );

A) 0
B) 1
C) 4
D) 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
31
What is the output of this code sequence?
String word = "Java";
System.out.println( word.charAt( 1 ) );

A) J
B) a
C) v
D) "
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
32
When an object reference is first declared, its value is null.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
33
Using a null object reference to call a method will not generate an error.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
34
String is in the java.string package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
35
The length method of the String class takes no argument and returns an int.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
36
The first index of a String is 1.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
37
The DecimalFormat can be used to format a number by specifying a number of digits after the decimal point.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
38
The wrapper class for char is Char.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
39
The _________ class is used to get user input from the Java console.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
40
API stands for __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
41
The special method called when instantiating an object is a(n) __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
42
What keyword is used when instantiating an object?

A) Create
B) =
C) new
D) Object
E) is
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
43
In which package is the class DecimalFormat?

A) java.lang
B) java.number
C) java.format
D) java.text
E) java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
44
The data type of System.out is:

A) Print.
B) PrintStream.
C) System.
D) Out.
E) IO.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
45
In which package is the class NumberFormat?

A) java.lang
B) java.number
C) java.format
D) java.text
E) java.util
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
46
By convention, method names, instance variables, and object names start with a lowercase letter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
47
The parameter list of a default constructor is empty.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
48
E and PI are two static data members of the Math class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
49
The accessors are the get methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
50
The data associated with an object of a class are called __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
51
The operations for a class are called __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
52
The API of class methods has the keyword __________ before the return type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
53
Java classes are organized in __________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
54
One can generate random numbers using the ___________ class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
55
What are the main benefits of using classes?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
56
Write a Java statement to import the DecimalFormat class from the appropriate package.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
57
Give one reason you would use the NumberFormat class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
58
What does the following code do?
String s = "Hello";
s = s.toUpperCase( );
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
59
Identify when you would use nextLine( ) in the Scanner class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
60
Why do you think the String class is in the java.lang package?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
61
What would you automatically use to assign the char variable to a Character object reference?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
62
Which methods of the String class would you use to retrieve the user name from an email address whose format is username@provider?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 62 في هذه المجموعة.