A
Anil Bhat
Given this module definition:
module Greeting
def say_hello
puts "Hello, my name is #{self.name}"
end
end
1.) How to implement a class Foo using the Greeting module so that the
following code example generates the expected output. Do not implement a
say_hello method.
foo = Foo.new("Fred")
foo.say_hello
2.) How to Implement a class Bar using the Greeting module so that the
following code example generates the expected output. Do not implement a
say_hello method.
Bar.say_hello
3.) Given this class:
class Example
@name
end
How would you describe the @name variable? Assume you have access
to this source code but can't change it. How would you add methods to
the Example class to set and get the value of @name?
4.) In a Rails application, if it takes a long time for a page to load.
If there is an action that dynamically generates a large binary file and
sends this to clients via send_data. How is this related to the slow
response time? What change can we make to avoid this?
module Greeting
def say_hello
puts "Hello, my name is #{self.name}"
end
end
1.) How to implement a class Foo using the Greeting module so that the
following code example generates the expected output. Do not implement a
say_hello method.
foo = Foo.new("Fred")
foo.say_hello
2.) How to Implement a class Bar using the Greeting module so that the
following code example generates the expected output. Do not implement a
say_hello method.
Bar.say_hello
3.) Given this class:
class Example
@name
end
How would you describe the @name variable? Assume you have access
to this source code but can't change it. How would you add methods to
the Example class to set and get the value of @name?
4.) In a Rails application, if it takes a long time for a page to load.
If there is an action that dynamically generates a large binary file and
sends this to clients via send_data. How is this related to the slow
response time? What change can we make to avoid this?