Multiple choice technology enterprise content management

A TextObject having ID=100, has initial value of "Intial Value" The following code operation is performed on it. var test=new WebObject()// Line 1 var test1=new WebObject()// Line 2 test.loadById(100)// Line 3 write(test.text) // Line 4 test.text = "New 1" // Line 5 write(test.text)// Line 6 test1.loadById(100)// Line 7 write(test1.text)// Line 8 What values will the write statements on Line 4, Line 6 and Line 8 result.

  1. Initial Value, New 1, Initial Value

  2. Initial Value, New 1, New 1

  3. Initial Value, New 1, Line 7 will result in a Runtime error

  4. Compilation Error due to Line 7 ( Duplicate Loading )

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Line 4 writes 'Initial Value' because loadById retrieves the current value. Line 6 writes 'New 1' because test.text was modified. Line 8 writes 'Initial Value' because test1 is a NEW WebObject instance that loads the original data - it doesn't share the reference with 'test'. The key insight is that loadById retrieves fresh data, it doesn't create a shared reference.