## Question 1 Select the correct output for the given code: ```text snapshot array = Constructor(3) snapshot array.set value(0, 4) snapshot array.snapshot() snapshot array.get value(0, 0) snapshot array.set value(1, 6) snapshot array.snapshot() snapshot array.get value(1, 1) ``` ### Options 1. 6 4 Incorrect ---------------------------- 2. 4 6 Correct * Calling set value(0, 4) will set the value 4 at index 0. * Calling snapshot() will take a snapshot. * Calling get value(0, 0) will return the value at the 0th snapshot at the 0th index, that is 4. * Calling again set value(1, 6) will set the value 6 at the current snapshot. * Calling again snapshot() will take a snapshot * Calling get value(1, 1) will return the value at the 1th snapshot at the 1th index, that is 6. ---------------------------- 3. 2 3 Incorrect ---------------------------- 4. 3 2 Incorrect ---------------------------- --------------------------------------------- ## Question 2 Select the correct output for the given code: ```text snapshot array = Constructor(3) snapshot array.set value(0, 6) snapshot array.snapshot() snapshot array.get value(0, 0) snapshot array.set value(1, 8) snapshot array.snapshot() snapshot array.get value(1, 1) ``` ### Options 1. 6 8 Correct * Calling set value(0, 6) will set the value 6 at index 0. * Calling snapshot() will take a snapshot. * Calling get value(0, 0) will return the value at the 0th snapshot at the 0th index, that is 6. * Calling again set value(1, 8) will set the value 8 at the current snapshot. * Calling again snapshot() will take a snapshot * Calling get value(1, 1) will return the value at the 1th snapshot at the 1th index, that is 8. ---------------------------- 2. 8 6 Incorrect ---------------------------- 3. 1 1 Incorrect ---------------------------- 4. 0 0 Incorrect ---------------------------- ---------------------------------------------