Deck 3: Working With Strings, Objects, and Variables

ملء الشاشة (f)
exit full mode
سؤال
Concatenation is performed using the & character.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Interpolation is the process of substituting the value of an expression or variable inside a string.
سؤال
Objects are partially self-contained entities designed to work with methods and properties stored externally to itself.
سؤال
Escape characters provide the ability to embed instructions into text strings that tell Ruby how to format displayed text.
سؤال
Single-quoted strings support both escaping and variable substitution.
سؤال
You can create new strings by multiplying existing strings using the String class's * method.
سؤال
Concatenation is the process of splitting a string into two smaller strings.
سؤال
Ruby is not an object-oriented programming language.
سؤال
An attr_accessor is a keyword that identifies a list of one or more object properties.
سؤال
Text plays a big role in many scripts when communicating with users. Text strings in Ruby can consist of letters, numbers, special characters and even blank spaces.
سؤال
To compare two strings to see if they are equal the = operator must be used.
سؤال
Objet properties are implemented as named variables.
سؤال
When working with #{} , Ruby is able to perform variable substitution.
سؤال
A method is an object attribute stored as a variable that describes a particular aspect or feature of the object.
سؤال
When creating multiline text strings using the %q{ and } and %Q{ and } characters, you can substitute any characters you wish in place of the { and } characters.
سؤال
Creating a string by embedding characters inside the %q{ and } characters is equivalent to embedding them within double quotes.
سؤال
new is a method that initiates the creation of a new object.
سؤال
The String class's swapcase method converts a string to all uppercase letters.
سؤال
When working with double-quotes, Ruby is not able to perform escaping.
سؤال
The advantage of using %q{ and } and %Q{ and } characters in place of quotation marks is that these characters allow for the creation of strings that span multiple lines.
سؤال
Which of the following variable names is invalid?

A) Final Score
B) Player#
C) @Score
D) All of the above
سؤال
Ruby supports a number of different types of numeric classes, including all of the following except ____.

A) Integer
B) Float
C) String
D) Fixnum
سؤال
Inheritance is an object-oriented process that allows one class to be used as the basis for the definition of another class.
سؤال
Ruby variable names are:

A) Case sensitive
B) Case insensitive
C) Case neutral
D) None of the above
سؤال
The childclass operator is used to create a new class based on an existing (parent) class.
سؤال
Which of the following methods should be used to convert a numeric value to an integer?

A) i!
B) int_conv
C) to_int
D) to_i
سؤال
In Ruby variable scope is indicated by the first character in a variable's name. The character used to specify a global variable is?

A) $
B) @
C) @@
D) None of the above
سؤال
In Ruby variable names must be formulated in accordance in a very specific set of rules. These rules includes all of the following except:

A) Variable names must begin with a number
B) Variable names cannot include underscore characters
C) Variable names may include blank spaces
D) All of the above
سؤال
Which of the following methods does not belong to the String class?

A) capitalize
B) chop
C) reverse
D) None of the above
سؤال
When the user presses Enter in order to submit input, Ruby automatically appends an end of line marker to the end of the input. This end of line marker can be removed using what method?

A) chop
B) cut
C) remove
D) None of the above
سؤال
Which of the following operators is the Ruby assignment operator?

A) ==
B) equals
C) =
D) None of the above
سؤال
One of the primary benefits of object-oriented programming is its ability to allow programmers to model the creation of classes based on real life concepts.
سؤال
Which of the following variable names is valid?

A) Total Score
B) TotalScore
C) 123Count
D) Score#
سؤال
Ruby requires that programmers specify a numeric class type, otherwise errors occur.
سؤال
Ruby supports a number of different types of scope, including ____.

A) Local
B) Remote
C) Module
D) None of the above
سؤال
Which of the following operators can be used to automatically increment a variable's value?

A) +_+
B) +=
C) =,=
D) plus
سؤال
Which of the following escape characters can be used to embed a new line feed instruction inside a text string?

A) \b
B) \f
C) \n
D) \t
سؤال
A numeric value can be converted to a string using which of the following methods?

A) to_t
B) to_text
C) conv_t
D) to_s
سؤال
Which of the following statements correctly defines local variable scope?

A) Scope is limited to objects of the class
B) Scope has not limit
C) Scope is limited to the loop, module, class or method in which it is defined
D) None of the above
سؤال
A module is a container use to group classes, method, and constants.
سؤال
One of the differences between Ruby and many other programming languages is that ____.

A) Ruby Rill halt script execution if an attempt is made to change a constant's value
B) Ruby will allow the same name to be assigned to both a constant and a variable
C) Ruby will generate an error is a constant's value is change but will not halt script execution
D) None of the above
سؤال
Which of the following is a valid string?

A) " Once upon a time"
B) "1 2 3 4 5"
C) %Q{Once upon a time}
D) All of the above
سؤال
Which of the following constructions is used as the basis for defining objects?

A) Method
B) Class
C) Property
D) None of the above
سؤال
Which of the following is not true about Ruby?

A) It is an object-oriented language
B) It is an interpreted language
C) It is a case-sensitive language
D) None of the above
سؤال
A case code block is ____.

A) A structure for implementing conditional logic
B) A structure for implementing a loop
C) A structure for creating complex arrays
D) None of the above
سؤال
A loop is ____.

A) A structure for implementing conditional logic
B) A collection of program statements that are repeatedly executed
C) A program statement that allows a script to be restarted
D) None of the above
سؤال
Which of the following statements is false?

A) Ruby permits an existing class to be used as the basis for defining a new class
B) Child classes must be identical to the parent class upon which they are based and cannot be further modified
C) Custom classes can be used to model the creation of real life concepts
D) All of the above
سؤال
A constant is very similar to variable, expect that:

A) A constant's value cannot be changed without generating an error
B) A constant's value is limited to string data
C) Constants can only be defined with local scope
D) None of the above
سؤال
Ruby provides the ability to generate random numbers using what method?

A) random
B) rand
C) r_!
D) None of the above
سؤال
Which of the following is a true statement about constants?

A) Constant names must begin with the underscore character
B) Constant names must begin with a capital letter
C) Constant names are limited to a maximum of 12 characters
D) Both b and c
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 3: Working With Strings, Objects, and Variables
1
Concatenation is performed using the & character.
False
2
Interpolation is the process of substituting the value of an expression or variable inside a string.
True
3
Objects are partially self-contained entities designed to work with methods and properties stored externally to itself.
False
4
Escape characters provide the ability to embed instructions into text strings that tell Ruby how to format displayed text.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
Single-quoted strings support both escaping and variable substitution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
You can create new strings by multiplying existing strings using the String class's * method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
Concatenation is the process of splitting a string into two smaller strings.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Ruby is not an object-oriented programming language.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
An attr_accessor is a keyword that identifies a list of one or more object properties.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
Text plays a big role in many scripts when communicating with users. Text strings in Ruby can consist of letters, numbers, special characters and even blank spaces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
To compare two strings to see if they are equal the = operator must be used.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
Objet properties are implemented as named variables.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
When working with #{} , Ruby is able to perform variable substitution.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
A method is an object attribute stored as a variable that describes a particular aspect or feature of the object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
When creating multiline text strings using the %q{ and } and %Q{ and } characters, you can substitute any characters you wish in place of the { and } characters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
Creating a string by embedding characters inside the %q{ and } characters is equivalent to embedding them within double quotes.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
new is a method that initiates the creation of a new object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
The String class's swapcase method converts a string to all uppercase letters.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
When working with double-quotes, Ruby is not able to perform escaping.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
The advantage of using %q{ and } and %Q{ and } characters in place of quotation marks is that these characters allow for the creation of strings that span multiple lines.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following variable names is invalid?

A) Final Score
B) Player#
C) @Score
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
Ruby supports a number of different types of numeric classes, including all of the following except ____.

A) Integer
B) Float
C) String
D) Fixnum
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Inheritance is an object-oriented process that allows one class to be used as the basis for the definition of another class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
Ruby variable names are:

A) Case sensitive
B) Case insensitive
C) Case neutral
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
The childclass operator is used to create a new class based on an existing (parent) class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which of the following methods should be used to convert a numeric value to an integer?

A) i!
B) int_conv
C) to_int
D) to_i
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
In Ruby variable scope is indicated by the first character in a variable's name. The character used to specify a global variable is?

A) $
B) @
C) @@
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
In Ruby variable names must be formulated in accordance in a very specific set of rules. These rules includes all of the following except:

A) Variable names must begin with a number
B) Variable names cannot include underscore characters
C) Variable names may include blank spaces
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
Which of the following methods does not belong to the String class?

A) capitalize
B) chop
C) reverse
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
When the user presses Enter in order to submit input, Ruby automatically appends an end of line marker to the end of the input. This end of line marker can be removed using what method?

A) chop
B) cut
C) remove
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the following operators is the Ruby assignment operator?

A) ==
B) equals
C) =
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
One of the primary benefits of object-oriented programming is its ability to allow programmers to model the creation of classes based on real life concepts.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
Which of the following variable names is valid?

A) Total Score
B) TotalScore
C) 123Count
D) Score#
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
Ruby requires that programmers specify a numeric class type, otherwise errors occur.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
Ruby supports a number of different types of scope, including ____.

A) Local
B) Remote
C) Module
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following operators can be used to automatically increment a variable's value?

A) +_+
B) +=
C) =,=
D) plus
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
Which of the following escape characters can be used to embed a new line feed instruction inside a text string?

A) \b
B) \f
C) \n
D) \t
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
A numeric value can be converted to a string using which of the following methods?

A) to_t
B) to_text
C) conv_t
D) to_s
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
Which of the following statements correctly defines local variable scope?

A) Scope is limited to objects of the class
B) Scope has not limit
C) Scope is limited to the loop, module, class or method in which it is defined
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
A module is a container use to group classes, method, and constants.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
One of the differences between Ruby and many other programming languages is that ____.

A) Ruby Rill halt script execution if an attempt is made to change a constant's value
B) Ruby will allow the same name to be assigned to both a constant and a variable
C) Ruby will generate an error is a constant's value is change but will not halt script execution
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following is a valid string?

A) " Once upon a time"
B) "1 2 3 4 5"
C) %Q{Once upon a time}
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
Which of the following constructions is used as the basis for defining objects?

A) Method
B) Class
C) Property
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
Which of the following is not true about Ruby?

A) It is an object-oriented language
B) It is an interpreted language
C) It is a case-sensitive language
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
A case code block is ____.

A) A structure for implementing conditional logic
B) A structure for implementing a loop
C) A structure for creating complex arrays
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
A loop is ____.

A) A structure for implementing conditional logic
B) A collection of program statements that are repeatedly executed
C) A program statement that allows a script to be restarted
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following statements is false?

A) Ruby permits an existing class to be used as the basis for defining a new class
B) Child classes must be identical to the parent class upon which they are based and cannot be further modified
C) Custom classes can be used to model the creation of real life concepts
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
A constant is very similar to variable, expect that:

A) A constant's value cannot be changed without generating an error
B) A constant's value is limited to string data
C) Constants can only be defined with local scope
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
Ruby provides the ability to generate random numbers using what method?

A) random
B) rand
C) r_!
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following is a true statement about constants?

A) Constant names must begin with the underscore character
B) Constant names must begin with a capital letter
C) Constant names are limited to a maximum of 12 characters
D) Both b and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.