Deck 2: Interacting With Ruby

ملء الشاشة (f)
exit full mode
سؤال
Unlike the print method the puts method displays text strings on separate lines.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A method is a collection of statements that is predefined within a class that can be used to interact with and control the operation of objects created based on the class.
سؤال
You can access a special Internet based version of the IRB by visiting http://tryruby.org/.
سؤال
Arithmetic expressions are evaluated based on a predetermined order referred to as the order of examination .
سؤال
A floating point value is a number that does not include a decimal point.
سؤال
Using the IRB you can gain insight as to the way Ruby keyboards, operators, and commands work.
سؤال
An expression is a series of keywords, operators and variables that when processed returns a result.
سؤال
The IRB is started from the operating system command prompt by entering start irb and pressing Enter.
سؤال
A class is a definition or template used as the basis for defining a new object and does not do anything by itself.
سؤال
Ruby programmers often use the IRB to test the execution of numeric expression like a calculator.
سؤال
By default, any time two integer numbers are divided in Ruby, the value that is returned is always an integer.
سؤال
The term instantiation describes a process whereby a new object is created.
سؤال
In addition to RDoc, you can view Ruby documentation using either the ri or the vd command line commands on your computer.
سؤال
The print method displays a line of text on the screen.
سؤال
You can easily access the documentation for most Ruby class methods via a system referred to as RDoc.
سؤال
You can access RDoc online at http://www.ruby-doc.org/.
سؤال
The term IRB stands for Interactive Ruby.
سؤال
Unlike other programming languages, Ruby does not require programmers to follow any language specific rules.
سؤال
In order to instantiate a new object you must use the new keyword.
سؤال
Nil is a value that representing a value of 0.
سؤال
Which of the following commands display a line of text on the screen?

A) puts
B) display
C) print
D) both a and c
سؤال
What value will the following expression evaluate to ____. irb(main):010:0> 7 * 4 / 3 - 4 % 3 + 8

A) 16
B) 14
C) 4
D) 20
سؤال
Which of the following statements is not true?

A) An object is created based on a predefined class template
B) An object inherits all of the features of the class upon which it is based
C) An object is a template that is used to define a class
D) None of the above
سؤال
The IRB does not provide access to classes, objects or variables more than 5 minutes old.
سؤال
Which of the following statements is not true?

A) All IRB sessions share a common memory space.
B) Classes, methods and variables that are defined in one IRB are not accessible in another session.
C) New IRB sessions can be started by opening a new console window and typing IRB.
D) New IRB sessions cane be started from within an existing irb accessing by typing IRB.
سؤال
An IRB session can by terminated by all of the following command except ____.

A) exit
B) irb_quit
C) irb -v
D) irb_exit
سؤال
In addition to the standard set of mathematical operator methods, Ruby also provides you with access to a collection of mathematical methods stored in which module?

A) Trig
B) Calculus
C) Math
D) Arithmetic
سؤال
You can instruct the IRB to load and execute a script named test.rb in c:\Ruby_Scripts\ using which of the following commands?

A) load 'c:\Ruby_Scripts\test.rb'
B) copy 'c:\Ruby_Scripts\test.rb'
C) run 'c:\Ruby_Scripts\test.rb'
D) execute 'c:\Ruby_Scripts\test.rb'
سؤال
A misspelled command is an example of what type or error?

A) Logical
B) Syntax
C) Runtime
D) None of the above
سؤال
Parentheses or quotation marks can be used to override the order of precedence.
سؤال
If you require a greater level of precision when working with numeric data, you must specify floating-point numbers (e.g. numbers with a decimal)
سؤال
The * operator is used to perform ____.

A) Addition
B) Multiplication
C) Division
D) Exponentiation
سؤال
The % operator is used to perform ____.

A) Addition
B) Multiplication
C) Division
D) Modulus
سؤال
The IRB ____.

A) Provides Ruby programmers with command line access to the Ruby parser.
B) Can be used to test the effects of Ruby statements.
C) Can be used to load and execute entire scripts.
D) All of the above.
سؤال
The math module includes many different types of methods that support advanced mathematical operations. Examples of the methods provided by this module include ____.

A) sqrt
B) acos
C) cos
D) All of the above
سؤال
The command irb -v ____.

A) Starts the IRB and displays its version number
B) Starts the IRB in a special graphic interface mode
C) Closes the IRB
D) None of the above
سؤال
When working with module methods, you can refer to methods using upper or lower case spelling, just as long as you properly spell the method's name.
سؤال
If you enter an incomplete Ruby statement into the IRB, it will ____.

A) Execute the incomplete statements and generate an error
B) Display a modified command prompt and wait on you to finish entering the statement
C) Display a warning message and reject your input
D) None of the above
سؤال
Failure to follow Ruby's syntax rules when formulating script statements can result in an error that prevents your script from executing.
سؤال
When working with the IRB, you can ____.

A) Pass the IRB a number of statements
B) Pass the name of a Ruby script you want to execute
C) Pass the name of a Ruby script along with arguments for that script
D) All of the above.
سؤال
Ruby supports thousands of methods. You can use the ____ system to access documentation on these methods.

A) ri
B) RDoc
C) DocView
D) a and b
سؤال
You can retrieve player input using which of the STDIN class's methods?

A) puts
B) gets
C) retrieve
D) catch
سؤال
A method ____.

A) Is a collection of statements defined within a class
B) Can be used to interact with objects
C) Can be used to control the operation of an object
D) All of the above
سؤال
What value will the following expression evaluate to? irb(main):010:0> (4 + 7) * 3 - 7 / (2 + 5) ** 2

A) 45
B) 25
C) 33
D) 47
سؤال
In Ruby variable substitution is performed within a string by placing a variable name within what set of characters?

A) %Q{ and }
B) #{ and }
C) %{ and }
D) { and }
سؤال
According to Ruby's order of precedence, arithmetic expressions are resolved in which of the following orders?

A) Exponentiation > multiplication, division, modulus > addition, subtraction
B) Modulus > exponentiation > division, modulus > addition, subtraction
C) Addition, subtraction, division, multiplication > modulus, exponentiation
D) None of the above
سؤال
Which of the following is a valid way of creating a string within a Ruby statement?

A) Embed text within an opening %Q{ and } characters.
B) Embed text within a pair of double quotation marks.
C) Embed text within a pair of single quotation marks.
D) Both a and b.
سؤال
The round method is associated with many different classes, including all of the following except ____.

A) Numeric
B) Integer
C) Float
D) String
سؤال
Within your Ruby scripts, an escape character is a pair of characters that begin with the ____ character followed by a letter.

A) #
B) _
C) !
D) \
سؤال
Which of the following command line commands will allow you to view information about the Numeric class's round method?

A) ri.numeric.round
B) ri numeric(round)
C) vd numeric.round
D) ri Numeric.round
سؤال
The following statement shows and incomplete statement entered into the IRB. irb(main):003:0> 5 - 1 + What of the following examples shows the modified command prompt that the IRB will display next?

A) irb(main):004:7:*
B) irb(input):004:0:>
C) irb(main):004:0*
D) irb(multi):004:0:
سؤال
What value will the following expression evaluate to? irb(main):010:0> 4 + 7 * 3 - 7 / 2 + 5 ** 2

A) 45
B) 25
C) 35
D) 47
سؤال
What does Ruby do when it has operators with the same level or precedence to evaluate?

A) It processes them from left to right
B) It processes them from right to left
C) It processes all multiplication before division and all addition before subtraction
D) It processes all division before multiplication and all subtraction before addition
سؤال
Which of the following statements is not true regarding indentation within your Ruby scripts?

A) Indenting statements helps to visually organize them
B) Indenting statements can make them easier to read and understand
C) Indentation is required for your script to execute properly
D) Indentation is consider a good programming practice
سؤال
A string containing the \a escape character instructs Ruby to ____ when the statement that contains it executes.

A) Beep
B) Pause
C) Terminate
D) Insert a blank line
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/55
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 2: Interacting With Ruby
1
Unlike the print method the puts method displays text strings on separate lines.
True
2
A method is a collection of statements that is predefined within a class that can be used to interact with and control the operation of objects created based on the class.
True
3
You can access a special Internet based version of the IRB by visiting http://tryruby.org/.
True
4
Arithmetic expressions are evaluated based on a predetermined order referred to as the order of examination .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
5
A floating point value is a number that does not include a decimal point.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
6
Using the IRB you can gain insight as to the way Ruby keyboards, operators, and commands work.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
7
An expression is a series of keywords, operators and variables that when processed returns a result.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
8
The IRB is started from the operating system command prompt by entering start irb and pressing Enter.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
9
A class is a definition or template used as the basis for defining a new object and does not do anything by itself.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
10
Ruby programmers often use the IRB to test the execution of numeric expression like a calculator.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
11
By default, any time two integer numbers are divided in Ruby, the value that is returned is always an integer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
12
The term instantiation describes a process whereby a new object is created.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
13
In addition to RDoc, you can view Ruby documentation using either the ri or the vd command line commands on your computer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
14
The print method displays a line of text on the screen.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
15
You can easily access the documentation for most Ruby class methods via a system referred to as RDoc.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
16
You can access RDoc online at http://www.ruby-doc.org/.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
17
The term IRB stands for Interactive Ruby.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
18
Unlike other programming languages, Ruby does not require programmers to follow any language specific rules.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
19
In order to instantiate a new object you must use the new keyword.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
20
Nil is a value that representing a value of 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
21
Which of the following commands display a line of text on the screen?

A) puts
B) display
C) print
D) both a and c
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
22
What value will the following expression evaluate to ____. irb(main):010:0> 7 * 4 / 3 - 4 % 3 + 8

A) 16
B) 14
C) 4
D) 20
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following statements is not true?

A) An object is created based on a predefined class template
B) An object inherits all of the features of the class upon which it is based
C) An object is a template that is used to define a class
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
24
The IRB does not provide access to classes, objects or variables more than 5 minutes old.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
25
Which of the following statements is not true?

A) All IRB sessions share a common memory space.
B) Classes, methods and variables that are defined in one IRB are not accessible in another session.
C) New IRB sessions can be started by opening a new console window and typing IRB.
D) New IRB sessions cane be started from within an existing irb accessing by typing IRB.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
26
An IRB session can by terminated by all of the following command except ____.

A) exit
B) irb_quit
C) irb -v
D) irb_exit
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
27
In addition to the standard set of mathematical operator methods, Ruby also provides you with access to a collection of mathematical methods stored in which module?

A) Trig
B) Calculus
C) Math
D) Arithmetic
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
28
You can instruct the IRB to load and execute a script named test.rb in c:\Ruby_Scripts\ using which of the following commands?

A) load 'c:\Ruby_Scripts\test.rb'
B) copy 'c:\Ruby_Scripts\test.rb'
C) run 'c:\Ruby_Scripts\test.rb'
D) execute 'c:\Ruby_Scripts\test.rb'
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
29
A misspelled command is an example of what type or error?

A) Logical
B) Syntax
C) Runtime
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
30
Parentheses or quotation marks can be used to override the order of precedence.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
31
If you require a greater level of precision when working with numeric data, you must specify floating-point numbers (e.g. numbers with a decimal)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
32
The * operator is used to perform ____.

A) Addition
B) Multiplication
C) Division
D) Exponentiation
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
33
The % operator is used to perform ____.

A) Addition
B) Multiplication
C) Division
D) Modulus
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
34
The IRB ____.

A) Provides Ruby programmers with command line access to the Ruby parser.
B) Can be used to test the effects of Ruby statements.
C) Can be used to load and execute entire scripts.
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
35
The math module includes many different types of methods that support advanced mathematical operations. Examples of the methods provided by this module include ____.

A) sqrt
B) acos
C) cos
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
36
The command irb -v ____.

A) Starts the IRB and displays its version number
B) Starts the IRB in a special graphic interface mode
C) Closes the IRB
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
37
When working with module methods, you can refer to methods using upper or lower case spelling, just as long as you properly spell the method's name.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
38
If you enter an incomplete Ruby statement into the IRB, it will ____.

A) Execute the incomplete statements and generate an error
B) Display a modified command prompt and wait on you to finish entering the statement
C) Display a warning message and reject your input
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
39
Failure to follow Ruby's syntax rules when formulating script statements can result in an error that prevents your script from executing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
40
When working with the IRB, you can ____.

A) Pass the IRB a number of statements
B) Pass the name of a Ruby script you want to execute
C) Pass the name of a Ruby script along with arguments for that script
D) All of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
41
Ruby supports thousands of methods. You can use the ____ system to access documentation on these methods.

A) ri
B) RDoc
C) DocView
D) a and b
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
42
You can retrieve player input using which of the STDIN class's methods?

A) puts
B) gets
C) retrieve
D) catch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
43
A method ____.

A) Is a collection of statements defined within a class
B) Can be used to interact with objects
C) Can be used to control the operation of an object
D) All of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
44
What value will the following expression evaluate to? irb(main):010:0> (4 + 7) * 3 - 7 / (2 + 5) ** 2

A) 45
B) 25
C) 33
D) 47
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
45
In Ruby variable substitution is performed within a string by placing a variable name within what set of characters?

A) %Q{ and }
B) #{ and }
C) %{ and }
D) { and }
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
46
According to Ruby's order of precedence, arithmetic expressions are resolved in which of the following orders?

A) Exponentiation > multiplication, division, modulus > addition, subtraction
B) Modulus > exponentiation > division, modulus > addition, subtraction
C) Addition, subtraction, division, multiplication > modulus, exponentiation
D) None of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
47
Which of the following is a valid way of creating a string within a Ruby statement?

A) Embed text within an opening %Q{ and } characters.
B) Embed text within a pair of double quotation marks.
C) Embed text within a pair of single quotation marks.
D) Both a and b.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
48
The round method is associated with many different classes, including all of the following except ____.

A) Numeric
B) Integer
C) Float
D) String
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
49
Within your Ruby scripts, an escape character is a pair of characters that begin with the ____ character followed by a letter.

A) #
B) _
C) !
D) \
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
50
Which of the following command line commands will allow you to view information about the Numeric class's round method?

A) ri.numeric.round
B) ri numeric(round)
C) vd numeric.round
D) ri Numeric.round
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
51
The following statement shows and incomplete statement entered into the IRB. irb(main):003:0> 5 - 1 + What of the following examples shows the modified command prompt that the IRB will display next?

A) irb(main):004:7:*
B) irb(input):004:0:>
C) irb(main):004:0*
D) irb(multi):004:0:
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
52
What value will the following expression evaluate to? irb(main):010:0> 4 + 7 * 3 - 7 / 2 + 5 ** 2

A) 45
B) 25
C) 35
D) 47
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
53
What does Ruby do when it has operators with the same level or precedence to evaluate?

A) It processes them from left to right
B) It processes them from right to left
C) It processes all multiplication before division and all addition before subtraction
D) It processes all division before multiplication and all subtraction before addition
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
54
Which of the following statements is not true regarding indentation within your Ruby scripts?

A) Indenting statements helps to visually organize them
B) Indenting statements can make them easier to read and understand
C) Indentation is required for your script to execute properly
D) Indentation is consider a good programming practice
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
55
A string containing the \a escape character instructs Ruby to ____ when the statement that contains it executes.

A) Beep
B) Pause
C) Terminate
D) Insert a blank line
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 55 في هذه المجموعة.