a) Gets add an extra new line while chomp removes it b) Gets remove an extra new line c) Chomp ...
View QuestionWhich sequence can be used to substitute the value of any ruby expression in a string?
a) #(expr) b) #{expr} c) #expr d) None of the mentioned Answer: b Explanation: #{expr} is valid.
View Question
What is the output of given code?
puts “what is your first name?”
name=gets.chomp
puts “what is your surname?”
surname=gets.chomp
What is the output of given code? puts "what is your first name?" name=gets.chomp ...
View QuestionFor getting an input from the user which method is used?
a) get b) gets.chomp c) get-s d) chomp Answer: b Explanation: The method gets.chomp takes ...
View QuestionWe use semicolon or parentheses after every print or puts statement.
a) True b) False Answer: b Explanation: No semicolon or parentheses is required.
View Question
What is the output of the given code
print “Hey”
puts “Everyone!”
print “We are learning Ruby”
What is the output of the given code print "Hey" puts "Everyone!" ...
View QuestionWhy is the library function ‘puts’used for?
a) Prints whatever is given and print it to the screen b) Prints whatever is given and insert ...
View QuestionWhich of the following is not a valid library function?
a) Puts b) Print c) Gets d) Get Answer: d Explanation: gets is used for taking ...
View QuestionWhat is the range of octal notation (\nnn)?
a) 0-8 b) 0-7 c) 0-A d) none of the Mentioned Answer: b Explanation: Octal notation ranges from ...
View QuestionWhich of the following is not a valid datatype?
a) Float b) Integer c) Binary d) Timedate Answer: d Explanation: datetime is valid datatype but timedate ...
View Question