Multiple choice technology programming languages

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

  1. name = Steve Li name_copy = Steve Lit

  2. name = Steve Li name_copy = Steve Li

  3. name = Steve Litt name_copy = Steve Lit

  4. name = Steve Litt name_copy = Steve Litt

Reveal answer Fill a bubble to check yourself
D Correct answer
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.