wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Security Coding Quiz

Total questions: 14

Worksheet time: 2mins

Name
Class
Date
1.

it’s safe to store a database password in a private GitHub repo.

a)

True

b)

False

2.

Which practice helps prevent SQL injection vulnerabilities?

a)

Using eval() on inputs

b)

Strict input validation and parameterized queries

c)

Giving the DB user full admin rights

3.

What is the purpose of Azure Key Vault?

a)

Store large BLOBs

b)

Perform automated database backups

c)

Manage and audit encryption keys/secrets safely

4.

What is the main risk of using eval() on user input in Python?

a)

It’s slow

b)

It can execute arbitrary code from the user

c)

It can’t handle strings

d)

It doesn't support variables

5.

Why shouldn’t you log user passwords or API keys?

a)

There is no problem with that

b)

Because people with log access can see them breaking least privilege rule

c)

Because logs are often accessible and can leak secrets

6.

Which of the following is the best practice for storing a production API key?

a)

In a .env file committed to the repo

b)

As a plaintext string in your source code

c)

In Azure Key Vault with restricted access

d)

Inside a shared Excel file on SharePoint

7.

What does “principle of least privilege” help prevent?

a)

Data duplication

b)

Time zone issues

c)

Code duplication

d)

Lateral movement in case of a breach

8.

You see this in a Python repo: password = "mydbpass123" — what's the first thing you do?

a)

Shrug, it’s just dev code

b)

Escalate to your manager

c)

Replace it with os.getenv("DB_PASS") and store it in Key Vault

d)

Rename the variable

9.

Which of the following is a bad idea when handling secrets in CI/CD?

a)

Using a vault to retrieve secrets dynamically

b)

Hardcoding credentials in the pipeline YAML

c)

Masking secrets in logs

d)

Using GitHub Secrets to pass credentials

10.

What’s the recommended way to avoid logging sensitive data accidentally?

a)

Use structured logging with filters/masking

b)

Turn off logging entirely

c)

Only log in production

d)

Print everything to stdout

11.

What happens if you delete a Key Vault without purge protection enabled?

a)

The vault can be restored anytime

b)

The secrets are backed up to GitHub

c)

You’re promoted to Senior Dev automatically

d)

It can be permanently deleted immediately

12.

Which is a safe way to debug an app that uses secrets?

a)

Print secrets to the terminal to verify

b)

Use breakpoints and inspect variables without printing them

c)

Dump environment variables into logs

13.

Which attack can result from poor input validation?

a)

Secret rotation

b)

SQL Injection

c)

Slow database reads

d)

Logging latency

14.

Which of the following is a consequence of exposing sensitive information in logs?

a)

Improved debugging capabilities

b)

Increased application performance

c)

Potential data breaches and compliance issues

d)

Enhanced user experience