• 20 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 10/4/17

Course Review

Log in or subscribe for free to enjoy all this course has to offer!

Evaluated skills

  • Perform basic programming tasks with Ruby
  • Question 1

    Object-Oriented Programming is

    Careful, there are several correct answers.
    • unique to Ruby.

    • fundamental to Ruby.

    • a way to group related units of functionality and data, so that they can be reasoned about more easily. 

    • a strategy to manage complexity.

  • Question 2

    Which of these statements are true?

    Careful, there are several correct answers.
    • All objects in Ruby are classes.

    • All classes in Ruby are objects.

    • All classes define instance methods for use by instances of classClass.

    • Classes can define instance methods for use by their instances.

    • All classes are instances of classClass .

    • All objects are instances of some class.

    • ClassClassis an instance of itself.

    • Classes cannot make use of the instance methods they define.

    • Methods can be called with or without a receiver. If a receiver is omitted, the method will be called on self.

    • selfcan be different objects at different times. When a method is being called,selfrefers to the class that defined the method.

    • selfalways means the object calledmain.

    • selfcan be different objects at different times. When a method is being called,selfrefers to the instance calling the method.

    • Methods can be both defined and called with or without an explicit receiver.

    • Methods can be called with or without an explicit receiver, but are always defined as instance methods of the class definition in which they are found.

    • Methods defined using an explicit receiver become instance methods of the class of the receiver.

    • Methods defined using an explicit receiver become instance methods of the singleton class of the receiver.

    • Singleton classes are not instances of classClass, and don't have a method callednew.

    • Singleton classes can define instance methods, just like other classes.

    • Singleton classes can instantiate new instances, just like other classes.

    • All classes except for classClassare singleton classes.

    • Classes get all of their methods directly from class Class.

    • Classes often get some of their methods from their singleton classes.

    • Every object has its own singleton class.

  • Question 3

    Blocks are

    • like methods, but don't have arguments.

    • reusable pieces of code that, unlike methods, can be passed around in variables.

    • reusable pieces of code that, unlike methods, don't throw exceptions.