Q. What is the difference between a block and a proc in Ruby?

  • (A) A proc can be passed directly to methods, while a block needs to be converted into an object
  • (B) A proc is an anonymous function, while a block is a named function
  • (C) A block can be passed directly to methods, while a proc needs to be converted into an object
  • (D) A block is an anonymous function, while a proc is a named function
πŸ’¬ Discuss
βœ… Correct Answer: (C) A block can be passed directly to methods, while a proc needs to be converted into an object

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
163
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
83%
Success Rate