Bird
0
0

Given the following code snippet, what will be the output?

medium📝 query result Q4 of 15
DynamoDB - with AWS SDK
Given the following code snippet, what will be the output?
import boto3
client = boto3.client('dynamodb')
response = client.list_tables()
print(response['TableNames'])
AAn error because list_tables is not a valid client method.
BAn empty dictionary.
CA list of table names in your DynamoDB account.
DA string with all table names concatenated.
Step-by-Step Solution
Solution:
  1. Step 1: Understand list_tables method

    The client method list_tables returns a dictionary with a key 'TableNames' containing a list of table names.
  2. Step 2: Analyze print statement output

    Printing response['TableNames'] outputs the list of table names as a Python list.
  3. Final Answer:

    A list of table names in your DynamoDB account. -> Option C
  4. Quick Check:

    list_tables() returns table names list [OK]
Quick Trick: list_tables() returns dict with 'TableNames' list [OK]
Common Mistakes:
MISTAKES
  • Assuming list_tables is invalid for client
  • Expecting a string instead of list
  • Confusing output with empty dict

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes