Deck 8: Object-Oriented Programming
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 8: Object-Oriented Programming
1
Encapsulation is the ability to make important object features available while hiding nonessential details, thereby focusing on the outside view of an object.
False
2
By default, any properties and methods that you define in a class are public , which means they can be accessed from outside the class.
True
3
With inheritance, it is possible to build an entire family of classes consisting of parents, children, grandchildren and siblings.
True
4
Encapsulation allows the internal representation of objects to be hidden from view outside the object definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The problem with using global variables is that they work against object-oriented programming principles.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
Polymorphism can be implemented within Ruby by assigning different names to different methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
A variable with a global scope can be accessed only within the method it was created in.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Abstraction is implemented through classes and includes the specification of both properties and methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
When included in a class definition, the initialize method is automatically executed any time an object is instantiated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
You should assign variables the lowest level of scope needed to provide the required access.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
Polymorphism is the process by which one class is derived from another class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Abstraction involves the restriction of access to one or more of the properties and methods defined within a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
To use the public , private , and protected keywords, you must place them on the same line as the property or method definitions for which you wish to specify access.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
With inheritance, the derived class, sometimes referred to as the child class, inherits all of the properties and methods of the parent class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
Access to any properties or methods that are defined after the occurrence of the public , private , and protected keywords is governed by that keyword, which remains in effect until either the end of the class is reached or a different level of encapsulation is specified.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
Local variables are accessible throughout a Ruby program and have an unlimited scope. Every class in the program is allowed to access them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
Polymorphism is the ability to define objects and methods in different forms.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
Inheritance makes program code more reliable by limiting access to just the areas within the program where access is required, which helps prevent accidental modification or execution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
To instantiate an object and initialize it with one or more properties in a single step you must use the initialize method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
One limitation of inheritance is that you cannot modify the inherited properties and methods or add new ones to customize child classes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
With ____ you can build an entire family of classes made up of parents, children, grandchildren, siblings, etc.
A) Polymorphism
B) Encapsulation
C) Abstraction
D) Inheritance
A) Polymorphism
B) Encapsulation
C) Abstraction
D) Inheritance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
____ is implemented through classes and includes the specification of both properties and methods.
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following methods can be used to instantiate and initialize and object in a single step?
A) open
B) new
C) initialize
D) init
A) open
B) new
C) initialize
D) init
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
Access specified by the public, private or protected keywords, remains in affect ____.
A) Only until the statement that following it is executed.
B) Only until the methods in which it is defined is executed.
C) Until either the end of the class is reached or a different level of encapsulation is specified.
D) None of the above
A) Only until the statement that following it is executed.
B) Only until the methods in which it is defined is executed.
C) Until either the end of the class is reached or a different level of encapsulation is specified.
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
By creating objects based on Ruby's built-in classes, you instantly get access to all the predefined methods that Ruby defines for those objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
To control access to the properties and methods within a class, you insert the ____ keyword into the class.
A) public
B) private
C) protected
D) All of the above
A) public
B) private
C) protected
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
____ is the process by which one class is derived from another class.
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
____ is the ability to define objects and methods in different forms.
A) Polymorphism
B) Encapsulation
C) Abstraction
D) Inheritance
A) Polymorphism
B) Encapsulation
C) Abstraction
D) Inheritance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
It is sometimes helpful to increase the scope of the variables to allow them to be referenced by all the methods in that class definition.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
The ____ keyword restricts the access of any specified properties or methods defined within the object itself.
A) public
B) private
C) protected
D) closed
A) public
B) private
C) protected
D) closed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
____ involves the restriction of access to one or more of the properties and methods defined within a class.
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
A) Inheritance
B) Encapsulation
C) Abstraction
D) Polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
A variable with a ____ scope can be accessed only within the scope that it was created in.
A) local
B) global
C) instance
D) class
A) local
B) global
C) instance
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
One way to implement ____ within Ruby is to assign the same name to different methods.
A) Encapsulation
B) Polymorphism
C) Abstraction
D) Inheritance
A) Encapsulation
B) Polymorphism
C) Abstraction
D) Inheritance
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
One of the limitations of working with Ruby's built-in classes is that you can read but not modify property values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
An advantage of chaining methods together is that you can perform complex tasks with a minimal amount of programming code.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
____ is an object-oriented feature that provides the ability to make important object features available while hiding nonessential details.
A) Abstraction
B) Encapsulation
C) Inheritance
D) Polymorphism
A) Abstraction
B) Encapsulation
C) Inheritance
D) Polymorphism
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
The ____ keyword makes any specified properties or methods available throughout the program.
A) public
B) private
C) protected
D) closed
A) public
B) private
C) protected
D) closed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
The ____ keyword restricts the access of any specified properties or methods to objects of the same class or objects of subclasses of the class.
A) public
B) private
C) protected
D) closed
A) public
B) private
C) protected
D) closed
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following types of variables is supported by Ruby?
A) Local
B) Global
C) Instance
D) All of the above
A) Local
B) Global
C) Instance
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
One limitation of working with Ruby classes is that Ruby does not permit programmer's to customize the language to meet programmer needs.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following statements is a benefit of using one of Ruby's built-in classes?
A) You simplify code development by eliminating the need to re-solve already solved programming tasks
B) You instantly get access to all of the pre-defined properties in that class.
C) You instantly get access to all of the pre-defined methods in that class.
D) All of the above
A) You simplify code development by eliminating the need to re-solve already solved programming tasks
B) You instantly get access to all of the pre-defined properties in that class.
C) You instantly get access to all of the pre-defined methods in that class.
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
@occurrences is an example of a(n) ____ variable.
A) local
B) global
C) instance
D) class
A) local
B) global
C) instance
D) class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Class variables begin with the ____ character.
A) @
B) @@
C) $
D) _
A) @
B) @@
C) $
D) _
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Instance variables begin with the ____ character.
A) @
B) @@
C) $
D) _
A) @
B) @@
C) $
D) _
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
____ variables are accessible throughout a Ruby program and have an unlimited scope. Every class in the program is allowed to access them.
A) Local
B) Global
C) Instance
D) Class
A) Local
B) Global
C) Instance
D) Class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
Local variables can begin with which of the following characters?
A) @
B) @@
C) $
D) _
A) @
B) @@
C) $
D) _
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
The following statements provide an example of ____ methods together. testArray = [1, 2, 3, 4, 5] puts testArray.sort.reverse.inspect
A) linking
B) chaining
C) connecting
D) binding
A) linking
B) chaining
C) connecting
D) binding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
Which of the following lists reflects a left-to-right increase in variable scope?
A) local, global, class, instance
B) local, class, instance, global
C) local, instance, class, global
D) instance, class, local, global
A) local, global, class, instance
B) local, class, instance, global
C) local, instance, class, global
D) instance, class, local, global
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
____ variables are similar to instance variables, except they are accessible to all the instances of the same class, which makes it easier to make repeated references to variables.
A) Local
B) Global
C) Class
D) None of the above
A) Local
B) Global
C) Class
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Global variables begin with the ____ character.
A) @
B) @@
C) $
D) _
A) @
B) @@
C) $
D) _
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck