Bird
0
0

What will be the output of this code snippet?

medium📝 query result Q5 of 15
DynamoDB - with AWS SDK
What will be the output of this code snippet? const expr = remove(['oldAttr']).toString(); Options: A) REMOVE oldAttr B) remove(oldAttr) C) REMOVE #oldAttr D) Error: remove() returns object, not string
AError: remove() returns object, not string
Bremove(oldAttr)
CREMOVE #oldAttr
DREMOVE oldAttr
Step-by-Step Solution
Solution:
  1. Step 1: Understand remove() helper behavior

    remove() builds a Remove expression starting with 'REMOVE' followed by attribute names.
  2. Step 2: Check toString() output

    Calling toString() returns the string 'REMOVE oldAttr' without attribute name placeholders.
  3. Final Answer:

    REMOVE oldAttr -> Option D
  4. Quick Check:

    remove() expression string = A [OK]
Quick Trick: remove() builds 'REMOVE' expressions; toString() returns string form [OK]
Common Mistakes:
MISTAKES
  • Assuming remove() returns an object only
  • Confusing attribute names with placeholders (#)
  • Using lowercase 'remove' in output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes