Hard questions Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Is there an equivalent of “continue” in Ruby?

A

The Ruby next statement is used to skip loop’s next iteration. Once the next statement is executed, no further iteration will be performed.

The next statement in Ruby is equivalent to continue statement in other languages.

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

What is the difference between calling super and calling super()?

A

super - sends all arguments

super() - no arguments

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

What is the use of eigenclass?

A

The eigenclass is an unnamed instance of the class Class attached to an object and which instance methods are used as singleton methods of the defined object.

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

What is the difference between redo and retry?

A

To repeat the whole loop iteration from the start the retry statement is used. retry always used inside the loop.

Redo statement is used to repeat the current iteration of the loop.

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

What is the difference between #remove_method and #undef_method?

A
#undef_method( ) 
removes all methods, including the inherited ones. 
#remove_method( ) 
removes the method from the receiver, but it leaves inherited methods alone.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly