Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What is the output of the given code?
print “What’s your address”
city,state,pin=gets.chomp,gets.chomp,gets.chomp
puts “Iam from #{city} city, #{state} state, pincode: #{pin} “

What is the output of the given code?
print “What’s your address”
city,state,pin=gets.chomp,gets.chomp,gets.chomp
puts “Iam from #{city} city, #{state} state, pincode: #{pin} “
a) Error in compilation
b) Give your address
c) What’s your address? Chennai
Tamilnadu
600048
Iam from Chennai city, Tamilnadu state, pincode: 600048
d) none of the Mentioned

Answer: c
Explanation: It gets the input from used and prints it using the #{} sequence.
Output:
What’s your address? Chennai
Tamilnadu
600048
Iam from Chennai city, Tamilnadu state, pincode: 600048

Join The Discussion