Home / CSE MCQs / Ruby Programming MCQs :: Discussion

Discussion :: Ruby Programming MCQs

  1. What is the output of the given code?

    a = 5
    b=10
    while a
      puts a*b
      a+=2
      b-=2
      end
  2. A.
    5 10
    B.
    50 56
    C.
    Infinite loop
    D.
    5 6 7 8 9 10

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The do statement here indicates that till the while condition is true execute the instructions and will print a*b only till a Output: 50 56


Be The First To Comment