1. Which method in Ruby is used to add an element to the end of an array? A. push B. pop C. append D. insert Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
2. What will array.size return in Ruby, if array = [1, 2, 3, 4, 5]? A. 5 B. 4 C. [1, 2, 3, 4, 5] D. "array" Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
3. Which method is used to access the value associated with a specific key in a hash in Ruby? A. access B. get C. fetch D. value Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
4. What is the output of "hello".reverse in Ruby? A. "olleh" B. "hello" C. "loleh" D. "hell" Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
5. In Ruby, how do you convert a string to an array of characters? A. split B. chars C. to_chars D. to_a Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
6. Which of the following methods is used to merge two hashes together in Ruby? A. merge B. join C. combine D. concat Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
7. What does the << operator do when used with a string in Ruby? A. Appends a character to the end B. Removes the last character C. Concatenates two strings D. Reverses the string Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
8. How do you check if a key exists in a hash in Ruby? A. key? B. exists? C. include? D. has_key? Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
9. What is the output of "hello".upcase in Ruby? A. "hello" B. "Hello" C. "HELLO" D. "heLLo" Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
10. Which method in Ruby is used to remove and return the last element of an array? A. pop B. shift C. remove D. delete_at Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board