Deck 11: Object-Oriented Programming and Arrays

ملء الشاشة (f)
exit full mode
سؤال
Typically, what's the first thing you should do you in a subclass constructor?

A) Initialize the properties to 0.
B) Call the superclass constructor with this(arguments);.
C) Call the superclass constructor with super(arguments);.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Suppose that you have a class named Student with a method named payFees and that you have instantiated an object named student. Which of the following is a proper call to the payFees method?

A) payFees();
B) student.payFees();
C) Student.payFees();
سؤال
The Array object's concat method returns a new array that is formed by concatenating the argument array to the end of the calling object array.
سؤال
An object has properties and methods. It is the properties that provide the interface with the outside world.
سؤال
OOP stands for ____________________.
سؤال
If the following code executes, what message displays in the resulting dialog box?
var x = 3.5;
alert(x > 3 ? x + 1 : x - 1);
سؤال
Why might it be appropriate for a button's onclick event-handler function to call its event object's stopPropagation method?
سؤال
Provide code that instantiates an array named carMakes such that the new array contains "Ford" and "Honda".
سؤال
Sort the following three strings so they are in ascending lexicographical order (words that are considered less than other words should be at the left).
"aardvark", "African polecat", "AARP"
سؤال
What is a two-dimensional array?
سؤال
The formal term for creating an object is:

A) objectification.
B) creation.
C) instantiation.
سؤال
What is the difference between a method heading and a function heading?

A) A method heading uses the word <code>method</code> at the left.
B) A function heading uses the word <code>function</code> at the left.
C) A method heading includes parameters and a function heading provides arguments.
D) A function heading includes parameters and a method heading provides arguments.
سؤال
If you declare a variable with <code>var</code>, but do not initialize it to a value, what will the variable contain?

A) <code>undefined</code>
B) <code>null</code>
C) 0
سؤال
Suppose an <code>onclick</code> event-handler function includes an <code>e</code> parameter for its passed-in event object. What code could be used to access the mouse pointer's x coordinate position?

A) <code>xValue</code>
B) <code>e.clientX</code>
C) <code>e.getXCoordinate();</code>
سؤال
Using the formal JavaScript inheritance terms, which of the following is true?

A) A subclass inherits from a superclass.
B) A superclass inherits from a subclass.
C) A generic class inherits from a specific class
سؤال
A class property is associated with a class as a whole, not with an individual instance of a class.
سؤال
To call a regular method, you preface the method name with an object and a dot. The object is referred to as a cotterized object.
سؤال
To emulate a class with legacy code, you implement a function whose name serves as a class name, and that function then serves as a constructor.
سؤال
Polymorphism refers to a variable's ability to change its type from a string to a number.
سؤال
A(n) __________ is a special method that gets called when there is an attempt to create an object.
سؤال
To sort an array of objects, you need to define a comparison function. The comparison function:

A) uses lexicographical ordering to perform the sort operation.
B) uses standard numerical ordering to perform the sort operation.
C) receives two elements from the array and returns a negative number, zero, or a positive number.
D) receives two elements from the array and returns true if the two elements should be swapped.
سؤال
If you would like to sort an array of date values, you should do which of the following?

A) Store the dates as strings because strings can be sorted more effectively than Date objects.
B) Store the dates as Date objects because Date objects can be sorted more effectively than strings.
C) Write an algorithm that parses date strings into their month, day, and year parts.
سؤال
The switch statement is most similar to which of the following?

A) "if by itself" form of the if statement
B) "if, else if " form of the if statement
C) while loop
D) do loop
سؤال
Suppose you have a subclass Truck, a superclass Vehicle, and a property in Vehicle named year. How can a method in Truck access the year property?

A) year
B) this.year
C) super.year
D) Vehicle.year
سؤال
When a function is called by another function (as opposed to when a function is called by an event handler attribute like onclick), the called function is known as a helper function.
سؤال
Legacy code is code that has improved over time to the point where it is now considered an exemplar of what good code should look like.
سؤال
The ______ method searches for a specified value within the calling object array's elements. It returns the index of the first element that holds the value.
سؤال
For the switch statement, if you need to do something special when there are no case constants that match the controlling expression's value, then you should use the keyword ______ at the bottom of the switch statement to handle that situation.
سؤال
To implement a subclass, you need to append the keyword ______ and then the superclass name to the end of the subclass's heading.
سؤال
UML stands for Unified __________ Language.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/30
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 11: Object-Oriented Programming and Arrays
1
Typically, what's the first thing you should do you in a subclass constructor?

A) Initialize the properties to 0.
B) Call the superclass constructor with this(arguments);.
C) Call the superclass constructor with super(arguments);.
C
2
Suppose that you have a class named Student with a method named payFees and that you have instantiated an object named student. Which of the following is a proper call to the payFees method?

A) payFees();
B) student.payFees();
C) Student.payFees();
B
3
The Array object's concat method returns a new array that is formed by concatenating the argument array to the end of the calling object array.
True
4
An object has properties and methods. It is the properties that provide the interface with the outside world.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
5
OOP stands for ____________________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
6
If the following code executes, what message displays in the resulting dialog box?
var x = 3.5;
alert(x > 3 ? x + 1 : x - 1);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
7
Why might it be appropriate for a button's onclick event-handler function to call its event object's stopPropagation method?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
8
Provide code that instantiates an array named carMakes such that the new array contains "Ford" and "Honda".
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
9
Sort the following three strings so they are in ascending lexicographical order (words that are considered less than other words should be at the left).
"aardvark", "African polecat", "AARP"
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
10
What is a two-dimensional array?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
11
The formal term for creating an object is:

A) objectification.
B) creation.
C) instantiation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
12
What is the difference between a method heading and a function heading?

A) A method heading uses the word <code>method</code> at the left.
B) A function heading uses the word <code>function</code> at the left.
C) A method heading includes parameters and a function heading provides arguments.
D) A function heading includes parameters and a method heading provides arguments.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
13
If you declare a variable with <code>var</code>, but do not initialize it to a value, what will the variable contain?

A) <code>undefined</code>
B) <code>null</code>
C) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
14
Suppose an <code>onclick</code> event-handler function includes an <code>e</code> parameter for its passed-in event object. What code could be used to access the mouse pointer's x coordinate position?

A) <code>xValue</code>
B) <code>e.clientX</code>
C) <code>e.getXCoordinate();</code>
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
15
Using the formal JavaScript inheritance terms, which of the following is true?

A) A subclass inherits from a superclass.
B) A superclass inherits from a subclass.
C) A generic class inherits from a specific class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
16
A class property is associated with a class as a whole, not with an individual instance of a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
17
To call a regular method, you preface the method name with an object and a dot. The object is referred to as a cotterized object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
18
To emulate a class with legacy code, you implement a function whose name serves as a class name, and that function then serves as a constructor.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
19
Polymorphism refers to a variable's ability to change its type from a string to a number.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
20
A(n) __________ is a special method that gets called when there is an attempt to create an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
21
To sort an array of objects, you need to define a comparison function. The comparison function:

A) uses lexicographical ordering to perform the sort operation.
B) uses standard numerical ordering to perform the sort operation.
C) receives two elements from the array and returns a negative number, zero, or a positive number.
D) receives two elements from the array and returns true if the two elements should be swapped.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
22
If you would like to sort an array of date values, you should do which of the following?

A) Store the dates as strings because strings can be sorted more effectively than Date objects.
B) Store the dates as Date objects because Date objects can be sorted more effectively than strings.
C) Write an algorithm that parses date strings into their month, day, and year parts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
23
The switch statement is most similar to which of the following?

A) "if by itself" form of the if statement
B) "if, else if " form of the if statement
C) while loop
D) do loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
24
Suppose you have a subclass Truck, a superclass Vehicle, and a property in Vehicle named year. How can a method in Truck access the year property?

A) year
B) this.year
C) super.year
D) Vehicle.year
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
25
When a function is called by another function (as opposed to when a function is called by an event handler attribute like onclick), the called function is known as a helper function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
26
Legacy code is code that has improved over time to the point where it is now considered an exemplar of what good code should look like.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
27
The ______ method searches for a specified value within the calling object array's elements. It returns the index of the first element that holds the value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
28
For the switch statement, if you need to do something special when there are no case constants that match the controlling expression's value, then you should use the keyword ______ at the bottom of the switch statement to handle that situation.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
29
To implement a subclass, you need to append the keyword ______ and then the superclass name to the end of the subclass's heading.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
30
UML stands for Unified __________ Language.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 30 في هذه المجموعة.