Home / CSE MCQs / Ruby Programming MCQs :: Discussion

Discussion :: Ruby Programming MCQs

  1. What is the output of the given code?

    hungry=false
    unless hungry
     print "Not hungry"
    else
     print "Hungry"
    end
  2. A.
    Not hungry
    B.
    Hungry
    C.
    Syntax error
    D.
    None of the mentioned

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    As hungry is initialized to false hence the unless condition is executed. Output: Not hungry


Be The First To Comment