🎴 Flashcard Mode

programming languages Online Quiz - 148

Card1 / 20
Mastered0
Review0
QuestionClick to flip

name = "Steve Lit" name_copy = name name << "t" print "name = ", name print " name_copy = ", name_copy, "\n" ===> Find the output

AnswerClick to flip back
A
name = Steve Litt name_copy = Steve Litt
💡 Explanation:

In Ruby, the << operator modifies a string in-place. Both name and name_copy reference the same string object, so mutating it affects both variables. After name << 't', the string becomes 'Steve Litt' and both variables show this modified value.

Change Mode