[{"id":"rubybeginner-001","courseId":"ruby-beginner","domain":"syntax-and-literals","topic":"Truthy and falsy values","prompt":"A developer writes `if value` to check whether a method returned something. Which TWO of these values count as false in that condition?","hint":"Consider how a condition judges numbers and text compared with other kinds of values.","explain":"A condition in Ruby checks only a small, fixed set of values for falsiness. Everything else, whatever its type or size, passes the test.","source":"https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"nil","why":"nil is one of the two false values in a condition; it is often used to mean no value."},{"id":"b","text":"false","why":"false is the other false value, so it fails a condition."},{"id":"c","text":"0","whyNot":"Zero is a number. Only nil and false are false in a condition, so 0 counts as true."},{"id":"d","text":"An empty string (\"\")","whyNot":"An empty string is still an object, so it evaluates to true in a condition."},{"id":"e","text":"An empty array ([])","whyNot":"An empty array is an object too, so it evaluates to true in a condition."},{"id":"f","text":"The string \"false\"","whyNot":"It is a non-empty String object, which is true, whatever its text says."}],"answer":"ab","explanation":"In a conditional, only nil and false are false; every other object, including 0 and empty strings, evaluates to true.","concept":"In a conditional, only nil and false are false; every other object, including 0 and empty strings, evaluates to true.","rev":1,"updatedAt":"2026-10-24","kind":"scenario","takeaways":["In a condition only nil and false are false; 0 and empty strings are true."]},{"id":"rubybeginner-002","courseId":"ruby-beginner","domain":"syntax-and-literals","topic":"String interpolation","prompt":"A teammate greets a user with this code. What does the program print?","hint":"Look closely at the quote marks around the text.","explain":"Inside a string, Ruby can run a piece of code wrapped in #{ } and put its result into the text. Whether that happens depends on the kind of quotes around the text.","source":"https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html","interaction":{"type":"single"},"options":[{"id":"a","text":"Hello, #{name}","why":"Single quotes turn off interpolation, so #{name} is kept as plain characters."},{"id":"b","text":"Hello, Ana","whyNot":"That would happen with double quotes; single quotes do not run the code inside #{ }."},{"id":"c","text":"Hello, name","whyNot":"The #{ } characters and the word inside them both stay in the output; nothing is stripped."},{"id":"d","text":"An error, because name is not run inside single quotes","whyNot":"Nothing is evaluated, so no error is raised; the text is printed as written."}],"answer":"a","explanation":"Interpolation with #{...} works only in double-quoted strings; single-quoted strings disable it and keep the text literally.","concept":"Interpolation with #{...} works only in double-quoted strings; single-quoted strings disable it and keep the text literally.","rev":1,"updatedAt":"2026-10-24","kind":"scenario","code":"name = \"Ana\"\nputs 'Hello, #{name}'","takeaways":["Double quotes run #{ } code; single quotes print it as plain text."]},{"id":"rubybeginner-003","courseId":"ruby-beginner","domain":"syntax-and-literals","topic":"Inclusive and exclusive ranges","prompt":"In Ruby, the range written `1...2` includes its ending value, 2.","hint":"Compare the two-dot and three-dot forms of a range.","explain":"A range is written with two or three dots between its ends. The two forms differ in one way: whether the last value belongs to the range.","source":"https://docs.ruby-lang.org/en/master/Range.html","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"The two-dot form includes its end; the three-dot form used here leaves 2 out of the range."},{"id":"b","text":"False","why":"The three-dot form excludes its ending value, as in 1 ... 2, so 2 is not in the range."}],"answer":"b","explanation":"Two dots (1..2) include the end value; three dots (1...2) exclude it.","concept":"Two dots (1..2) include the end value; three dots (1...2) exclude it.","rev":1,"updatedAt":"2026-10-24","kind":"scenario","takeaways":["Two dots include the end of a range; three dots leave it out."]},{"id":"rubybeginner-004","courseId":"ruby-beginner","domain":"syntax-and-literals","topic":"Word-array literals (%w and %i)","prompt":"The expression `%w[apple pear]` creates an array of two String objects, not Symbols.","hint":"Pay attention to the letter that follows the percent sign.","explain":"Percent literals write a list of words without quoting each one. The letter after the % decides what kind of items the list holds.","source":"https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","why":"%w builds Strings; the Symbol form is %i, which is a different literal."},{"id":"b","text":"False","whyNot":"%w is the String-array form, so its elements are Strings rather than Symbols."}],"answer":"a","explanation":"%w creates an array of strings, while %i creates an array of symbols.","concept":"%w creates an array of strings, while %i creates an array of symbols.","rev":1,"updatedAt":"2026-10-24","kind":"scenario","takeaways":["%w gives strings and %i gives symbols; the letter picks the element type."]},{"id":"rubybeginner-005","courseId":"ruby-beginner","domain":"syntax-and-literals","topic":"Squiggly heredocs","prompt":"A method prints its help text using this heredoc. What is printed when the method runs?","hint":"Think about what a squiggly heredoc does with the spaces at the start of each line.","explain":"A squiggly heredoc lets its content be indented to match the surrounding code. Ruby trims leading spaces from the content; look at which content lines decide how many.","source":"https://docs.ruby-lang.org/en/master/syntax/literals_rdoc.html","interaction":{"type":"single"},"options":[{"id":"a","text":"\"Usage:\" with no indent, then \"  run it\" with two spaces","why":"The least-indented content line has four spaces, so four are removed from each line, leaving two on the second."},{"id":"b","text":"\"    Usage:\" then \"      run it\", with every space kept","whyNot":"Keeping every space is what the dash form does; the squiggly form removes the shared indent."},{"id":"c","text":"\"  Usage:\" then \"    run it\", trimmed by the closing marker's two spaces","whyNot":"The indent on the closing marker does not set the amount; only the content lines do."},{"id":"d","text":"A SyntaxError, because the closing TEXT is indented","whyNot":"With <<~ the closing identifier may be indented, so this code is valid."}],"answer":"a","explanation":"In a <<~ heredoc, the indentation of the least-indented line is removed from each line of the content.","concept":"In a <<~ heredoc, the indentation of the least-indented line is removed from each line of the content.","rev":1,"updatedAt":"2026-10-24","kind":"scenario","code":"def usage\n  text = <<~TEXT\n    Usage:\n      run it\n  TEXT\n  puts text\nend","takeaways":["<<~ removes the least-indented line's leading spaces from every content line."]}]