Assignment operator is also known as relational operator.
True
False
View Answer
Correct Answer: A — True
Explanation:
Assignment operator is used for assigning a value.
Browse topic-based Ruby practice sets.
96 practice sets · Page 4 of 5
Assignment operator is also known as relational operator.
True
False
Correct Answer: A — True
Explanation:
Assignment operator is used for assigning a value.
The '=' is used for assigning value to variable?
True
False
Correct Answer: A — True
Explanation:
The '=' is known as assignment operator.
The == 'is equal to' is known as relational operator.
True
False
Correct Answer: A — True
Explanation:
The == is used to compare two things are equal or not and hence it is known as comparator/relational operator.
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.
A case statement compares the expression specified by case and that specified by when using the === operator and executes the code of the when clause that matches.
True
False
Correct Answer: A — True
Explanation:
A case statement is basically the multiple if-elsif-else statements.
The expression specified by the when clause is evaluated as the left operand. If no when clauses match, case executes the code of the else clause.
True
False
Correct Answer: A — True
Explanation:
Else clause is executed only when no 'when' clauses match.
Ruby can be used for developing internet and intranet applications.
True
False
Correct Answer: A — True
Explanation:
Ruby is a server side scripting language used to create CGI(common gateway interface) scripts and hence can be used for developing internet and intranet applications.
It is must for Ruby to use a compiler.
True
False
Correct Answer: B — False
Explanation:
No compiler is required for ruby as it is an interpreted language.
Ruby can be embedded into Hypertext Markup Language(HTML).
True
False
Correct Answer: A — True
Explanation:
Ruby can easily be encapsulated into HTML.
Which of the following are valid floating point literal?
.5
2
0.5
None of the mentioned
Correct Answer: C — 0.5
Explanation:
floating point literals are valid only when they have digits on both the sides of decimal point.
What is the extension used for saving the ruby file?
.ruby extension
.rb extension
.rrb extension
None of the mentioned
Correct Answer: B — .rb extension
Explanation:
Ruby files must be saved with the extension .rb.
Which of the following languages syntax matches with the Ruby's syntax?
Perl
PHP
Java
Jquery
Correct Answer: A — Perl
Explanation:
Most of the syntax of perl language matches with that of Ruby's.
Which of the following features does the 2.0 version of ruby supports?
Method keyword arguments
New literals
Security fixes
All of the mentioned
Correct Answer: D — All of the mentioned
Explanation:
Ruby2.0 has several new added features and it is much stable than its older versions.