Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.
True
False
View Answer
Correct Answer: A — True
Explanation:
Ruby recognizes =begin and = begin in different way.
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
Correct Answer: A — True
Explanation:
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
Correct Answer: D — All of the mentioned
Explanation:
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
Correct Answer: B — 4
Explanation:
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
Correct Answer: A — True
Explanation:
We use # in a single line comment.
How to comment a single line?
Using #
Using begin and end
Using //
None of the mentioned
Correct Answer: A — Using #
Explanation:
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
Correct Answer: A — Using multiline comments
Explanation:
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
Correct Answer: D — All of the mentioned
Explanation:
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
Correct Answer: D — All of the mentioned
Explanation:
It is the efficient way of programming and easy to understand.