wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Linux Command Multiple Choice Question 2

Total questions: 39

Worksheet time: 20mins

Name
Class
Date
1.

Which command displays all file names only and no additional information?

a)

ls -a

b)

ls -lh

c)

ls -l

d)

ls -alh

e)

ls -nl

2.

Which of the following commands creates the ZIP archive poems.zip containing all files in the current directory whose names end in .txt?

a)

zip *.txt > poems.zip

b)

zcat *.txt poems.zip

c)

zip poems.zip *.txt

d)

zip -cfz poems.zip *.txt

e)

cat *.txt | zip poems.zip

3.

Which of the following commands puts the lines of the file data.csv into alphabetical order?

a)

a..z data.csv

b)

sort data.csv

c)

abc data.csv

d)

wc -s data.csv

e)

grep --sort data.csv

4.

What is true about the su command?

a)

It is the default shell of the root account.

b)

It can only be used by the user root.

c)

It runs a shell or command as another user.

d)

It changes the name of the main administrator account.

e)

It locks the root account in specific time frames.

5.

Which of the following tasks can the command passwd accomplish?

a)

Change a user's username.

b)

Change a user's password.

c)

Create a new user account.

d)

Create a new user group.

e)

Lock a user account.

6.

Which of the following commands sets the variable USERNAME to the value bob?

a)

set USERNAME bob

b)

$USERNAME==bob

c)

var USERNAME=bob

d)

USERNAME<=bob

e)

USERNAME=bob

7.

Which of the following commands output the content of the file Texts 2.txt? (Choose two.)

a)

cat 'Texts 2.txt'

b)

cat -- Texts 2.txt

c)

cat |Texts 2.txt|

d)

cat 'Texts\ 2.txt'

e)

cat Texts\ 2.txt

8.

Which of the following directories must be mounted with read and write access if it resides on its own dedicated file system?

a)

/opt

b)

/lib

c)

/etc

d)

/var

e)

/usr

9.

The ownership of the file doku.odt should be changed. The new owner is named ted. Which command accomplishes this change?

a)

chmod u=ted doku.odt

b)

newuser doku.odt ted

c)

chown ted doku.odt

d)

transfer ted: doku.odt

e)

passwd doku.odt:ted

10.

What are the differences between hard disk drives and solid state disks?

a)

Hard disks have a motor and moving parts, solid state disks do not.

b)

Hard disks can fail due to physical damage, while solid state disks cannot fail.

c)

Solid state disks can store many times as much data as hard disk drives.

d)

/dev/sda is a hard disk device while /dev/ssda is a solid state disk.

e)

Solid state disks provide faster access to stored data than hard disks.

11.

Which of the following types of bus can connect hard disk drives with the motherboard?

a)

The RAM bus

b)

The NUMA bus

c)

The CPU bus

d)

The SATA bus

e)

The Auto bus

12.

What information can be displayed by top?

a)

Existing files, ordered by their size.

b)

Running processes, ordered by CPU or RAM consumption.

c)

User accounts, ordered by the number of logins.

d)

User groups, ordered by the number of members.

e)

User accounts, ordered by the number of files.

13.

Members of a team already have experience using Red Hat Enterprise Linux. For a small hobby project, the team wants to set up a Linux server without paying for a subscription. Which of the following Linux distributions allows the team members to apply as much of their Red Hat Enterprise Linux knowledge as possible?

a)

Ubuntu Linux LTS

b)

Raspbian

c)

Debian GNU/Linux

d)

CentOS

e)

openSUSE

14.

Which of the following commands can be used to resolve a DNS name to an IP address?

a)

dnsname

b)

dns

c)

query

d)

host

e)

iplookup

15.

What is true about the dmesg command?

a)

A. It traces the execution of a command and shows each step the program carries out.

b)

B. It sends messages to the command lines of all current user sessions.

c)

C. It displays the content of the Linux kernel's ring buffer.

d)

D. It immediately outputs all new messages written to the system journal.

e)

E. It might not display older information because it was overwritten by newer information.

16.

What is the UID of the user root?

a)

A. 1

b)

B. -1

c)

C. 255

d)

D. 65536

e)

E. 0

17.

Which of the following outputs could stem from the command last?

a)

1 ls 2 cat text.txt 3 logout

b)

Password for user last changed at Sat Mar 31 16:38:57 EST 2018

c)

Last login: Fri Mar 23 10:56:39 2018 from server.example.com

d)

EXT4-fs (dm-7): mounted filesystem with ordered data mode. Opts: (null)

e)

root tty2 Wed May 17 21:11 - 21:11 (00:00)

18.

Which permissions are set on a regular file once the permissions have been modified with the command chmod 654 file.txt?

a)

drw-r-xr--

b)

-r-xrw-r-x

c)

lrw-r---wx

d)

-rwxr--r-w

e)

-rw-r-xr--

19.

What is true about the owner of a file?

a)

Each file is owned by exactly one user and one group.

b)

The owner of a file always has full permissions when accessing the file.

c)

The user owning a file must be a member of the file's group.

d)

When a user is deleted, all files owned by the user disappear.

e)

The owner of a file cannot be changed once it is assigned to an owner.

20.

What information is stored in /etc/passwd?

a)

The user's storage space limit

b)

The numerical user ID

c)

The username

d)

The encrypted password

e)

The user's default shell

21.

Which of the following permissions are set on the /tmp/ directory?

a)

A. rwxrwxrwt

b)

B. -------rwX

c)

C. rwSrw-rw-

d)

D. rwxrws---

e)

E. r-xr-X--t

22.

Which of the following tar options handle compression?

a)

-bz

b)

-z

c)

-g

d)

-J

e)

-z2

23.

What keyword is used in a shell script to begin a loop? (Specify one keyword only, without any additional information.)

a)

for

b)

loop

c)

begin

d)

start

24.

The current directory contains the following file: -rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh Given that the file is a valid shell script, how can this script be executed?

a)

run test.sh

b)

${test.sh}

c)

cmd ./test.sh

d)

./test.sh

e)

bash test.sh

25.

Which of the following keys can be pressed to exit less?

a)

l

b)

x

c)

e

d)

q

e)

!

26.

Which of the following commands sorts the output of the command export-logs?

a)

export-logs < sort

b)

export-logs > sort

c)

export-logs & sort

d)

export-logs | sort

e)

export-logs <> sort

27.

Which of the following commands will search for the file foo.txt under the directory /home?

a)

search /home -file foo.txt

b)

search /home foo. txt

c)

find /home file foo.txt

d)

find /home -name foo.txt

e)

find /home foo.txt

28.

What is a Linux distribution?

a)

The Linux file system as seen from the root account after mounting all file systems.

b)

A bundling of the Linux kernel, system utilities and other software.

c)

The set of rules which governs the distribution of Linux kernel source code.

d)

An operating system based on Linux but incompatible to the regular Linux kernel.

e)

A set of changes to Linux which enable Linux to run on another processor architecture.

29.

The current directory contains the following file: -rw-r--r-- 1 root exec 24551 Apr 2 12:36 test.sh The file contains a valid shell script, but executing this file using ./test.sh leads to this error: bash: ./test.sh: Permission denied What should be done in order to successfully execute the script?

a)

The file's extension should be changed from .sh to .bin.

b)

The execute bit should be set in the file's permissions.

c)

The user executing the script should be added to the exec group.

d)

The SetUID bit should be set in the file's permissions

e)

The script should be run using #!./test. sh instead of ./test.sh.

30.

Where is the operating system of a Raspberry Pi stored?

a)

On the master device attached to the Raspberry Pi's IDE bus.

b)

On a read only partition on the Raspberry Pi's firmware, next to the BIOS.

c)

On a removable SD card which is put into the Raspberry Pi.

d)

On a Linux extension module connected to the Raspberry Pi's GPIO pins.

e)

On rewritable flash storage which is built into the Raspberry Pi.

31.

Which of the following programs is a graphical editor for vector graphics?

a)

Python

b)

NGINX

c)

Samba

d)

Inkscape

32.

Why are web browser cookies considered dangerous?

a)

Cookies support identification and tracking of users

b)

Cookies are always public and accessible to anyone on the internet.

c)

Cookies consume significant amounts of storage and can exhaust disk space.

d)

Cookies store critical data which is lost when a cookie is deleted.

33.

Which of the following are typical services offered by public cloud providers? (Choose three.)

a)

Platform as a Service(PaaS)

b)

Infrastructure as a Service(IaaS)

c)

Graphics as a Service (GaaS)

d)

Software as a Service (SaaS)

e)

Internet as a Service(IaaS)

34.

Which of the following characters in a shell prompt indicates the shell is running with root privileges?

a)

!

b)

#

c)

*

d)

&

e)

$

35.

Which of the following commands are used to get information on the proper use of ls? (Choose two.)

a)

option ls

b)

usage ls

c)

manual ls

d)

man ls

e)

info ls

36.

What is true about a recursive directory listing?

a)

It includes the content of sub-directories.

b)

It includes the permissions of the directory listed

c)

It includes details of file system internals, such as inodes.

d)

It includes ownership information for the files.

e)

It includes a preview of content for each file in the directory.

37.

Which of the following directories contains information, documentation and example configuration files for installed software packages?

a)

/usr/share/doc/

b)

/etc/defaults/

c)

/var/info/

d)

/doc/

e)

/usr/examples/

38.

Which of the following devices represents a hard disk partition?

a)

/dev/ttyS0

b)

/dev/sata0

c)

/dev/part0

d)

/dev/sda2

e)

/dev/sda/p2

39.

Which of the following examples shows the general structure of a for loop in a shell script?

a)

for *.txt as file => echo $file

b)

for *.txt ( echo $i )

c)

for file in *.txt do echo $i done

d)

for ls *.txt exec {} \;

e)

foreach @{file} { echo $i }