Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.
True
False
Answer and explanation
Ruby recognizes =begin and = begin in different way.
ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
8 practice sets · Page 1 of 1
Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.
True
False
Ruby recognizes =begin and = begin in different way.
Why do we use =begin and =end?
To mark the start and end of multiline comment
To comment multiple lines
To avoid the use of # again and again
All of the mentioned
Easier way to comment multiple lines.
What is the output of the given code "Ruby".length #to find the length of given string
4 to find the length of given string
4
To find the length of given string
Ruby
It finds the length of string.
This the right way to comment a single line. "Ruby".length # I'm a single line comment!
True
False
We use # in a single line comment.
How to comment a single line?
Using #
Using begin and end
Using //
None of the mentioned
Use # to comment single line.
How to comment multiple lines in ruby?
Using multiline comments
Using single line comments
No option to comment
All of the mentioned
Multiple lines can be commented using multiline comments.
Which of the following type of comments are valid in ruby?
Single line comments
Multi line comments
Double line comments
All of the mentioned
Double line comments comes under multiline comment.
Why do we use comments?
For later use to understand the working of the program
It is an efficient way of programming
It makes easy for the third person to understand
All of the mentioned
It is the efficient way of programming and easy to understand.