0% found this document useful (0 votes)
32 views

Os Question Bank Unit-4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Os Question Bank Unit-4

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

INSTITUTE OF TECHNOLOGY & MANAGEMENT , ALIGARH

OPERATING SYSTEM QUESTION BANK UNIT 4


BCA IIND YEAR (3RD SEMESTER)

1. What command is typically used to log into a Unix system?


- A) logon
- B) login
- C) enter
- D) access
Answer: B) login

2. What is the standard prompt for a Unix shell?


- A) >
- B) #
- C) $
- D) :
Answer: C) $

3. Which command is used to log off from a Unix session?


- A) exit
- B) logout
- C) close
- D) end
Answer: B) logout

4. What information is typically required to log in to a Unix system?


- A) Username and password
- B) Email address and password
- C) ID number and PIN
- D) Security question answer
Answer: A) Username and password

5. What happens if you enter an incorrect password?


- A) You are logged in as a guest
- B) You receive an error message and can try again
- C) The system shuts down
- D) You are locked out for a period
Answer: B) You receive an error message and can try again

6. What does the `man` command do?


- A) Manages files
- B) Displays the manual for a command
- C) Shows system information
- D) Logs user actions
Answer: B) Displays the manual for a command

7. How do you view the man page for the `ls` command?
- A) man ls
- B) help ls
- C) ls -man
- D) view ls
Answer: A) man ls

8. Which command can you use to safely log off?


- A) exit
- B) logout
- C) Both A and B
- D) None of the above
Answer: C) Both A and B

9. What happens when you log off from a Unix session?


- A) Your files are deleted
- B) All running processes are terminated
- C) The system shuts down
- D) You are redirected to another user
Answer: B) All running processes are terminated

10. What is the root directory represented by in Unix?


- A) /
- B) \
- C) ~
- D) .
Answer: A) /
11. Which command lists files in a directory?
- A) ls
- B) dir
- C) list
- D) show
Answer: A) ls

12. What is the maximum length for a file name in Unix?


- A) 255 characters
- B) 512 characters
- C) 1024 characters
- D) No limit
Answer: A) 255 characters

13. Which character is used to separate directories in a file path?


- A) /
- B) \
- C) :
- D) ;
Answer: A) /

14. What command creates a new directory?


- A) newdir
- B) mkdir
- C) createdir
- D) dircreate
Answer: B) mkdir

15. Which command changes the current directory?


- A) cd
- B) chdir
- C) setdir
- D) movedir
Answer: A) cd

16. What does the `df` command display?


- A) Directory structure
- B) Free disk space
- C) File details
- D) User information
Answer: B) Free disk space

17. Which option can you use with `df` to show the output in human-readable format?
- A) -h
- B) -r
- C) -v
- D) -f
Answer: A) -h

18. What is your home directory typically represented by?


- A) /
- B) ~
- C) ..
- D) .
Answer: B) ~

19. What command will show your current working directory?


- A) pwd
- B) where
- C) currentdir
- D) dir
Answer: A) pwd

20. What is a subdirectory?


- A) A directory at the same level as another
- B) A directory contained within another directory
- C) A temporary directory
- D) A directory that cannot contain files
Answer: B) A directory contained within another directory

21. Which command lists all subdirectories in the current directory?


- A) ls -d */
- B) ls -R
- C) subdirs
- D) find . -type d
Answer: A) ls -d */

22. How do you specify a file in the current directory?


- A) ./filename
- B) /filename
- C) filename/
- D) ~filename
Answer: A) ./filename

23. What is the command to copy a file to a different directory?


- A) cp
- B) move
- C) copy
- D) transfer
Answer: A) cp

24. Which command changes the permissions of a file?


- A) chmod
- B) chown
- C) perm
- D) access
Answer: A) chmod

25. What does the `chmod 755 filename` command do?


- A) Grants all permissions to owner, read/execute to others
- B) Grants read/write permissions to everyone
- C) Removes all permissions
- D) Grants execute permission only
Answer: A) Grants all permissions to owner, read/execute to others

26. Which command opens the `vi` text editor?


- A) vi filename
- B) edit filename
- C) nano filename
- D) open filename
Answer: A) vi filename
27. What is the command to save changes in `vi`?
- A) :save
- B) :w
- C) :write
- D) :savechanges
Answer: B) :w
28. Which command can redirect output to a file?
- A) >
- B) >>
- C) 2>
- D) All of the above
Answer: D) All of the above

29. What does the `>>` operator do when redirecting output?


- A) Overwrites the file
- B) Appends to the file
- C) Creates a new file
- D) Displays the output on screen
Answer: B) Appends to the file

30. What is a log file?


- A) A file that stores system settings
- B) A file that records events or actions
- C) A file used for temporary storage
- D) A backup file
Answer: B) A file that records events or actions

31. How can you log the output of a command to a file?


- A) command > logfile.txt
- B) command >> logfile.txt
- C) Both A and B
- D) log command to logfile.txt
Answer: C) Both A and B

32. What command is used to compare two files?


- A) diff
- B) compare
- C) check
- D) match
Answer: A) diff

33. What is the output of the `diff` command?


- A) Shows differences between files
- B) Merges files
- C) Copies files
- D) Deletes files
Answer: A) Shows differences between files

34. Which command searches for a string in a file?


- A) grep
- B) find
- C) search
- D) locate
Answer: A) grep

35. How do you search for the word "error" in `logfile.txt` using `grep`?
- A) grep "error" logfile.txt
- B) search "error" logfile.txt
- C) find "error" logfile.txt
- D) locate "error" logfile.txt
Answer: A) grep "error" logfile.txt

36. What command lists all currently logged-in users?


- A) who
- B) users
- C) list
- D) whoami
Answer: A) who

37. What does the `ps` command display?


- A) Running processes
- B) Disk space
- C) User information
- D) File permissions
Answer: A) Running processes
38. Which command deletes a directory?
- A) rm dir
- B) rmdir
- C) deldir
- D) erase dir
Answer: B) rmdir

39. What does `cd ..` do?


- A) Moves to the home directory
- B) Moves to the parent directory
- C) Changes to the root directory
- D) Lists files in the current directory
Answer: B) Moves to the parent directory

40. What does the `chown` command do?


- A) Changes file ownership
- B) Changes file permissions
- C) Deletes files
- D) Renames files
Answer: A) Changes file ownership

41. What is the purpose of the sticky bit?


- A) Protects files from deletion by non-owners
- B) Grants all permissions to everyone
- C) Changes ownership of files
- D) Encrypts files
Answer: A) Protects files from deletion by non-owners

42. What type of file is indicated by a `-` at the beginning of the permissions string?
- A) Directory
- B) Regular file
- C) Symbolic link
- D) Special file
Answer: B) Regular file

43. What does a `d` at the beginning of the permissions string indicate?
- A) Directory
- B) Regular file
- C) Special file
- D) Symbolic link
Answer: A) Directory

44. What command removes a file?


- A) del
- B) remove
- C) rm
- D) erase
Answer: C) rm

45. Which option with `rm` will prompt for confirmation before deleting?
- A) -i
- B) -f
- C) -r
- D) -v
Answer: A) -i

46. What command is used to search for files in a directory hierarchy?


- A) search
- B) find
- C) locate
- D) grep
Answer: B) find

47. What command provides information about disk usage?


- A) du
- B) df
- C) disk
- D) usage
Answer: A) du

48. Which command prints the current user's environment variables?


- A) env
- B) set
- C) printenv
- D) All of the above
Answer: D) All of the above
49. What is the purpose of the `PATH` environment variable?
- A) Specifies where to find executable files
- B) Defines user permissions
- C) Sets the default file directory
- D) Stores log files
Answer: A) Specifies where to find executable files

50. What is a shell script?


- A) A program that runs in the shell
- B) A file containing shell commands
- C) Both A and B
- D) A file containing data
Answer: C) Both A and B

51. Which command is used to make a shell script executable?


- A) chmod +x script.sh
- B) run script.sh
- C) execute script.sh
- D) compile script.sh
Answer: A) chmod +x script.sh

52. Which command displays the system date and time?


- A) date
- B) time
- C) datetime
- D) current
Answer: A) date

53. What does the `top` command do?


- A) Displays system uptime
- B) Shows system processes and resource usage
- C) Displays disk usage
- D) Lists users
Answer: B) Shows system processes and resource usage

54. Which command displays network configuration details?


- A) ifconfig
- B) netstat
- C) ping
- D) traceroute
Answer: A) ifconfig

55. What does the `ping` command do?


- A) Tests network connectivity
- B) Displays network connections
- C) Configures network interfaces
- D) None of the above
Answer: A) Tests network connectivity

56. Which command is used to terminate a process by its PID?


- A) kill
- B) stop
- C) terminate
- D) end
Answer: A) kill

57. What does the `bg` command do?


- A) Brings a background job to the foreground
- B) Runs a job in the background
- C) Displays background processes
- D) Stops a job
Answer: B) Runs a job in the background

58. Which command compresses files using gzip?


- A) zip
- B) gzip
- C) compress
- D) pack
Answer: B) gzip

59. What is the command to extract files from a tarball?


- A) tar -xvf
- B) unzip
- C) extract
- D) untar
Answer: A) tar -xvf

60. What is the purpose of the `passwd` command?


- A) Changes the user password
- B) Displays user permissions
- C) Logs out a user
- D) Shows password strength
Answer: A) Changes the user password

61. Which command shows the last logins of users?


- A) last
- B) log
- C) who
- D) history
Answer: A) last

62. What does the `*` wildcard represent in a file path?


- A) Any single character
- B) Zero or more characters
- C) A specific character
- D) None of the above
Answer: B) Zero or more characters

63. What does the `?` wildcard represent?


- A) Any single character
- B) Multiple characters
- C) No characters
- D) None of the above
Answer: A) Any single character

64. Which command is used to create a compressed backup of files?


- A) zip
- B) backup
- C) cp
- D) tar
Answer: D) tar
65. What is the purpose of the `rsync` command?
- A) Sync files and directories between locations
- B) Create backups
- C) Compare files
- D) Compress files
Answer: A) Sync files and directories between locations

66. What is a symbolic link?


- A) A direct copy of a file
- B) A reference to another file
- C) A compressed file
- D) A temporary file
Answer: B) A reference to another file

67. Which file type is indicated by `.sh`?


- A) Text file
- B) Shell script
- C) Executable file
- D) Configuration file
Answer: B) Shell script

68. What is a mounted file system?


- A) A system with no files
- B) A file system that is currently accessible
- C) A network file system
- D) A read-only file system
Answer: B) A file system that is currently accessible

69. What command is used to mount a file system?


- A) mount
- B) fsck
- C) bind
- D) link
Answer: A) mount

70. What does the `free` command display?


- A) Memory usage
- B) CPU load
- C) Disk usage
- D) Network statistics
Answer: A) Memory usage

71. Which command checks the integrity of a file system?


- A) fsck
- B) check
- C) verify
- D) validate
Answer: A) fsck

72. Which command is used to schedule a job to run periodically?


- A) at
- B) cron
- C) schedule
- D) batch
Answer: B) cron

73. What does the `at` command do?


- A) Schedules jobs for a specific time
- B) Lists running jobs
- C) Terminates jobs
- D) Displays system time
Answer: A) Schedules jobs for a specific time

74. Which command connects to a remote server via SSH?


- A) ssh user@hostname
- B) connect user@hostname
- C) remote user@hostname
- D) login user@hostname
Answer: A) ssh user@hostname

75. What does FTP stand for?


- A) File Transfer Protocol
- B) File Transmission Protocol
- C) Fast Transfer Protocol
- D) File Transfer Process
Answer: A) File Transfer Protocol

76. Which command is used to display the contents of a file?


- A) cat
- B) show
- C) display
- D) read
Answer: A) cat

77. What is the command to view a file page by page?


- A) less
- B) more
- C) view
- D) All of the above
Answer: D) All of the above

78. What does the `r` permission stand for?


- A) Read
- B) Write
- C) Execute
- D) None of the above
Answer: A) Read

79. Which permission is needed to execute a file?


- A) Read
- B) Write
- C) Execute
- D) All of the above
Answer: C) Execute

80. What is the Unix philosophy?


- A) Write programs to handle text streams
- B) Create complex programs
- C) Minimize command-line usage
- D) Avoid scripting
Answer: A) Write programs to handle text streams
81. What is a pipeline in Unix?
- A) A sequence of commands connected by pipes
- B) A method to compress files
- C) A way to copy files
- D) A type of directory
Answer: A) A sequence of commands connected by pipes

82. Which operator connects the output of one command to the input of another?
- A) >
- B) <
- C) |
- D) ;
Answer: C) |

83. What does the `info` command display?


- A) Information about files
- B) User instructions
- C) Documentation for commands
- D) System settings
Answer: C) Documentation for commands

84. What is the purpose of comments in shell scripts?


- A) To improve performance
- B) To explain the code
- C) To prevent code execution
- D) Both B and C
Answer: D) Both B and C

85. Which command is used to add a new user?


- A) useradd
- B) adduser
- C) newuser
- D) Both A and B
Answer: D) Both A and B

86. What command removes a user?


- A) userdel
- B) removeuser
- C) deluser
- D) Both A and C
Answer: D) Both A and C

87. What does the `chgrp` command do?


- A) Changes the group ownership of a file
- B) Changes file permissions
- C) Removes group access
- D) None of the above
Answer: A) Changes the group ownership of a file

88. Which file typically contains user environment variables?


- A) /etc/profile
- B) ~/.bashrc
- C) /etc/bash.bashrc
- D) All of the above
Answer: D) All of the above

89. What symbol is used to reference a variable in a shell script?


- A) &
- B) $
- C) #
- D) @
Answer: B) $

90. What is the syntax to define a function in a shell script?


- A) function name() { commands }
- B) name() { commands }
- C) Both A and B
- D) func name() { commands }
Answer: C) Both A and B

91. Which command finds files by name?


- A) locate
- B) find
- C) search
- D) All of the above
Answer: D) All of the above

92. Where are system logs typically stored?


- A) /var/log/
- B) /etc/
- C) /usr/bin/
- D) /home/
Answer: A) /var/log/

93. Which command displays hardware information?


- A) lscpu
- B) lsusb
- C) lspci
- D) All of the above
Answer: D) All of the above

94. What does the `uname` command display?


- A) Kernel version
- B) System architecture
- C) Both A and B
- D) None of the above
Answer: C) Both A and B

95. What command is used to install packages in Debian-based systems?


- A) yum
- B) apt-get
- C) dnf
- D) rpm
Answer: B) apt-get

96. What command shows system uptime?


- A) uptime
- B) time
- C) sysinfo
- D) status
Answer: A) uptime

97. What does the `vmstat` command do?


- A) Displays virtual memory statistics
- B) Monitors system processes
- C) Shows CPU usage
- D) Displays network statistics
Answer: A) Displays virtual memory statistics

98. Which command shows command history?


- A) history
- B) list
- C) commands
- D) prev
Answer: A) history

99. What command shuts down the system immediately?


- A) shutdown now
- B) halt
- C) poweroff
- D) All of the above
Answer: D) All of the above

100. What is the purpose of the `/etc` directory?


- A) Stores user files
- B) Contains system configuration files
- C) Holds executable binaries
- D) Contains temporary files
Answer: B) Contains system configuration files

You might also like