Basic Syntax In Ruby - Study Mode

[#6] What does the 'gets' method do in Ruby?
Correct Answer

(C) Reads input from user

[#7] Which of the following is NOT a valid data type in Ruby?
Correct Answer

(C) Double

[#8] What is the correct syntax for defining a variable in Ruby?
Correct Answer

(C) name = value

[#9] What does the 'print' method do in Ruby?
Correct Answer

(A) Prints to console

[#10] What is the output of given code? puts "what is your first name?"
name=gets.chomp
puts "what is your surname?"
surname=gets.chomp
Correct Answer

(B) What is your first name? xyz(enter any name) What is your surname? wtu(enter your surname)