Ruby Flashcards

1
Q

Adding a feature to a programming language to make it easier to do something that was already doable is called adding ANSWER.

A

syntactic sugar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Matz, the creator of Ruby thinks that it is less important to optimize the execution (efficiency) of a programming language and more important to optimize the efficiency of ANSWER

A

the programmers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A programming language is called ANSWER if it is executed by an interpreter rather than by first being compiled with a compiler.

A

interpreted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If the types of a programming language are bound at execution time rather than compile time, then the types are called ANSWER.

A

dynamically typed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In describing the properties of an object oriented language, encapsulation means ANSWER.

A

Data and behaviour are packaged together

There is a mechanism for restricting access to an object’s components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In discussing object oriented languages objects are organized into a class tree to support the property of ANSWER.

A

inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In discussing object oriented languages being able to handle objects of related type is called ANSWER.

A

Polymorphism

(Polymorphism has a different usage in the object oriented programming community than in the functional programming community)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The application that caused a significant increase in the popularity of Ruby was a web framework called ANSWER.

A

Rails

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The concurrency approach used in Ruby is ANSWER.

A

threads

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The command name for the ruby interpreter is ANSWER.

A

irb

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In ruby true.class returns ANSWER

A

TrueClass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Ruby supports two common ways that boolean expressions are handled in programming languages. In one approach both subexpressions of a boolean operator are evaluated before the boolean operator is evaluated. In the other approach called ANSWER the first subexpression in a boolean expression is evaluated and if that is enough to know the result of the boolean expression, then the second subexpression is not evaluated.

A

short-circuit evaluation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In ruby normally when you try to add a String to a Fixnum, you get an error message saying that a String cannot be coerced to a Fixnum. This is because Ruby is ANSWER typed.

A

strongly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

One way of checking types is to see what constructor was used to create an object that is a parameter. Another way of checking types is to wait until a method is sent to an object and see if it supports the methods. This second way is called ANSWER.

A

duck typing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A major claim in object oriented design philosophy is that you should code to ANSWER rather than code to implementation.

A

interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The & notation in the line of Ruby def gerorge(&sam) is used to indicate that sam is ANSWER.

A

a code block

17
Q

The : notation in the Ruby expressions :hi is used to indicate that hi is ANSWER.

A

a symbol

18
Q

With respect to the value returned by the Ruby expression:
‘hi’ .object_id == ‘hi’ .object_id
You can say it ANSWER.

A

could be either true or false

19
Q

With respect to the value returned by the ruby expression:
:hi.object_id== :hi.object_id
You can say it ANSWER.

A

will always be true

20
Q

To execute a code block in Ruby that is passed to a method but does not appear on its parameter list, you use the keyword ANSWER.

A

yield

21
Q

To execute a codeblock in Ruby that is passed to a method on its parameter list, you send that parameter the method ANSWER.

A

call

22
Q

A code block is some lines of code surrounded by either curly braces or ANSWER.

A

do end

23
Q

In Ruby the expression Fixnum.class returns ANSWER.

A

Class

24
Q

The root of the inheritance hierarchy in Ruby is the class ANSWER.

A

Object (According to textbook in 2010)

BasicObject (Updated answer for Ruby 2.3)

25
Q

In Ruby, the name of the method in the class Me that is automatically invoked when a new object of type Me is created with Me.new is ANSWER.

A

initialize

26
Q

In Ruby, the @ is used to indicated that the variable @me is ANSWER.

A

an instance variable

27
Q

In Ruby, the @@ is used to indicate that the variable @@me is ANSWER.

A

a class variable

28
Q

In Ruby, by convention the ? in the method me? is used to indicate that me is ANSWER.

A

boolean

29
Q

In Ruby, the mixin is used to solve the object-oriented programming problem of ANSWER.

A

multiple inheritance

30
Q

The feature of programs being able to ‘write programs’ (creating application specific language features) is called ANSWER.

A

metaprogramming

31
Q

In Ruby, if you declare a class with a class name that is already in use and put in it the definition of a new method, you have changed the functionality of the existing class (even if it is a predefined class like Fixnum). The property of Ruby that allows this is ANSWER.

A

open classes

32
Q

When you send a message to a Ruby object, Ruby first looks at the methods that object supports, and then starts working the inheritance chain. If it still cant find the appropriate method, the message and its parameters get passed as a message to the object looking for a method called ANSWER.

A

method_missing

33
Q

In the Ruby community, the acronym DSL is an abbreviation for ANSWER.

A

domain specific language

34
Q

In Ruby, if a line starts with a method name, that method is being sent to the object named ANSWER.

A

self

35
Q

When you define a method in a class, normally it is meant to be invoked on an object of that class (an instance method). Sometimes it is meant to be invoked on the class name itself (a class method), like Date.parse( ‘3rd Feb 2001’). In Ruby, to define a class method we put ANSWER at the beginning of the method name in its definition.

A

self