D278 ITSW 2113 Scripting & Programming
Foundations
Final Assessment Review (Qns & Ans)
2025
1. Scenario – Asynchronous I/O in AWS Lambda Functions
A developer is writing a Python-based AWS Lambda function to
process file uploads from S3 and wishes to optimize performance
for I/O-bound tasks. Which Python library is best suited for
handling asynchronous I/O operations in this context?
- A. `threading`
- B. `multiprocessing`
- C. `asyncio`
- D. `queue`
©2025
, Correct ANS: C. `asyncio`
Rationale: The `asyncio` library enables asynchronous I/O
operations. In a Lambda environment—where efficient handling
of I/O-bound tasks is critical—using `asyncio` allows the function
to perform non-blocking operations and better utilize resources.
---
2. Scenario – Secure AWS Interactions in Shell Scripts
A cloud engineer writes a Bash script to automate backups to
Amazon S3. To ensure secure authentication and interaction with
AWS services, which tool should be incorporated into the script?
- A. cURL
- B. AWS CLI
- C. FTP
- D. OpenSSL
Correct ANS: B. AWS CLI
Rationale: The AWS Command Line Interface (CLI) provides
secure and authenticated methods for interacting with AWS
services. Using the AWS CLI within scripts enables automated,
repeatable, and secure operations on resources like S3.
©2025
,---
3. Scenario – Exception Handling in Python Scripts for AWS
Automation
A developer is automating AWS resource provisioning using
Python with the Boto3 library. Which approach should be
implemented to gracefully handle network timeouts during API
calls?
- A. Catching a generic `Exception` only
- B. Using a try-except block to catch specific exceptions (e.g.,
botocore.exceptions.EndpointConnectionError)
- C. Ignoring timeouts to retry automatically
- D. Exiting the script immediately on any error
Correct ANS: B. Using a try-except block to catch specific
exceptions (e.g., botocore.exceptions.EndpointConnectionError)
Rationale: Handling specific exceptions enables precise
mitigation strategies (like retries or error logging) without
masking other types of errors. This approach increases the fault
tolerance and reliability of AWS automation scripts.
---
4. Scenario – Managing Configuration in Deployment Scripts
©2025
, A cloud engineer writes a Bash script to deploy AWS
CloudFormation templates dynamically. To avoid security risks
associated with hardcoding settings, which practice is most
recommended?
- A. Hardcoding sensitive configuration values
- B. Using environment variables and configuration files
- C. Passing all parameters directly as command-line arguments
- D. Embedding credentials within the script
Correct ANS: B. Using environment variables and
configuration files
Rationale: Storing sensitive values in environment variables or
secure configuration files prevents exposure of credentials and
other data within scripts. This approach enhances security and
eases maintenance.
---
5. Scenario – Version Control for Deployment Scripts
A developer is creating a Python script to deploy AWS resources
with CloudFormation. To ensure traceability and collaboration,
which version control system is most widely recommended?
- A. CVS
- B. Git
©2025
Foundations
Final Assessment Review (Qns & Ans)
2025
1. Scenario – Asynchronous I/O in AWS Lambda Functions
A developer is writing a Python-based AWS Lambda function to
process file uploads from S3 and wishes to optimize performance
for I/O-bound tasks. Which Python library is best suited for
handling asynchronous I/O operations in this context?
- A. `threading`
- B. `multiprocessing`
- C. `asyncio`
- D. `queue`
©2025
, Correct ANS: C. `asyncio`
Rationale: The `asyncio` library enables asynchronous I/O
operations. In a Lambda environment—where efficient handling
of I/O-bound tasks is critical—using `asyncio` allows the function
to perform non-blocking operations and better utilize resources.
---
2. Scenario – Secure AWS Interactions in Shell Scripts
A cloud engineer writes a Bash script to automate backups to
Amazon S3. To ensure secure authentication and interaction with
AWS services, which tool should be incorporated into the script?
- A. cURL
- B. AWS CLI
- C. FTP
- D. OpenSSL
Correct ANS: B. AWS CLI
Rationale: The AWS Command Line Interface (CLI) provides
secure and authenticated methods for interacting with AWS
services. Using the AWS CLI within scripts enables automated,
repeatable, and secure operations on resources like S3.
©2025
,---
3. Scenario – Exception Handling in Python Scripts for AWS
Automation
A developer is automating AWS resource provisioning using
Python with the Boto3 library. Which approach should be
implemented to gracefully handle network timeouts during API
calls?
- A. Catching a generic `Exception` only
- B. Using a try-except block to catch specific exceptions (e.g.,
botocore.exceptions.EndpointConnectionError)
- C. Ignoring timeouts to retry automatically
- D. Exiting the script immediately on any error
Correct ANS: B. Using a try-except block to catch specific
exceptions (e.g., botocore.exceptions.EndpointConnectionError)
Rationale: Handling specific exceptions enables precise
mitigation strategies (like retries or error logging) without
masking other types of errors. This approach increases the fault
tolerance and reliability of AWS automation scripts.
---
4. Scenario – Managing Configuration in Deployment Scripts
©2025
, A cloud engineer writes a Bash script to deploy AWS
CloudFormation templates dynamically. To avoid security risks
associated with hardcoding settings, which practice is most
recommended?
- A. Hardcoding sensitive configuration values
- B. Using environment variables and configuration files
- C. Passing all parameters directly as command-line arguments
- D. Embedding credentials within the script
Correct ANS: B. Using environment variables and
configuration files
Rationale: Storing sensitive values in environment variables or
secure configuration files prevents exposure of credentials and
other data within scripts. This approach enhances security and
eases maintenance.
---
5. Scenario – Version Control for Deployment Scripts
A developer is creating a Python script to deploy AWS resources
with CloudFormation. To ensure traceability and collaboration,
which version control system is most widely recommended?
- A. CVS
- B. Git
©2025