Back-End Development Development 5 — Questions and Answers
Question 1: Which back-end pattern involves a service publishing events that other services consume asynchronously?
- Request-Response
- Event-Driven Architecture (Correct answer)
- Synchronous RPC
- Polling Pattern
Correct answer: Event-Driven Architecture
Event-Driven Architecture decouples services by having producers publish events to a broker (e.g., Kafka, RabbitMQ) that consumers subscribe to independently.
Question 2: What is the key difference between symmetric and asymmetric encryption in back-end security?
- Symmetric uses the same key for encryption and decryption; asymmetric uses a public/private key pair (Correct answer)
- Symmetric is slower; asymmetric is always faster
- Symmetric only works for text data; asymmetric works for binary data
- Symmetric requires a certificate authority; asymmetric does not
Correct answer: Symmetric uses the same key for encryption and decryption; asymmetric uses a public/private key pair
Symmetric encryption uses one shared key for both operations (fast, good for bulk data), while asymmetric uses a key pair where the public key encrypts and the private key decrypts.
Question 3: In GraphQL, what is the purpose of a resolver function?
- To define the schema types and their relationships
- To fetch or compute the data for a specific field in a query (Correct answer)
- To validate incoming query syntax before execution
- To cache query results on the client side
Correct answer: To fetch or compute the data for a specific field in a query
A resolver is a function that returns the data for a specific GraphQL field, fetching it from a database, API, or any other data source.
Question 4: Which technique prevents SQL injection attacks in back-end code?
- Encoding all query results as Base64 before storage
- Using parameterized queries or prepared statements (Correct answer)
- Uppercasing all user input before interpolation
- Limiting query length to 256 characters
Correct answer: Using parameterized queries or prepared statements
Parameterized queries separate SQL code from user-supplied data, so the database driver handles escaping and the input can never alter query structure.
Question 5: What does eventual consistency mean in a distributed back-end system?
- The system guarantees all nodes reflect the latest write immediately
- Given enough time without new writes, all nodes will converge to the same value (Correct answer)
- Data is permanently lost if a node fails during replication
- Only the primary node is allowed to serve reads
Correct answer: Given enough time without new writes, all nodes will converge to the same value
Eventual consistency is a guarantee that, absent further updates, all replicas will eventually converge to the same state, trading immediate consistency for higher availability.
Question 6: Which HTTP header is used to prevent clickjacking attacks on web back-ends?
- Content-Security-Policy
- X-Frame-Options (Correct answer)
- Strict-Transport-Security
- X-XSS-Protection
Correct answer: X-Frame-Options
X-Frame-Options (and the frame-ancestors CSP directive) tells browsers not to render the page inside an iframe, preventing clickjacking.
Question 7: In a CI/CD pipeline, what is the primary purpose of a staging environment before production deployment?
- To permanently store build artifacts for audit purposes
- To validate the build in a production-like environment before releasing to real users (Correct answer)
- To run unit tests that cannot be run locally
- To host documentation for the development team
Correct answer: To validate the build in a production-like environment before releasing to real users
A staging environment mirrors production configuration so teams can catch environment-specific bugs and validate behavior before exposing changes to real users.
Which back-end pattern involves a service publishing events that other services consume asynchronously?