MCQ (Linux Operating System)
Q1. Which of the following is a feature of Linux OS?
A) Open Source
B) Multitasking
C) Security
D) All of the above
Answer: D) All of the above
Q2. Which component of Linux interacts directly with the hardware?
A) Shell
B) Kernel
C) GNU Utilities
D) Applications
Answer: B) Kernel
Q3. Bash, Zsh, and Dash are types of:
A) Kernels
B) Shells
C) Editors
D) Utilities
Answer: B) Shells
Q4. Which file type in Linux stores compiled programs?
A) Text file
B) Binary file
C) Directory file
D) Special file
Answer: B) Binary file
Q5. The Linux Directory Structure follows which standard?
A) LFS
B) FHS
C) POSIX
D) ISO
Answer: B) FHS
Q6. Which command is used to display the current working directory?
A) cd
B) pwd
C) ls
D) tree
Answer: B) pwd
BY : DR. KHUSHBU PATEL 1
Q7. Which command is used to create a new directory?
A) touch
B) mkdir
C) rmdir
D) cp
Answer: B) mkdir
Q8. Which command is used to remove a file?
A) rm
B) mv
C) cp
D) touch
Answer: A) rm
Q9. Which command changes file permissions?
A) chown
B) chmod
C) chgrp
D) umask
Answer: B) chmod
Q10. Which command displays currently logged-in users?
A) who
B) whoami
C) man
D) echo
Answer: A) who
Q11. What does the head command do?
A) Shows last lines of a file
B) Shows first lines of a file
C) Counts words
D) Compares two files
Answer: B) Shows first lines of a file
Q12. Which command is used to list running processes?
A) ps
B) fg
C) kill
D) sleep
Answer: A) ps
Q13. Which command schedules a one-time job in Linux?
A) cron
B) at
BY : DR. KHUSHBU PATEL 2
C) batch
D) sleep
Answer: B) at
Q14. Which command is used to schedule recurring jobs?
A) at
B) batch
C) crontab
D) sleep
Answer: C) crontab
Q15. Which command is used to run a shell script?
A) run script.sh
B) ./script.sh
C) bash script.sh
D) Both B and C
Answer: D) Both B and C
Q16. Which of the following is a wildcard in Linux?
A) *
B) ?
C) []
D) All of the above
Answer: D) All of the above
Q17. What does the > operator do in Linux?
A) Appends output to a file
B) Redirects output to a file
C) Redirects input from a file
D) None of the above
Answer: B) Redirects output to a file
Q18. Which operator is used to combine commands such that the second executes only if
the first succeeds?
A) ||
B) &&
C) !
D) |
Answer: B) &&
Q19. Which command is used for arithmetic operations in shell?
A) expr
B) $(( ))
C) Both A and B
BY : DR. KHUSHBU PATEL 3
D) let
Answer: C) Both A and B
Q20. What is the purpose of test or [ ] command in shell scripting?
A) File testing
B) Numeric comparison
C) String comparison
D) All of the above
Answer: D) All of the above
Q21. Which command is used for pattern matching using regular expressions?
A) sed
B) grep
C) awk
D) cut
Answer: B) grep
Q22. Which grep variant supports extended regular expressions?
A) grep
B) egrep
C) fgrep
D) cut
Answer: B) egrep
Q23. Which command is used for stream editing (search and replace)?
A) awk
B) sed
C) grep
D) sort
Answer: B) sed
Q24. Which sed command deletes a line containing a pattern?
A) sed 's/pattern//' file
B) sed '/pattern/d' file
C) sed 'i pattern' file
D) sed 'p pattern' file
Answer: B) sed '/pattern/d' file
Q25. Which command inserts a line using sed?
A) sed 's/pattern/new/'
B) sed '/pattern/i new_line'
C) sed 'd pattern'
D) sed 'p pattern'
Answer: B) sed '/pattern/i new_line'
BY : DR. KHUSHBU PATEL 4
Q26. Which Linux shell is known for high customization and plugins?
A) Bash
B) Zsh
C) Dash
D) KornShell
Answer: B) Zsh
Q27. Which of the following is NOT a Linux file type?
A) Text file
B) Binary file
C) Database file
D) Special file
Answer: C) Database file
Q28. What is the main role of the Kernel in Linux?
A) Provides user interface
B) Manages hardware and system resources
C) Executes shell scripts
D) Edits text files
Answer: B) Manages hardware and system resources
Q29. Which directory contains system configuration files?
A) /bin
B) /etc
C) /usr
D) /home
Answer: B) /etc
Q30. Which command lists all files, including hidden files?
A) ls
B) ls -l
C) ls -a
D) tree
Answer: C) ls -a
Q31. Which command is used to copy files?
A) mv
B) cp
C) rm
D) touch
Answer: B) cp
Q32. What does chmod 755 file do?
A) Gives read, write, execute to all
B) Gives read/write to owner, read/execute to others
BY : DR. KHUSHBU PATEL 5
C) Gives execute permission only
D) Removes all permissions
Answer: B) Gives read/write/execute to owner, read/execute to others
Q33. Which command is used to check the manual of other commands?
A) man
B) info
C) help
D) all of the above
Answer: D) all of the above
Q34. What is the function of uniq command?
A) Sorts lines
B) Displays unique lines only
C) Reverses file content
D) Counts words
Answer: B) Displays unique lines only
Q35. Which command brings a background job to the foreground?
A) ps
B) fg
C) bg
D) kill
Answer: B) fg
Q36. Which metacharacter is used for command substitution?
A) $(...)
B) *
C) |
D) >
Answer: A) $(...)
Q37. Which loop executes at least once even if the condition is false?
A) for
B) while
C) until
D) do-while
Answer: D) do-while
Q38. Which logical operator executes the second command if the first fails?
A) &&
B) ||
C) !
D) ;
Answer: B) ||
BY : DR. KHUSHBU PATEL 6
Q39. How do you comment a line in a shell script?
A) // comment
B) # comment
C)
D) /* comment */
Answer: B) # comment
Q40. Which command is used to create an empty file?
A) touch
B) cat
C) cp
D) echo
Answer: A) touch
Q41. Which grep option ignores case while searching?
A) -i
B) -v
C) -c
D) -n
Answer: A) -i
Q42. Which fgrep command searches for fixed strings without interpreting regex?
A) fgrep "pattern" file
B) grep -E "pattern" file
C) egrep "pattern" file
D) sed 's/pattern//' file
Answer: A) fgrep "pattern" file
Q43. Which sed command substitutes the first occurrence of a pattern on a line?
A) sed 's/pattern/replacement/' file
B) sed 's/pattern/replacement/g' file
C) sed '/pattern/d' file
D) sed 'i new_line' file
Answer: A) sed 's/pattern/replacement/' file
Q44. Which command counts the number of lines, words, and characters?
A) wc
B) head
C) tail
D) sort
Answer: A) wc
Q45. Which command extracts specific columns from a file?
A) cut
B) grep
BY : DR. KHUSHBU PATEL 7
C) sed
D) awk
Answer: A) cut
BY : DR. KHUSHBU PATEL 8