Vidyalelo
Ruby Programming · Q87

Control Structures in Ruby

Programming · Ruby Programming · question 87

Q87

What is the output of the given code? length=gets.chomp case length.reverse.length when length=4 print "length is 4" when length=5 print "length is 5" end

A.
ruby
length is 4
Answer
B.
ruby
length is 5
C.
abc
length is 4
D.
syntax error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board