Home
26.
How is visibility of methods changed in Ruby (Encapsulation)?

By applying the access modifier : Public , Private and Protected access Modifier.

27.
How is an enumerator iterator handled in Ruby?

Iterator is handled using keyword 'each' in ruby.
Ex: number=[11,12,13]
then we can use iterator as
number.each do |i|
puts i
end
Above prints the values of an array $no which is accomplished using iterator.

28.
What is the scope of a local variable in Ruby and define it scope ?

A new scope for a local variable is introduced in the toplevel, a class (module) definition, a method defintion. In a procedure block a new scope is introduced but you can access to a local variable outside the block.
The scope in a block is special because a local variable should be localized in Thread and Proc objects.

29.
What are the object-oriented programming features supported by Ruby and how multiple inheritance supported in ?

Classes,Objects,Inheritance,Singleton methods,polymorphism(accomplished by overriding and overloading) are some oo concepts supported by ruby. Multiple inheritance supported using Mixin concept.

30.
What are the looping structures available in Ruby?

for..in
untill..end
while..end
do..end