Test yourself under real exam conditions: 50 timed questions, 60 on the clock, pass mark 70%%. Instant score with a full review of everything you got wrong. Free — no account needed.
Exam details
A Symbol is a lightweight, immutable identifier prefixed with a colon, e.g. :name. Symbols are stored in memory only once, making them more efficient than strings for keys and identifiers.
Example: :status, :id
An Array is an ordered collection created with square brackets or Array.new.
Examples:nums = [1, 2, 3]words = %w[hello world]empty = Array.new(5, 0)
A Hash is a collection of key-value pairs.
Examples:h = { name: "Alice", age: 30 }h = Hash.new(0)
Access values with h[:name].
A block is an anonymous chunk of code enclosed in do...end or curly braces { } that can be passed to a method.
Example:[1,2,3].each { |n| puts n }
Both define blocks, but curly braces { } have higher precedence than do...end.
Convention: use { } for single-line blocks and do...end for multi-line blocks.