21. What does the `include?` method do when used with strings in Ruby? A. Checks if a substring exists in the string B. Checks if a character exists in the string C. Checks if the string includes another string D. Error 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
22. In Ruby, what does the `capitalize` method do when used with strings? A. Converts the first character to uppercase B. Converts the entire string to uppercase C. Converts the first character to lowercase D. Converts the entire string to lowercase 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
23. In Ruby, which method is used to concatenate two strings? A. concat B. join C. plus D. + 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
24. What is the result of the expression `"hello".length` in Ruby? A. 5 B. 6 C. Error D. "hello" 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
25. What does the `chomp` method do when used with strings in Ruby? A. Removes whitespace from the beginning and end B. Removes newline characters from the end C. Removes whitespace from the end D. Removes newline characters from the beginning 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
26. Which method in Ruby is used to add an element to the end of an array? A. push(element) B. add(element) C. append(element) D. insert_end(element) 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
27. What does the pop method do when called on an array in Ruby? A. Removes the first element of the array B. Removes the last element of the array C. Returns a new array with the last element removed D. Inserts an element at a specified index 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
28. In Ruby, which symbol is used to access the value associated with a key in a hash? A. : B. @ C. $ D. % 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
29. What method in Ruby is used to join the elements of an array into a single string? A. join(separator) B. concat(separator) C. merge(separator) D. combine(separator) 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
30. Which of the following methods is used to remove a key-value pair from a hash in Ruby? A. delete(key) B. remove(key) C. erase(key) D. exclude(key) 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