Test your proficiency in Ruby. . . . Please leave your comments. . . Best of luck!*** Ary Alva ***
Integers
Floats
Characters
Any type
Strings
10
A Ruby array has no fixed size
Count
None of the above
1
0
-1
None of the above
Puts a[0..5]
A=[0,1,2,3,5] puts a[0..5]
Print a[1..5]
For count in a print a[count] end
None of the above
A[2]
Puts a[3]
For count in a print count if count ==2 end
For count in a print a[2] end
Hash indices can be of any type
There is no difference
The size of a hash is not fixed
The hash size is incremented dynamically
None of the above
Index
Value
Entry
Parameter
None of the above
H=[fish => Catfish, dog => Terrier, cat => Siamese]
H={fish => Catfish, dog => Terrier, cat => Siamese}
H=[fish - Catfish, dog - Terrier, cat - Siamese]
H=[fish => Catfish dog => Terrier cat => Siamese]
None of the above
H[1]
H[2]
H[dog]
H['dog']
H["dog"]
For animal in h puts animal end puts h['cat']
For animal, type in h puts "I love " + type + " " +animal +"s" end puts h['cat']
For count in h puts "I love " + type + " " +animal +"s" end puts h['cat']
For h in h puts h end
For h in h puts h end puts h['cat']
AryAlva
Ary Alva
Nothing
Ary Alva
None of the above
Par1 par3
Par1 #{par2} par3
Par1 par2 par3
No output
None of the above
Enough already!
Roar
Bark
Trumpet
None of the above
Putting square braces before the first statement and after the last statement of the snippet of code turns it into a block.
Making a method out of snippet of code turns it into a block.
Putting the word "do" at the beginning of the first statement and the word "end" after the last statement of the snippet of code turns it into a block.
Putting curly braces before the first statement and after the last statement of the snippet of code turns it into a block.
None of the above
Block parameters are located at the beginning of the block, enclosed in a pipe symbols (||) and are separated by a colon.
Block parameters are located at the beginning of the block, enclosed in a pipe symbols (||) and are separated by space.
Block parameters are located at the beginning of the block, enclosed in square brackets and are separated by semicolon.
Block parameters are located at the beginning of the block and separated by semicolon.
None of the above
Wait!
Here's an interesting quiz for you.