1. How do you create a new Date object representing the current date in Ruby? A. Date.now B. Date.current C. Date.today D. Date.new 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
2. What does the strftime method do in Ruby when applied to a Time object? A. Returns the year of the Time object B. Formats a Time object into a string according to the specified format C. Returns the day of the week of the Time object D. Returns the year of the Time object 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
3. Which method is used to subtract a number of days from a Date object in Ruby? A. prev_days B. days_ago C. prev_day D. subtract_days 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 purpose of the strptime method in Ruby? A. Converts a Date or Time object to a string B. Returns the day of the month of the Date or Time object C. Returns the month of the Date or Time object D. Parses a string into a Date or Time object using a specified format 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
5. Which method is used to add a number of months to a Date object in Ruby? A. next_month B. add_month C. months_from_now D. advance_months 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
6. What is the purpose of the Time.now method in Ruby? A. Returns the current time as the number of milliseconds since the Unix epoch B. Returns the current time as the number of seconds since the Unix epoch C. Returns the current time as a string D. Returns the current time as a Time object 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
7. How do you find the difference in seconds between two Time objects in Ruby? A. Use the diff method with the seconds option B. Use the difference method with the seconds option C. Subtract one Time object from another and convert the result to seconds D. Use the delta method with the seconds option 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
8. What does the zone method return for a Time object in Ruby? A. Returns the time zone abbreviation of the Time object B. Returns the time zone of the Time object C. Returns the time zone ID of the Time object D. Returns the time zone abbreviation of the Time object 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
9. How do you convert a Date object to a string in Ruby? A. Use the parse method B. Use the stringify method C. Use the to_s method D. Use the convert_to_string method 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 is used to find the number of days between two Date objects in Ruby? A. days_until B. days_difference C. subtract_date D. difference_in_days 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