Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the output of given code?
#counter=1
if counter<=5
puts (counter)
counter=counter+1
else
puts(counter)
counter=counter-1
end

What is the output of given code?
#counter=1
if counter<=5
puts (counter)
counter=counter+1
else
puts(counter)
counter=counter-1
end
a) Undefined local variable counter
b) 1,2,3,4,5
c) 1 2 1
d) 1
2

Answer: a
Explanation: Counter value must not be commented.
Output:
Undefined local variable counter

Join The Discussion