Home / Programming Questions / Ruby MCQs / Page 9

Ruby MCQs with answers Page - 9

Dear candidates you will find MCQ questions of Ruby here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

Q. Which statement is used to Jumps to the next iteration of the most internal loop?

(A) break
(B) next
(C) redo
(D) retry

Q. Which statement is used to Restarts this iteration of the most internal loop, without checking loop condition?

(A) break
(B) next
(C) redo
(D) retry

Q. Which statement is used to restarts the invocation of the iterator call?

(A) break
(B) next
(C) redo
(D) retry

Q. What does the 1..5 indicate?

(A) Exclusive range
(B) Both inclusive and exclusive range
(C) Inclusive range
(D) None of the above

Q. What does end represent?

(A) keyword represents the ending of loop
(B) keyword represents the start of loop
(C) keyword represents the start and ending of loop
(D) keyword represents the infinite loop

Q. Which of the following is Exit Controlled loop?

(A) do..while
(B) For
(C) Until
(D) While

Q. What will be the output of the given code?

Code:
for num in 1...5
  puts num
end
(A) 1 2 3 4
(B) 1 2 3 4 5
(C) 0 1 2 3 4
(D) 0 1 2 3 4 5

Q. What will be the output of the given code?

Code:
for i in 1...3  
  for j in 1..3
  puts j
  end
end
(A) 1 2 1 2
(B) 0 1 2 0 1 2
(C) 1 2 3 1 2 3
(D) 1 2 3 1 2

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.