Ruby quiz and interview questions

Comprehensive Ruby quiz and questions from basic to advanced level that help you to review your Ruby knowledge and become the master of Ruby. Please read the following question carefully and select the correct anwser, you have to make your choice before going to the next question.

Recent added questions

  • Which of the following is best described as a block?

    1)  my_array = [1, 2, 3]
        my_array.each {|i| puts i*i}
    
    2)  def double(n)
          return n * 2
        end
    
    3)  def welcome
            puts "Welcome to Ruby!"
        end
    
    4)  city = ["London", "Paris", "Belfast", "Rome"]
  • Which of the following correctly sort the array below in descending order?

    city = ["London", "Paris", "Belfast", "Rome"]
  • Which of the the following will be returned from the statement below?

    7 % 3 <=> 2+10/2
  • Which of the following best describes an argument?

  • Which of the following best describes a parameter?

  • Which of the following best describes a method?

  • Which of following correctly iterates over the hash below printing every key and value?

     

    Address_book {
      "Henry" => "14 Ladbroke Grove"
      "Emily" => "243 Baker Street"
      "Jamie" => "43 Jubilee Street"
    
  • Which of the following best describes the next keyword?

View all Ruby quiz questions

© 2017 QuizBucket.org