Deck 8: Objects and Classes

ملء الشاشة (f)
exit full mode
سؤال
_________ returns the last character in a StringBuffer variable named strBuf? _________ returns the last character in a StringBuffer variable named strBuf?  <div style=padding-top: 35px>
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
________ is invoked to create an object. A. The main method
B) A method with a return type
C) A method with the void return type
D) A constructor
سؤال
What is the output of the following program? What is the output of the following program?  <div style=padding-top: 35px>
سؤال
Given the declaration Circle[] x = new Circle[10], which of the following statement is most accurate.

A) x contains an array of ten int values.
B) x contains a reference to an array and each element in the array can hold a Circle object.
C) x contains an array of ten objects of the Circle type.
D) x contains a reference to an array and each element in the array can hold a reference to a Circle object.
سؤال
Analyze the following code. Analyze the following code.   A. The program has a compile error because x has not been initialized. B. The program has a compile error because test is not initialized. C) The program has a runtime NullPointerException because test is null while executing test.x. D) The program has a compile error because you cannot create an object from the class that defines the object. E) The program has a compile error because Test does not have a default constructor.<div style=padding-top: 35px> A. The program has a compile error because x has not been initialized. B. The program has a compile error because test is not initialized.
C) The program has a runtime NullPointerException because test is null while executing test.x.
D) The program has a compile error because you cannot create an object from the class that defines the object.
E) The program has a compile error because Test does not have a default constructor.
سؤال
What is the printout for the third print statement in the main method? What is the printout for the third print statement in the main method?     A. j is 3 B. j is 2 C) j is 1 D) j is 0<div style=padding-top: 35px> What is the printout for the third print statement in the main method?     A. j is 3 B. j is 2 C) j is 1 D) j is 0<div style=padding-top: 35px> A. j is 3 B. j is 2
C) j is 1
D) j is 0
سؤال
Analyze the following code: Analyze the following code:   A. The program compiles and runs fine. B. The program has no compile errors but will get a runtime error because radius is not initialized. C) The program has compile errors because the variable radius is not initialized. D) The program has a compile error because a constant PI is defined inside a method.<div style=padding-top: 35px> A. The program compiles and runs fine. B. The program has no compile errors but will get a runtime error because radius is not initialized.
C) The program has compile errors because the variable radius is not initialized.
D) The program has a compile error because a constant PI is defined inside a method.
سؤال
When invoking a method with an object argument, ___________ is passed. A. a copy of the object
B) the object is copied, then the reference of the copied object
C) the reference of the object
D) the contents of the object
سؤال
What is the value of myCount.count displayed? <strong>What is the value of myCount.count displayed?  </strong> A) 99 B) 101 C) 100 D) 98 <div style=padding-top: 35px>

A) 99
B) 101
C) 100
D) 98
سؤال
  A. 0 B. 2 C) -2 D) -1 E) 1<div style=padding-top: 35px> A. 0 B. 2
C) -2
D) -1
E) 1
سؤال
Analyze the following code. Analyze the following code.   A. The program has a runtime error because s is not initialized, but it is referenced in the println statement. B. The program has a compile error because s is not initialized, but it is referenced in the println statement. C) The program has a runtime error because s is null in the println statement. D) The program compiles and runs fine.<div style=padding-top: 35px> A. The program has a runtime error because s is not initialized, but it is referenced in the println statement. B. The program has a compile error because s is not initialized, but it is referenced in the println statement.
C) The program has a runtime error because s is null in the println statement.
D) The program compiles and runs fine.
سؤال
Given the declaration Circle x = new Circle(), which of the following statement is most accurate. A. x contains an object of the Circle type.
B) You can assign an int value to x.
C) x contains a reference to a Circle object.
D) x contains an int value.
سؤال
Analyze the following code: <strong>Analyze the following code:  </strong> A) The program has compile errors because the variable radius is not initialized. B) The program compiles and runs fine. C) The program has no compile errors but will get a runtime error because radius is not initialized. D) The program has a compile error because a constant PI is defined inside a method. <div style=padding-top: 35px>

A) The program has compile errors because the variable radius is not initialized.
B) The program compiles and runs fine.
C) The program has no compile errors but will get a runtime error because radius is not initialized.
D) The program has a compile error because a constant PI is defined inside a method.
سؤال
Analyze the following code: Analyze the following code:   A. The program has a compile error because you cannot assign radius to radius. B. The program will compile, but you cannot create an object of Circle with a specified radius. The object will always have radius 0. C) The program does not compile because Circle does not have a default constructor. D) The program has a compilation error because it does not have a main method.<div style=padding-top: 35px> A. The program has a compile error because you cannot assign radius to radius. B. The program will compile, but you cannot create an object of Circle with a specified radius. The object will always have radius 0.
C) The program does not compile because Circle does not have a default constructor.
D) The program has a compilation error because it does not have a main method.
سؤال
Analyze the following code: Analyze the following code:   A. The program compiles and runs fine. B. The variable t is private and therefore cannot be accessed in the main method. C) The variable x is not initialized and therefore causes errors. D) t is non-static and it cannot be referenced in a static context in the main method. E) The variable t is not initialized and therefore causes errors.<div style=padding-top: 35px> A. The program compiles and runs fine. B. The variable t is private and therefore cannot be accessed in the main method.
C) The variable x is not initialized and therefore causes errors.
D) t is non-static and it cannot be referenced in a static context in the main method.
E) The variable t is not initialized and therefore causes errors.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/15
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 8: Objects and Classes
1
_________ returns the last character in a StringBuffer variable named strBuf? _________ returns the last character in a StringBuffer variable named strBuf?
D
2
________ is invoked to create an object. A. The main method
B) A method with a return type
C) A method with the void return type
D) A constructor
D
3
What is the output of the following program? What is the output of the following program?
D
4
Given the declaration Circle[] x = new Circle[10], which of the following statement is most accurate.

A) x contains an array of ten int values.
B) x contains a reference to an array and each element in the array can hold a Circle object.
C) x contains an array of ten objects of the Circle type.
D) x contains a reference to an array and each element in the array can hold a reference to a Circle object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
5
Analyze the following code. Analyze the following code.   A. The program has a compile error because x has not been initialized. B. The program has a compile error because test is not initialized. C) The program has a runtime NullPointerException because test is null while executing test.x. D) The program has a compile error because you cannot create an object from the class that defines the object. E) The program has a compile error because Test does not have a default constructor. A. The program has a compile error because x has not been initialized. B. The program has a compile error because test is not initialized.
C) The program has a runtime NullPointerException because test is null while executing test.x.
D) The program has a compile error because you cannot create an object from the class that defines the object.
E) The program has a compile error because Test does not have a default constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
6
What is the printout for the third print statement in the main method? What is the printout for the third print statement in the main method?     A. j is 3 B. j is 2 C) j is 1 D) j is 0 What is the printout for the third print statement in the main method?     A. j is 3 B. j is 2 C) j is 1 D) j is 0 A. j is 3 B. j is 2
C) j is 1
D) j is 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
7
Analyze the following code: Analyze the following code:   A. The program compiles and runs fine. B. The program has no compile errors but will get a runtime error because radius is not initialized. C) The program has compile errors because the variable radius is not initialized. D) The program has a compile error because a constant PI is defined inside a method. A. The program compiles and runs fine. B. The program has no compile errors but will get a runtime error because radius is not initialized.
C) The program has compile errors because the variable radius is not initialized.
D) The program has a compile error because a constant PI is defined inside a method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
8
When invoking a method with an object argument, ___________ is passed. A. a copy of the object
B) the object is copied, then the reference of the copied object
C) the reference of the object
D) the contents of the object
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
9
What is the value of myCount.count displayed? <strong>What is the value of myCount.count displayed?  </strong> A) 99 B) 101 C) 100 D) 98

A) 99
B) 101
C) 100
D) 98
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
10
  A. 0 B. 2 C) -2 D) -1 E) 1 A. 0 B. 2
C) -2
D) -1
E) 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
11
Analyze the following code. Analyze the following code.   A. The program has a runtime error because s is not initialized, but it is referenced in the println statement. B. The program has a compile error because s is not initialized, but it is referenced in the println statement. C) The program has a runtime error because s is null in the println statement. D) The program compiles and runs fine. A. The program has a runtime error because s is not initialized, but it is referenced in the println statement. B. The program has a compile error because s is not initialized, but it is referenced in the println statement.
C) The program has a runtime error because s is null in the println statement.
D) The program compiles and runs fine.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
12
Given the declaration Circle x = new Circle(), which of the following statement is most accurate. A. x contains an object of the Circle type.
B) You can assign an int value to x.
C) x contains a reference to a Circle object.
D) x contains an int value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
13
Analyze the following code: <strong>Analyze the following code:  </strong> A) The program has compile errors because the variable radius is not initialized. B) The program compiles and runs fine. C) The program has no compile errors but will get a runtime error because radius is not initialized. D) The program has a compile error because a constant PI is defined inside a method.

A) The program has compile errors because the variable radius is not initialized.
B) The program compiles and runs fine.
C) The program has no compile errors but will get a runtime error because radius is not initialized.
D) The program has a compile error because a constant PI is defined inside a method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
14
Analyze the following code: Analyze the following code:   A. The program has a compile error because you cannot assign radius to radius. B. The program will compile, but you cannot create an object of Circle with a specified radius. The object will always have radius 0. C) The program does not compile because Circle does not have a default constructor. D) The program has a compilation error because it does not have a main method. A. The program has a compile error because you cannot assign radius to radius. B. The program will compile, but you cannot create an object of Circle with a specified radius. The object will always have radius 0.
C) The program does not compile because Circle does not have a default constructor.
D) The program has a compilation error because it does not have a main method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
15
Analyze the following code: Analyze the following code:   A. The program compiles and runs fine. B. The variable t is private and therefore cannot be accessed in the main method. C) The variable x is not initialized and therefore causes errors. D) t is non-static and it cannot be referenced in a static context in the main method. E) The variable t is not initialized and therefore causes errors. A. The program compiles and runs fine. B. The variable t is private and therefore cannot be accessed in the main method.
C) The variable x is not initialized and therefore causes errors.
D) t is non-static and it cannot be referenced in a static context in the main method.
E) The variable t is not initialized and therefore causes errors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 15 في هذه المجموعة.