What is the syntax for defining a method in Ruby?
روبی میں طریقہ کی وضاحت کے لیے نحو کیا ہے؟
- def method_name
- method method_name
- function method_name
- define method_name
Explanation
In Ruby, the syntax for defining a method is:
def method_name(parameters)
# method body
end
The 'def' keyword is used to define a method, followed by the method name and parameters in parentheses.
The method body is indented and enclosed by the 'end' keyword.
Related MCQs
دوسری نسل کے کمپیوٹر میں مندرجہ ذیل میں سے کون سی ٹیکنالوجیز استعمال ہوئی؟
- Vacum Tubes
- Transistors
- Integrated circuits
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر کا بانی کس کو کہا جاتا ہے؟
- Barbara Liskov
- Tim Berners-Lee
- Charles Babbage
- John von Neumann
اس سوال کو وضاحت کے ساتھ پڑھیں
کون سی سہولت دو یا دو سے زیادہ ٹاسک، جابز یا پروگرامز کو بیک وقت اجازت کی اجازت ہے؟
- Multi-computing
- Multi-processing
- Multi-tasking
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
درج ذیل میں سے آپریٹنگ سسٹم کی مثال کون سی ہے؟
- Photoshop
- MS Windows
- MS Word
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
آپریٹنگ سسٹم کے کرنل کا بنیادی کام کیا ہے؟
- Manage hardware and system resources
- Run user applications
- Provide internet connectivity
- None of these