unix banner

Unix Multiple Choice Questions (MCQs) and Answers

Master Unix with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Unix concepts. Begin your placement preparation journey now!

Q61

Q61 Which command shows a dynamic view of running processes in real-time?

A

ps

B

top

C

kill

D

chmod

Q62

Q62 How would you display the PID of a process by name, such as "bash"?

A

ps bash

B

pid bash

C

ps -C bash

D

find bash

Q63

Q63 How would you change the priority of a process with PID 1234 to a higher priority using nice?

A

nice -n 10 -p 1234

B

nice -n -5 1234

C

renice -5 1234

D

nice 1234

Q64

Q64 Which command sends a "SIGTERM" signal to terminate a process with PID 5678?

A

kill -15 5678

B

end 5678

C

stop -15 5678

D

terminate 5678

Q65

Q65 A process is not responding to a kill command. What alternative command can forcefully terminate it?

A

stop

B

kill -1

C

kill -9

D

end

Q66

Q66 A script is creating too many child processes and slowing the system. What command could help limit CPU usage?

A

nice

B

stop

C

ps

D

end

Q67

Q67 A terminated process continues to appear in the process list. What is likely the cause?

A

It is a zombie process

B

It was restarted

C

It has no PID

D

It is running in the background

Q68

Q68 Which command is used to display the IP address of a Unix machine?

A

ping

B

netstat

C

ifconfig

D

hostname

Q69

Q69 What is the purpose of the ping command in Unix networking?

A

To display IP address

B

To test network connectivity

C

To view routing table

D

To change MAC address

Q70

Q70 Which command lists all open ports and active connections in Unix?

A

ping

B

netstat

C

traceroute

D

telnet

Q71

Q71 What does the traceroute command do in Unix?

A

Traces packet route to destination

B

Lists all network interfaces

C

Tests network speed

D

Monitors file transfers

Q72

Q72 Which command is used to capture and analyze network packets in Unix?

A

ping

B

traceroute

C

tcpdump

D

netstat

Q73

Q73 How would you use the ping command to check connectivity with a server at IP 192.168.1.1?

A

ping 192.168.1.1

B

check 192.168.1.1

C

netstat 192.168.1.1

D

trace 192.168.1.1

Q74

Q74 How would you display only the active internet connections using netstat?

A

netstat -a

B

netstat -r

C

netstat -i

D

netstat -at

Q75

Q75 Which command would you use to transfer files over a network using SSH in Unix?

A

scp

B

ftp

C

rsync

D

curl

Q76

Q76 A network connection fails with a "Host unreachable" message. What is a likely cause?

A

Incorrect port

B

Incorrect IP

C

Network is down

D

File not found

Q77

Q77 A user cannot connect to a remote server despite correct credentials. Which command can verify connectivity?

A

telnet

B

ssh

C

ping

D

scp

Q78

Q78 A user can ping a server but cannot access it via ssh. What could be a likely reason?

A

SSH disabled on server

B

Incorrect password

C

Invalid IP

D

Full disk

Q79

Q79 Which command is used to search for a specific pattern in a file in Unix?

A

sed

B

awk

C

grep

D

cat

Q80

Q80 What does the sed command primarily do in Unix?

A

Modifies file permissions

B

Searches for files

C

Streams and edits text

D

Displays process information

Q81

Q81 Which tool is commonly used for field-based text processing in Unix?

A

grep

B

sed

C

awk

D

ps

Q82

Q82 What is the purpose of using regular expressions with grep?

A

To enhance search flexibility

B

To improve execution speed

C

To manage files

D

To edit text files

Q83

Q83 How do you use grep to find lines containing "error" in a file named log.txt?

A

find error log.txt

B

search error log.txt

C

grep "error" log.txt

D

error log.txt

Q84

Q84 How would you replace all occurrences of "foo" with "bar" in a file using sed?

A

sed "foo/bar" file

B

sed 's/foo/bar/g' file

C

grep "foo" "bar" file

D

awk "foo=bar" file

Q85

Q85 Which awk command prints only the first column of each line in a file named data.txt?

A

awk '{print $1}' data.txt

B

awk print1 data.txt

C

awk $1 data.txt

D

awk print1 data

Q86

Q86 How would you count the occurrences of the word "failed" in a file using grep and wc?

A

grep "failed" file | wc -l

B

grep -c "failed" file

C

grep "failed" file wc -l

D

count "failed" file

Q87

Q87 A grep search returns no results, but you know the pattern exists. What could be the cause?

A

Incorrect syntax

B

Case sensitivity

C

File is empty

D

File permissions issue

Q88

Q88 The sed command fails with "no such file or directory." What could be the issue?

A

Incorrect sed syntax

B

Missing input file

C

Pattern syntax error

D

Permission denied

Q89

Q89 awk script produces syntax errors. What is a likely cause?

A

Improper permissions

B

File not executable

C

Improper field reference

D

Missing awk interpreter

Q90

Q90 Which command opens a file in the vi editor in Unix?

A

open

B

nano

C

edit

D

vi

ad verticalad vertical
ad