ExamVeda
Login
Home
61
The elsif statement can add many alternatives to if/else statements.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
62
What is the output of the given code?
counter=6
   if counter<=5
   puts (counter)
   counter=counter+1
   puts (counter)
   elsif counter>5
   puts (counter)
   counter=2*counter
   puts(counter)
   else 
   puts(counter)
   counter=counter-1
   puts(counter)
   end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
63
What is output of the given code?
counter=-3
   if counter<=5
   puts (counter)
   counter=counter+1
   puts (counter)
   elsif counter>5
   puts (counter)
   counter=2*counter
   puts(counter)
   end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
64
What is the output of the given code?
 if !true
   print "False"
   elsif !true || true
   print "True"
   end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
65
What is the output of the given code?
variable = false
   if variable
   print "false"
   elsif !variable
   print "true" 
   end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
66
What is the output of the given code?
x=7
   y=9
   if x==y
   print "equal"
   elsif x>y
   print "greater" 
   else
   print "less"
   end
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
67
What is the output of the given code?
a=true
   b=false
   if a && b
   puts "False"
   elsif a || b
   puts "True"
   else
   puts "neither true nor false"
   end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
68
What is the output of the given code?
a=10
    b=2
    if a>b
    a=a*b
    puts (a)
    elsif a<b
    a=a*a+b
    puts (a)
    else
    a=a-b
    puts (a)
    end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
69
Syntax for unless conditional statement is
unless conditional [then]
   code
else
   code 
end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
70
What is the output of the given code?
x=3
unless x>2
puts "x is less than 2"
else
puts "x is greater than 2"
end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board