Vocabulary and Concepts
- Know that Ruby is interpreted language and that it is cross platform.
- Ruby source files usually have .rb extension (not mandatory).
- Know that Ruby does not enforce an object-oriented programming approach.
- Understand that basic commands like puts and exit are actually Kernel instance methods.
- Know that Ruby is dynamically typed language.
- Know that there are no primitives in Ruby.
Ruby Environment Have Knowledge of :
- Common Environment Variables used by the ruby runtime.
Understand how :
- Ruby searches for required libraries and modules.
Know that:
- Command line options are available using ARGV array.
- Environment variables are accessed by ENV hash object.
- List of source directories is available through a global variable $:
Understand the usage of :
- `(backquote) command, which opens subshell and return its standard output as a result.
- load and require commands
Understand the difference between:
- require and load commands.
- program termination with exit() and exit!() methods.
Control Structures Usage of conditional (if, unless, case) and loop (while, for) structures. Effects of break, next and redo constructs. Naming
Ruby naming style and how it affects code:
- Constants: written starting with uppercase THIS_IS_CONSTANT, MeConstantToo
- Classes: starting with uppercase (ThisIsClass)
- Methods and variables: starting with lowercase and using underscores to separate words (this_is_method)
- Instance variables: starting with (at) symbol (@this_is_instance_variable)
- Global variables: starting with dollar sign ($i_am_global)
Understand that naming style in Ruby defines the behavior of the object (naming an object with uppercase name makes it a constant etc)
Acceptable language element names (special characters, numbers etc).
Know that methods ending with ! are supposed to be mutators or considered dangerous (sort!, exit!).
Know that methods ending with ? are supposed to be boolean checks (exists?).
Comments Know that the Ruby code has a # (sharp) comment symbol.
# This is a comment
and multi-line comments
=begin
This is a comment.
=end
Variables
- Know that all variables reference some object.
- Variable scope.
- Variable assignments (a=1; a,b=b,a; a=b=1).
- Object references.
- Usage of global variables.
- Know that it is possible to get the value of undefined variable. (you will get a warning).
- Know how to check if variable is defined or is null with defined? and nil? methods.
- Variable conversion using to_XX methods.
- Know that nil is a regular object.
Operators Usage of operators +=, -=, ==, ===, <, <=, >=, >, **, bit operations. Logical expressions Usage of: or, and, not. Know that Ruby supports C++ style expressions: &&, ||, ! I/O
- Reading/Writing Opening/Closing files.
- IO methods: close(), print(), eof?()
- IO reading iterators: each_line or each
- C++ style streams ($stdout, $stderr, $stdin).
- Know how to output data in Ruby (puts, print, p and $stdout).
Classes
- Know that the construction of an object in Ruby is done via the *new* class method and that the initialization is done via the *initialize* instance method.
- Know how to define attribute getters and setters via attr_reader and attr_writer commands.
- Know that class variables (aka static) are shared among all class instances. Class variable names are beginning with two (at) symbols (@@class_variable)
- Understand the difference between class methods and instance methods.
Inheritance Understand the concepts of inheritance and how to call ancestor class methods with 'super'. Know that the god class is 'Object'. Methods Method invocation and its parameters. Know the access control of methods and differences between 'private', 'public' and 'protected' methods. Know what is alias of the method. Blocks
- Usage of blocks.
- Block could be defined both by begin-end or {} pairs.
- Usage of yield statement.
Iterators Usage of iterators. Exceptions Raising and Handling of Exceptions.
Know the usage of
rescue and
ensure clauses,
retry statement and
raise method.
Knowledge of specific exception type names is not required.
Know how to define custom exception types (inheritance from RuntimeError class). Strings Creating new string objects. Concatenation using + operator. String core methods: 'strip', 'chomp', 'split', 'size' Know how to use template strings. Arrays Creation of new arrays (both Array.new() and
styles).
- Array core methods: 'length', 'push', 'pop', 'shift', 'join'
- Iterator: 'each'
- Sorting/transforming methods: 'filter', 'sort', 'collect', mutating and non-mutating
Mix Set of questions about multiple categories in the same question. Other Questions outside of the scope of other categories, but fit to exam objectives and complexity level.