Ruby - String Operations
What is the output of the following Ruby code?
str = " Hello World " puts str.strip.upcase
str = " Hello World " puts str.strip.upcase
strip to the stringstrip removes spaces at the start and end, so " Hello World " becomes "Hello World".upcase to the stripped stringupcase converts all letters to uppercase, so "Hello World" becomes "HELLO WORLD".15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions