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"]
Answer
Which of the following correctly sort the array below in descending order?
city = ["London", "Paris", "Belfast", "Rome"]Answer
Which of the the following will be returned from the statement below?
7 % 3 <=> 2+10/2Answer
Which of the following best describes an argument?
AnswerWhich of the following best describes a parameter?
AnswerWhich of the following best describes a method?
AnswerWhich 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"
Answer
Which of the following best describes the next keyword?
AnswerWhich of the following is the correct syntax for a hash?
1) hash_name = {
key1 = value1,
key2 = value2
}
2) hash_name = {
key1 => value1
key2 => value2
end
}
3) hash_name = {
key1 => value1,
key2 => value2
}
4) hash_name = {
key1 = value1,
key2 = value2
end
}
Answer
Which of the following correctly accesses 10 from the array below?
array = [12, 10, 12, 14]Answer
© 2017 QuizBucket.org