1

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

Correct Answer: 1–Value is set 3–Value is set

Make the most of this question

This page focuses on one Ruby MCQs question from Programming. After checking the answer, return to the topic list to practice more or run a timed set.

Ruby MCQs MCQ: 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 | Extra Education