DevOps MCQs - Linux, Networking and Shell for DevOps (Set 3)

DevOps MCQs - Linux, Networking and Shell for DevOps (Set 3) - CodingHumans

Most DevOps work still happens in a Linux shell, so interviews often open with simple questions on permissions, processes and networking. This third set covers file permissions, signals and systemd, ports and DNS, HTTP status codes, SSH keys, cron, and the text tools you use in scripts.

How to practise: read each question and tap the option you think is correct. You will see right away whether you got it, along with a short explanation, and your score is tracked at the bottom of the screen. This set has 15 questions.

DevOps MCQ series: | Interview Preparation Hub

Topics covered in this set

  • File permissions, chmod and umask
  • Processes, signals and systemd
  • Ports, ss and DNS resolution
  • HTTP status codes
  • SSH keys and cron syntax
  • grep, awk, sed and environment variables

DevOps MCQs with answers and explanations

Q1. After chmod 754 deploy.sh, what permissions does the file have?

a) rwxr--r-x

b) rw-r-xr--

c) rwxrw-r--

d) rwxr-xr--

Q2. A user's umask is 022. With what permissions is a new regular file created by default?

a) 600 (rw-------)

b) 666 (rw-rw-rw-)

c) 644 (rw-r--r--)

d) 755 (rwxr-xr-x)

Q3. What is the difference between kill -15 PID and kill -9 PID?

a) -15 pauses the process and -9 resumes it

b) Both send SIGKILL

c) -9 is the polite signal and -15 is forced

d) -15 sends SIGTERM, which the process can catch to shut down cleanly; -9 sends SIGKILL, which cannot be caught and stops it at once

Q4. A service was started with systemd and keeps crashing. Which command shows its recent log output?

a) systemctl enable myapp

b) journalctl -u myapp

c) ps aux myapp

d) systemctl daemon-reload myapp

Q5. What is the difference between systemctl start nginx and systemctl enable nginx?

a) enable restarts nginx every minute

b) start runs the service now; enable makes it start automatically at boot

c) They are the same

d) start installs nginx; enable runs it

Q6. An app fails to start with "address already in use" on port 8080. Which command shows the process listening on that port?

a) df -h 8080

b) ping 8080

c) chmod 8080

d) ss -ltnp | grep :8080

Q7. A server listens on 127.0.0.1:3000. Why can other machines not reach it, even with the firewall open?

a) 127.0.0.1 is the loopback address, so only connections from the same machine are accepted; it must bind to 0.0.0.0 or a public interface

b) The server needs a domain name first

c) Port 3000 is reserved for databases

d) TCP does not work on port 3000

Q8. On a typical Linux machine, what usually happens first when an app resolves api.example.com?

a) It always queries the root DNS servers directly

b) It reads the IP from the TLS certificate

c) The resolver checks /etc/hosts and its cache, then asks the configured DNS server from /etc/resolv.conf

d) It sends the request to the domain's web server

Q9. Which DNS record type maps a hostname to another hostname instead of to an IP address?

a) MX

b) AAAA

c) CNAME

d) A

Q10. A load balancer returns 502 Bad Gateway. What does this usually mean?

a) The client sent invalid JSON

b) The load balancer got an invalid response or no valid response from the upstream app, for example because the app crashed

c) The user is not logged in

d) The URL does not exist

Q11. Which pairing of HTTP status codes is correct?

a) 401 = not allowed; 403 = not authenticated

b) 401 = server error; 403 = redirect

c) 401 = not authenticated; 403 = authenticated but not allowed

d) Both mean the resource was not found

Q12. When setting up SSH key login to a server, which key goes where?

a) Both keys are copied to the server

b) The public key is added to ~/.ssh/authorized_keys on the server; the private key stays on the client

c) The private key is copied to the server's ~/.ssh/authorized_keys

d) The private key is uploaded to the Git host

Q13. A cron entry reads */15 9-17 * * 1-5 /opt/backup.sh. When does the script run?

a) Every 15 minutes between 09:00 and 17:45, Monday to Friday

b) Every 15 hours from the 9th to the 17th of each month

c) Every 15 minutes, every day

d) Once at 09:15 every weekday

Q14. Which command prints only the first column (the IP address) of each line in access.log, where fields are separated by spaces?

a) awk '{print $1}' access.log

b) sed 1p access.log

c) cut -d: access.log

d) grep -1 access.log

Q15. A shell script runs DB_HOST=db01 and then starts node app.js. Inside the app, process.env.DB_HOST is undefined. Why?

a) Node.js cannot read environment variables

b) The variable is a shell variable only; it must be exported with export DB_HOST=db01 to reach child processes

c) The variable must be written in lowercase

d) Variable names cannot contain underscores

Quick revision notes

  • chmod digits: r = 4, w = 2, x = 1 for owner, group, others; umask 022 → files 644, directories 755.
  • SIGTERM (15) can be handled for a clean shutdown; SIGKILL (9) cannot.
  • systemctl start = run it now, enable = run it at boot. See logs with journalctl -u and the unit name.
  • ss -ltnp shows listeners; 127.0.0.1 accepts only local connections, 0.0.0.0 all interfaces.
  • 401 = who are you, 403 = not allowed, 502/504 = upstream problems; cron fields: min hour dom month dow.

Frequently asked questions

How much Linux do I need for a DevOps interview?

Be comfortable with permissions, processes and signals, systemd, and checking disk and memory. Know networking commands like ss, curl and dig, and basic shell scripting with grep, awk and sed.

Why does sed -i behave differently on macOS and Linux?

GNU sed on Linux takes -i on its own. BSD sed on macOS needs a backup suffix after it, for example -i ''. Scripts that must run on both usually write to a temporary file instead.

How do I debug a DNS problem on a server?

Look up the name with dig or nslookup. Compare the answer from your configured resolver with a public one. Then check /etc/hosts and /etc/resolv.conf for anything that overrides it.

Comments

Answered 0/0Correct 0