Deck 3: Working With Strings, Objects, and Variables

Full screen (f)
exit full mode
Question
Concatenation is performed using the & character.
Use Space or
up arrow
down arrow
to flip the card.
Question
Interpolation is the process of substituting the value of an expression or variable inside a string.
Question
Objects are partially self-contained entities designed to work with methods and properties stored externally to itself.
Question
Escape characters provide the ability to embed instructions into text strings that tell Ruby how to format displayed text.
Question
Single-quoted strings support both escaping and variable substitution.
Question
You can create new strings by multiplying existing strings using the String class's * method.
Question
Concatenation is the process of splitting a string into two smaller strings.
Question
Ruby is not an object-oriented programming language.
Question
An attr_accessor is a keyword that identifies a list of one or more object properties.
Question
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.
Question
To compare two strings to see if they are equal the = operator must be used.
Question
Objet properties are implemented as named variables.
Question
When working with #{} , Ruby is able to perform variable substitution.
Question
A method is an object attribute stored as a variable that describes a particular aspect or feature of the object.
Question
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.
Question
Creating a string by embedding characters inside the %q{ and } characters is equivalent to embedding them within double quotes.
Question
new is a method that initiates the creation of a new object.
Question
The String class's swapcase method converts a string to all uppercase letters.
Question
When working with double-quotes, Ruby is not able to perform escaping.
Question
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.
Question
Which of the following variable names is invalid?

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

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

A) Case sensitive
B) Case insensitive
C) Case neutral
D) None of the above
Question
The childclass operator is used to create a new class based on an existing (parent) class.
Question
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
Question
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
Question
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
Question
Which of the following methods does not belong to the String class?

A) capitalize
B) chop
C) reverse
D) None of the above
Question
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
Question
Which of the following operators is the Ruby assignment operator?

A) ==
B) equals
C) =
D) None of the above
Question
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.
Question
Which of the following variable names is valid?

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

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

A) +_+
B) +=
C) =,=
D) plus
Question
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
Question
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
Question
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
Question
A module is a container use to group classes, method, and constants.
Question
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
Question
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
Question
Which of the following constructions is used as the basis for defining objects?

A) Method
B) Class
C) Property
D) None of the above
Question
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
Question
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
Question
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
Question
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
Question
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
Question
Ruby provides the ability to generate random numbers using what method?

A) random
B) rand
C) r_!
D) None of the above
Question
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
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Single-quoted strings support both escaping and variable substitution.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
You can create new strings by multiplying existing strings using the String class's * method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Concatenation is the process of splitting a string into two smaller strings.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Ruby is not an object-oriented programming language.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
An attr_accessor is a keyword that identifies a list of one or more object properties.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
To compare two strings to see if they are equal the = operator must be used.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Objet properties are implemented as named variables.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
When working with #{} , Ruby is able to perform variable substitution.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
A method is an object attribute stored as a variable that describes a particular aspect or feature of the object.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Creating a string by embedding characters inside the %q{ and } characters is equivalent to embedding them within double quotes.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
new is a method that initiates the creation of a new object.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
The String class's swapcase method converts a string to all uppercase letters.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
When working with double-quotes, Ruby is not able to perform escaping.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Which of the following variable names is invalid?

A) Final Score
B) Player#
C) @Score
D) All of the above
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Ruby variable names are:

A) Case sensitive
B) Case insensitive
C) Case neutral
D) None of the above
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
The childclass operator is used to create a new class based on an existing (parent) class.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following operators is the Ruby assignment operator?

A) ==
B) equals
C) =
D) None of the above
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following variable names is valid?

A) Total Score
B) TotalScore
C) 123Count
D) Score#
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
Ruby requires that programmers specify a numeric class type, otherwise errors occur.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Which of the following operators can be used to automatically increment a variable's value?

A) +_+
B) +=
C) =,=
D) plus
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
A module is a container use to group classes, method, and constants.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
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
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.