ExamVeda
Login
Home
71
What is the output of the given code?
var =  1
print "1 -- Value is set\n" if var
print "2 -- Value is set\n" unless var
var = false
print "3 -- Value is set\n" unless var
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
72
What is the output of the given code?
hungry=false
unless hungry
 print "Not hungry"
else
 print "Hungry"
end
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
73
The following syntax is also used for unless conditional statement.
code unless conditional
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
74
What is the output of the given code?
counter=12
unless counter
 print counter+1
else
 print counter+2
end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
75
What is the output of the given code?
unless true && false
print "false"
else 
    print "ruby"
end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
76
What is the output of the given code?
print "2 is less than 3" unless 2>3
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
77
What is the output of the given code?
x=8
y=10
unless x>y
puts "x is less than y"
end
unless x>y+1
puts "x is less than y+1"
end
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
78
What is the output of the given code?
x="ruby".length
y="language".length
puts x,y
unless x>y 
print "length of x is less than that of y"
end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
79
What is the output of the given code?
x=8
y=10
unless x<y
puts "x is less than y"
end
unless x>y+1
puts "x is less than y+1"
end
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
80
What is the output of the given code?
age =  5
case age
when 0 .. 2
    puts "baby"
when 3 .. 6
    puts "little child"
when 7 .. 12
    puts "child"
when 13 .. 18
    puts "youth"
else
    puts "adult"
end
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board