Home / CSE MCQs / Ruby Programming MCQs :: Discussion

Discussion :: Ruby Programming MCQs

  1. What is the output of the given code?

    counter = 2
    while counter < 68
      puts counter
      counter**=2
      end
  2. A.
    2 4 16 64
    B.
    2 4 16
    C.
    2 4 16 256
    D.
    None of the mentioned

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The counter will increment by the power of two. Output: 2 4 16


Be The First To Comment