51
What is the output of the given code?
multi_d_array = [[1,2,3,4],[0,0,0,0]]
multi_d_array.each { |x| puts "#{x}\n" }
A)
[1, 2, 3, 4].
[0, 0, 0, 0].
[[1, 2, 3, 4], [0, 0, 0, 0]].
B)
[0, 0, 0, 0].
C)
[0, 0, 0, 0][0, 0, 0, 0].
D)
None of the mentioned
Answer & Solution
Answer: Option
A
52
What will be the output of the following?
array = [100, 200, 300, 400, 500]
print "array[5]"
A)
array[5].
B)
500
C)
Nil
D)
None of the mentioned
Answer & Solution
Answer: Option
A
53
What is the output of the given code?
string_array = ["a","e","i","o","u"]
print string_array[3]
A)
["a","e","i","o","u"].
B)
Error
C)
o
D)
None of the mentioned
Answer & Solution
Answer: Option
C
54
What is the output of the given code?
array1 = [[1,2,3,4],[0,0,0,0]]
array2 = [[1,2,3],[0,0,0]]
print array1 && array2
A)
[[1, 2, 3], [0, 0, 0]].
B)
[[1, 2, 3, 4], [0, 0, 0, 0], [1, 2, 3, 4], [0, 0, 0, 0]].
C)
[].
D)
Error
Answer & Solution
Answer: Option
A
55
What is the output of the given code?
array1 = [[1,2,3,4],[0,0,0,0]]
array2 = [[1,2,3,4],[0,0,0,0]]
print array1+array2
A)
[[1, 2, 3, 4], [0, 0, 0, 0]].
B)
[[1, 2, 3, 4], [0, 0, 0, 0], [1, 2, 3, 4], [0, 0, 0, 0]].
C)
[[2,4,6,8],[0,0,0,0]].
D)
None of the mentioned
Answer & Solution
Answer: Option
B
56
What is the output of the given code?
a=["hey", "ruby", "language"]
b=["hey", "ruby", "language"]
if a==b
print "Equal"
else
print "Not equal"
end
A)
Equal
B)
Error
C)
Not equal
D)
None of the mentioned
Answer & Solution
Answer: Option
A
57
What will be output of the given code?
my_array = [1, 2, 3, 4]
print my_array
A)
[1, 2, 3, 4].
B)
1234
C)
Error
D)
None of the mentioned
Answer & Solution
Answer: Option
A
58
It is possible to make array of booleans.
A)
True
B)
False
Answer & Solution
Answer: Option
A
59
It is possible to make array of booleans.
A)
True
B)
False
Answer & Solution
Answer: Option
A
60
What is the output of the given code?
a=[1,2,3,4,5]
b=[1,2,3,4,5]
if a==b
print "Equal"
else
print "Not equal"
end
A)
Equal
B)
Error
C)
Not equal
D)
None of the mentioned
Answer & Solution
Answer: Option
A