Loading

Quipoin Menu

Learn • Practice • Grow

node-js / Environment Variables
mcq
Direction: Choose the correct option

Q1.

How do you access environment variables in Node.js?
A. os.env.VAR_NAME
B. global.env.VAR_NAME
C. process.env.VAR_NAME
D. env.VAR_NAME
Direction: Choose the correct option

Q2.

What is a common library for loading environment variables from a `.env` file?
A. config
B. dotenv
C. dotenv-safe
D. env-loader
Direction: Choose the correct option

Q3.

Why are environment variables important in development?
A. To configure the app per environment
B. To follow best practices
C. All of the above
D. To keep sensitive data out of code
Direction: Choose the correct option

Q4.

What does `require('dotenv').config()` do?
A. Loads variables from `.env` into `process.env`
B. Deletes environment variables
C. Creates a `.env` file
D. Logs all variables
Direction: Choose the correct option

Q5.

Should `.env` files be committed to version control?
A. Yes, for everyone to see
B. Only the example file
C. Both B and C
D. No, they contain sensitive data