What does %x!ls! represents?
Same as back tick command output ls
Same as 'x'
Same as "xls"
None of the mentioned
View Answer
Correct Answer: A — Same as back tick command output ls
Explanation:
It is same as back tick command output ls.
7 practice sets · Page 1 of 1
What does %x!ls! represents?
Same as back tick command output ls
Same as 'x'
Same as "xls"
None of the mentioned
Correct Answer: A — Same as back tick command output ls
Explanation:
It is same as back tick command output ls.
What does %Q{ Learn ruby language } represents?
" Learn Ruby language "
"%{ Learn Ruby language }"
"%Q{ Learn Ruby language }"
None of the mentioned
Correct Answer: A — " Learn Ruby language "
Explanation:
Anything inside %Q{} is written inside "".
What does %{Learn ruby language} represents?
"Learn Ruby language"
"%{Learn Ruby language}"
" Learn Ruby language "
None of the mentioned
Correct Answer: A — "Learn Ruby language"
Explanation:
Anything written inside %{} is same as anything written inside "".
What do we mean by expression substitution?
Embedding the value of Ruby expression into a string using #{ }
Substituting string functions
Storing string value
None of the mentioned
Correct Answer: A — Embedding the value of Ruby expression into a string using #{ }
Explanation:
Strings are displayed #{} sequence.
What is the role of ! at the end of the capitalize method?
It is the syntax for using capitalize method
It modifies the value stored in the variable
It indicates the termination of string
None of the mentioned
Correct Answer: B — It modifies the value stored in the variable
Explanation:
It is used for modifying the variable.
What is the use of .capitalize method?
It capitalizes the entire string
It capitalize on the first letter of the string
It capitalize the strings which are in small case
All of the mentioned
Correct Answer: B — It capitalize on the first letter of the string
Explanation:
It capitalizes only the first letter.
The .upcase and .capitalize method are used for capitalizing the whole string.
True
False
Correct Answer: B — False
Explanation:
The .capitalize method doesn't change the whole string to uppercase, it just capitalizes the first letter.