wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

nosql 1 Quiz

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which guarantee is often associated with relational databases but is not automatically provided by many document stores?

a)

Always linear horizontal scaling

b)

Built-in schemaless flexibility

c)

Guaranteed fastest read latency

d)

ACID transactional properties

2.

When a web API blindly uses req.body as a query filter, what kind of user-supplied element most directly changes query semantics?

a)

Trailing whitespace in string values

b)

Extra JSON comments inserted by the client

c)

Boolean flags encoded as strings

d)

JSON query operators like $ne, $or, $gt

3.

What developer habit most commonly opens an application to classic SQL injection (textual SQL manipulation)?

a)

Using strict type definitions in DTOs

b)

Sending all queries through a single DB access layer

c)

Avoiding dynamic SQL entirely

d)

Concatenating user input into SQL statement strings

4.

What is the most important immediate code change when replacing db.collection.find(req.body) to stop operator injection?

a)

Return raw DB documents to the client for debugging

b)

Allow only XML input instead of JSON

c)

Wrap the whole request body in a string and store it

d)

Construct a new filter: extract expected fields, validate types, and only include those keys

5.

Which API-layer control most directly prevents clients from sending operator keys like $where?

a)

Relying on client-side JavaScript to clean inputs

b)

Using transport-layer encryption (TLS) only

c)

Logging incoming requests but not rejecting them

d)

Rejecting or stripping keys that start with $ and whitelisting allowed fields

6.

What role does a JSON schema library (e.g., Joi) play alongside parameterized routes?

a)

It replaces the DB user permission model

b)

It makes client-side validation unnecessary

c)

It converts find() into raw SQL internally

d)

It validates input shape/types before building queries

7.

Which Mongoose-related benefit most helps prevent NoSQL operator injection?

a)

Automatically running DB backups

b)

Implicitly granting admin roles to the model

c)

Automatically converting all objects to strings

d)

Enforcing a schema so unexpected operator objects are rejected or cast

8.

Which action most reduces blast radius if an attacker succeeds in injecting queries?

a)

Give the app a single all-powerful DB user for simplicity

b)

Open DB ports to the app server without firewall rules

c)

Disable audit logging to avoid information disclosure

d)

Use least-privilege DB roles so the app account only accesses necessary collections

9.

Which logging/monitoring setup best helps you detect operator-injection attempts without blocking legitimate users?

a)

Never store any request bodies to preserve privacy

b)

Only log server start/stop messages

c)

Log everything to a single local file and never rotate it

d)

Send structured request logs to a centralized SIEM and alert on $-prefixed keys or unusual query shapes

10.

Even with parameterized queries, which pattern can reintroduce injection-like risks?

a)

Using DB drivers that support placeholders

b)

Validating user-supplied numeric IDs server-side

c)

Applying schema validation on inputs

d)

Dynamically building identifiers or raw query fragments by concatenating derived strings

11.

Why are NoSQLi attempts often harder for signature-based WAF rules to catch than SQLi?

a)

NoSQLi always uses the same fixed token that WAFs already block

b)

NoSQLi payloads are always encrypted end-to-end

c)

NoSQLi only happens on local dev machines, not production

d)

Operator-based attacks are structured JSON objects that can look like benign payloads and vary widely

12.

Which change is the safest quick patch if you discover public endpoints accepting arbitrary aggregation stages?

a)

Allow arbitrary admin tokens for easier testing

b)

Disable HTTPS to simplify debugging

c)

Return DB error stacks verbatim to clients to speed triage

d)

Refuse client-supplied pipeline stages; only allow server-built, validated pipeline templates

13.

What defensive measure most directly prevents attackers from executing JavaScript inside MongoDB via user input?

a)

Enabling $where by default for flexibility

b)

Accepting client JS snippets and eval()ing them on demand

c)

Putting DB credentials in client-side code for speed

d)

Disabling server-side JS features like $where/$function and rejecting user-supplied code

14.

Which pattern in logs would most clearly indicate repeated operator-injection probing?

a)

Mostly GETs for static assets like /favicon.ico

b)

Only legitimate admin console activity at business hours

c)

A steady stream of identical benign search queries

d)

Many requests whose bodies/params contain $ne, $or, $where, or similar tokens

15.

When is whitelisting field names inadequate by itself to stop NoSQLi?

a)

When you also validate types and lengths thoroughly

b)

When you strip $-prefixed keys before validation

c)

When you build queries only from whitelisted keys server-side

d)

When whitelisted values are concatenated into identifiers or used to construct raw query fragments