What is the output of the given code?
a=[1,2,3,4,5]
b=[1,2,4,6,8]
if a[3]==b[2]
print "Equal"
end
a=[1,2,3,4,5]
b=[1,2,4,6,8]
if a[3]==b[2]
print "Equal"
endA. Equal
B. Error
C. 4
D. None of the mentioned
Answer: Option A
a=[1,2,3,4,5]
b=[1,2,4,6,8]
if a[3]==b[2]
print "Equal"
endA. Equal
B. Error
C. 4
D. None of the mentioned
Answer: Option A
Which method in Ruby is used to add an element to the end of an array?
A. push
B. pop
C. append
D. insert
What will array.size return in Ruby, if array = [1, 2, 3, 4, 5]?
A. 5
B. 4
C. [1, 2, 3, 4, 5]
D. "array"
Which method is used to access the value associated with a specific key in a hash in Ruby?
A. access
B. get
C. fetch
D. value
Join The Discussion