Home / MCQ Bank / Computer
Computer Classes And Objects In Ruby

What is the syntax for defining an instance method in Ruby?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option A • def method_name

Related Computer Questions

What will be the output of the following C++ code? #include <iostream> using namespace std; class A{ public: int a; A(int a){ this->a = a; } }; int main(int argc, char const *argv[]) { A a1, a2(10); cout<<a2.a; return 0; } Which graph is also known as biclique? Which algorithm in C++ STL is used to merge two sorted ranges into a single sorted range? A graph is said to have a negative weight cycle when? What happens when this C++ program is compiled? #include <iostream> #include <string> #include <cstdlib> using namespace std; class A { int a; public: A(){} }; class B: public A { int b; public: B(){} }; void func() { B b; throw b; } int main() { try{ func(); } catch(A a){ cout<<"Caught A Class\n"; } catch(B b){ cout<<"Caught B Class\n"; } }