Name: 
 

CEN2514 Final Exam Study Guide



True/False
Indicate whether the statement is true or false.
 

 1. 

When naming script files, it is a good idea to add an .sh extension to the filename.
 

 2. 

The Bourne shell comes with built-in support for arithmetic operations.
 

 3. 

Shell functions are normally defined at the end of a script.
 

 4. 

The cut command default delimiter to separate fields from each other is a tab.
 

 5. 

You can use the test command to test whether a file exists.
 

 6. 

Most applications (and the Linux kernel) are written in the C or C++ programming language.
 

 7. 

In most cases programs use more than one source code file.
 

 8. 

Makefiles are generated by the configure script and cannot be created manually.
 

 9. 

Many tasks on a system are performed by more than one application.
 

 10. 

The C programing language does not require that every function used in a program has to be declared.
 

 11. 

Changes to the kernel parameters need to be tested very carefully.
 

 12. 

A process that is started on a system always requires CPU time.
 

 13. 

Accessing the hard disk is much slower than accessing physical memory.
 

 14. 

Usually, it’s not necessary to run an X-Server on a server system.
 

 15. 

DMA cannot be enabled for CD/DVD drives.
 

 16. 

A device can have more than one interface.
 

 17. 

In a virtual file system, there is a physical device that holds the information.
 

 18. 

Before you can use a hardware device, you need to load the appropriate driver module and set up the corresponding interface.
 

 19. 

The filename for a PCI network adapter consists of six elements separated by hyphens.
 

 20. 

The hwup command is usually called by hotplug agents and it cannot be used manually.
 

Multiple Choice
Identify the choice that best completes the statement or answers the question.
 

 21. 

The ____ shell is the default shell in SLES 9.
a.
Bash
c.
rsh
b.
Ssh
d.
Lsh
 

 22. 

You can run the script from another shell with a command such as the following: ____.
a.
chmod +x script.sh
c.
sh script.sh
b.
chmod script.sh
d.
rsync script.sh
 

 23. 

A comment is introduced with a(n) ____ character in shell scripts.
a.
!
c.
*
b.
#
d.
/
 

 24. 

One way to create scripts that read user input is to use the command ____.
a.
echo
c.
cut
b.
cat
d.
read
 

 25. 

In Bash, you can use the ____ command to perform an arithmetic expression.
a.
cut
c.
test
b.
let
d.
cat
 

 26. 

With the expr command, only the following five operators are available: + , - , * , / , and ____.
a.
^
c.
%
b.
#
d.
&
 

 27. 

In Bash, you can use special ____ operators to assign different values to variables without having to rely on external commands.
a.
command substitution
c.
loop
b.
test
d.
variable substitution
 

 28. 

You can use the ____ command to perform certain actions in your script that depend on a condition.
a.
if
c.
break
b.
continue
d.
&
 

 29. 

The command ____ represents a more compact way of writing the command sequence else if.
a.
while
c.
do
b.
until
d.
elif
 

 30. 

You can create multiple branches with ____.
a.
until
c.
case
b.
while
d.
for
 

 31. 

The purpose of a(n) ____ loop is to process a list of elements.
a.
for
c.
case
b.
continue
d.
if
 

 32. 

The ____ command causes the loop (not the current loop iteration) to be terminated completely if the condition is met.
a.
continue
c.
skip
b.
break
d.
case
 

 33. 

____ act like script modules because they make an entire script section available with a single name.
a.
Shell functions
c.
Shell cases
b.
Shell loops
d.
Shell conditions
 

 34. 

To exit a function, use the command ____.
a.
bye
c.
leave
b.
quit
d.
return
 

 35. 

The shell interprets command-line arguments as command options only if they are prefixed with a(n) ____.
a.
%
c.
-
b.
#
d.
@
 

 36. 

When combined with the here operator (<<), the ____ command is a good choice to output several lines of text from a script.
a.
cut
c.
grep
b.
cat
d.
test
 

 37. 

You can use the ____ command to cut out sections of lines from a file, so only the specified section is printed on standard output.
a.
test
c.
echo
b.
sed
d.
cut
 

 38. 

You can use the ____ command whenever there is a need to obtain a date or time string for further processing by a script.
a.
date
c.
sed
b.
cut
d.
egrep
 

 39. 

The ____ command prints text lines on standard output.
a.
sed
c.
grep
b.
echo
d.
test
 

 40. 

The command ____ and its variant egrep are used to search files for certain patterns.
a.
cut
c.
grep
b.
cat
d.
echo
 

 41. 

The ____ program is a stream editor, an editor used from the command line rather than interactively.
a.
sed
c.
cat
b.
grep
d.
echo
 

 42. 

____ lets you create object-oriented code.
a.
C
c.
Basic
b.
C++
d.
Fortran
 

 43. 

Script files can be directly executed with the help of a(n) ____ program.
a.
compiler
c.
script editor
b.
text editor
d.
interpreter
 

 44. 

Examples of ____ languages are Perl, PHP, and Python.
a.
script
c.
RPM
b.
compiler
d.
kernel
 

 45. 

Examples of ____ languages include C, C++, and Fortran.
a.
script
c.
compiler
b.
RPM
d.
kernel
 

 46. 

Header filenames typically end in ____.
a.
.a
c.
.g
b.
.c
d.
.h
 

 47. 

In a C program, ____ is the function that is initially called when the program is started.
a.
begin
c.
init
b.
main
d.
first
 

 48. 

In a C program, every thing that belongs to a function is included in ____.
a.
[]
c.
#@
b.
()
d.
{}
 

 49. 

In a C program, ____ is a variable type for a single character.
a.
int
c.
char
b.
float
d.
string
 

 50. 

Every declaration and every function call in C must end with a ____.
a.
;
c.
*
b.
.
d.
:
 

 51. 

In a C program, the function ____ is used to read the input of the user.
a.
printf
c.
scanf
b.
showf
d.
readf
 

 52. 

The code of C programs should be saved in a file ending in ____.
a.
.c
c.
.p
b.
.h
d.
.s
 

 53. 

Before the actual compilation process can be started, you must prepare the source code with a(n) ____ script.
a.
make
c.
compile
b.
install
d.
configure
 

 54. 

To run the configure script, you need to use the following command at the top of the source directory: ____.
a.
./make
c.
./makefiles
b.
./configure
d.
./make install
 

 55. 

You use the tool ____ to compile multiple source files in the correct order.
a.
configure
c.
make
b.
compile
d.
install
 

 56. 

Every Makefile consists of targets, ____, and commands for the targets.
a.
static libraries
c.
dynamic libraries
b.
shared libraries
d.
dependencies
 

 57. 

Physically, a ____ library is a file on the hard disk that is loaded into the main memory when an application is started that requires the functionality of the library.
a.
static
c.
dynamic
b.
shared
d.
stand-alone
 

 58. 

The task of finding and loading the required libraries is performed by the program ____.
a.
make
c.
ld
b.
configure
d.
gcc
 

 59. 

Filenames for shared library files end in ____.
a.
.so
c.
.c
b.
.h
d.
.cpp
 

 60. 

Filenames for the header files of a shared library end in ____.
a.
.c
c.
.h
b.
.a
d.
.so
 

 61. 

Some tar archives end in .bz. In this case, the archive is compressed with ____.
a.
bzip
c.
tarzip
b.
gzip
d.
winzip
 

 62. 

A tar archive compressed with bzip needs to be extracted with the options ____.
a.
xzf
c.
zft
b.
xjf
d.
tzg
 

 63. 

One way to measure processor utilization is the ____.
a.
kernel version
c.
system load
b.
ROI
d.
kernel top
 

 64. 

The system load value can be displayed with various monitoring tools such as ____ or uptime.
a.
long
c.
use
b.
top
d.
chk
 

 65. 

____ can be used to display the system load in the last 1, 5, and 15 minutes.
a.
uptime
c.
sysctl
b.
ls
d.
chkcfg
 

 66. 

On multiprocessor systems, ____ can be used to display the utilization of each installed processor.
a.
less
c.
cat
b.
more
d.
mpstat
 

 67. 

The space on the ____ partition is used to free parts of the physical memory by copying temporarily unused memory pages.
a.
swap
c.
kernel
b.
listen
d.
core
 

 68. 

You can view the utilization of the physical and the swap memory with the ____ program.
a.
sysctl
c.
chkcfg
b.
free
d.
ld
 

 69. 

You can use the ____ command to find programs that use a lot of memory.
a.
ps
c.
iostat
b.
sysctl
d.
top
 

 70. 

You can use the command ____ to display the activity of swap memory.
a.
ps
c.
vmstat
b.
chkconfig
d.
rcvm
 

 71. 

You can use the command ____ to display the activity of the disk subsystem.
a.
top
c.
ls
b.
vmstat
d.
ps
 

 72. 

You can use the command ____ to determine the average time a program has to wait for data from the disk.
a.
vmstat
c.
iostat
b.
top
d.
hdparm
 

 73. 

The ____ program analyzes network connections to specific hosts.
a.
Traffic-vis
c.
DNS
b.
NFS
d.
Proxy
 

 74. 

Preventing the X-Server from being started saves memory and CPU utilization. To do so, you can switch to runlevel 3 manually by entering the following: ____.
a.
init 0
c.
init 2
b.
init 1
d.
init 3
 

 75. 

To get an overview of the current service configuration, you can use the ____ command.
a.
top
c.
chkconfig
b.
vmstat
d.
iostat
 

 76. 

____ removes the apache2 service from the init process.
a.
chkconfig apache2 off
c.
vmstat off apache2
b.
top apache2 off
d.
iostat --off -s apache2
 

 77. 

The command in the following example stops a running instance of apache2: ____.
a.
chkconfig apache2 stop
c.
vmstat apache2 off
b.
sysctl apache2 stop
d.
rcapache2 stop
 

 78. 

Every swap partition has an entry in the file ____.
a.
/etc/swap
c.
/swap/partitions
b.
/etc/fstab
d.
/etc/sys/swap
 

 79. 

You can use the tool ____ to tune some settings of IDE hard drives.
a.
hdparm
c.
vmstat
b.
top
d.
iostat
 

 80. 

You can use the following command to check the current status of the DMA configuration: ____.
a.
top -d /dev/hda
c.
vmstat --dma /dev/hda
b.
hdparm -d /dev/hda
d.
iostat -d /dev/hda
 

 81. 

The ____ parameter basically determines when a system starts to swap out data to the disk.
a.
I/O scheduler
c.
swappiness
b.
read-ahead
d.
write-late
 

 82. 

In journaling, every file system transaction is logged in a special area of a partition, called the ____.
a.
swap partition
c.
boot loader
b.
MBR
d.
journal
 

 83. 

You can set kernel network parameters using the ____ command.
a.
top
c.
iostat
b.
sysctl
d.
hdparm
 

 84. 

A(n) ____ is a software component associated with a device.
a.
interface
c.
module
b.
driver
d.
kernel parameter
 

 85. 

Interfaces are usually created by a ____.
a.
module
c.
driver
b.
parameter
d.
device
 

 86. 

The ____ command lists all loaded kernel modules.
a.
modprobe
c.
libmod
b.
rmmod
d.
lsmod
 

 87. 

The ____ command loads kernel modules.
a.
rmmod
c.
lsmod
b.
modprobe
d.
delmod
 

 88. 

The ____ command removes loaded kernel modules.
a.
lsmod
c.
modprobe
b.
insmod
d.
rmmod
 

 89. 

Modules are stored in several subdirectories with a filename extension of ____ for kernel object.
a.
.km
c.
.dm
b.
.ko
d.
.io
 

 90. 

____ represents all devices and interfaces of a Linux system.
a.
sysfs
c.
Kernel module
b.
modprobe
d.
An interface device
 

 91. 

The interfaces of the devices are represented under the directories /sys/class and ____.
a.
/sys/bus
c.
/sys/block
b.
/sys/devices
d.
/sys/local
 

 92. 

Besides the representation in sysfs, there are also the device files in the ____ directory.
a.
/etc
c.
/root
b.
/dev
d.
/usr
 

 93. 

A hotplug event is basically a call of the script ____.
a.
/sbin/hotplug
c.
/dev/sbin/hotplug
b.
/dev/hotplug
d.
/sbin/dev/hotplug
 

 94. 

The hotplug agents are located in the directory ____.
a.
/dev/hotplug/
c.
/etc/hotplug/
b.
/sbin/hotplug/
d.
/sys/hotplug/
 

 95. 

The file ____ contains a list of driver modules that should never be loaded by hotplug.
a.
/dev/hotplug/blacklist
c.
/hotplug/blacklist
b.
/sbin/hotplug/blacklist
d.
/etc/hotplug/blacklist
 

 96. 

hwup reads the device configurations from files in the directory ____.
a.
/dev/sysconfig/hardware/
c.
/etc/sysconfig/hardware/
b.
/sbin/sysconfig/hardware/
d.
/usr/sysconfig/hardware/
 

 97. 

“____” represents the beginning of every PCI network adapter device configuration filename.
a.
bus
c.
pci
b.
hwcfg
d.
PCI bus address
 

 98. 

The ____ part of a PCI network adapter configuration filename determines that the device is identified by the bus to which it is connected.
a.
pci
c.
address
b.
hwcfg
d.
bus
 

 99. 

The ____ part of a PCI network adapter configuration filename indicates that the device is connected to the PCI bus.
a.
pci
c.
address
b.
hwcfg
d.
bus
 

 100. 

You can display the PCI address of a device with the ____ command.
a.
modprobe
c.
lsmod
b.
lspci
d.
insmod
 

 101. 

The device configuration file variable ____ determines when and how a device will be started.
a.
MODULE
c.
SCRIPT
b.
MODULE_OPTIONS
d.
STARTMODE
 

 102. 

The STARTMODE value of ____ indicates that the device should not be started automatically, but it can be started manually.
a.
auto
c.
manual
b.
on
d.
off
 

 103. 

The device configuration file variable ____ determines the name of the kernel module that should be loaded for the device.
a.
MODULE
c.
SCRIPT
b.
MODULE_OPTIONS
d.
STARTMODE
 

 104. 

With the device configuration file variable ____, options can be passed to the kernel module.
a.
MODULE
c.
SCRIPT
b.
MODULE_OPTIONS
d.
STARTMODE
 

Completion
Complete each statement.
 

 105. 

A(n) ____________________ is basically an ASCII text file containing commands to be executed in sequence.
 

 

 106. 

The ____________________ command takes a variable as an argument and stores the read input in the variable.
 

 

 107. 

The term ____________________ basically means that the output of a command is used in a shell command line or a shell script.
 

 

 108. 

Use the ____________________ command to exit from the current iteration of a loop (while, until, for, and select) and resume with the next iteration of the loop.
 

 

 109. 

With the shell built-in command ____________________, you can extract the options supplied to a script on the command line.
 

 

 110. 

Compiler programs need to be converted into a binary format that can be directly executed by the CPU. This conversion is done by a special program called the ____________________.
 

 

 111. 

The line #include <stdio.h> is an example of a(n) _________________________.
 

 

 112. 

In a C program, files that contain function declarations are called ____________________.
 

 

 113. 

The standard C compiler in Linux is the ____________________.
 

 

 114. 

Make is controlled by ____________________.
 

 

 115. 

Memory is controlled by the ____________________ system of the Linux kernel.
 

 

 116. 

____________________ memory is memory that is actually installed in the system in the form of memory bars or chips.
 

 

 117. 

The iostat command is not part of the SLES 9 default installation. You need to install the package ____________________ to use it.
 

 

 118. 

With ______________________________, data from a disk can be written directly to the main memory of a system without CPU utilization.
 

 

 119. 

The Linux kernel contains a component called the ____________________. This scheduler collects requests from the processes and hands them over to the hardware driver that is responsible or the drive.
 

 

 120. 

A(n) ____________________ is a real, physical piece of hardware.
 

 

 121. 

In Linux, a(n) ____________________ is usually a software module that can be loaded into the Linux kernel.
 

 

 122. 

Kernel modules are files that are stored in the directory ______________________________.
 

 

 123. 

____________________ is a virtual file system that is mounted under /sys.
 

 

 124. 

The command ____________________ is used by the hotplug agent to start preconfigured devices.
 

 

Matching
 
 
Match each item with a statement below.
a.
Shell programming language
f.
break command
b.
Shell script
g.
grep searchpattern filename ...
c.
date + %m-%d
h.
test command
d.
case statement
i.
tr command
e.
while loop
 

 125. 

prints lines that contain the given search pattern.
 

 126. 

powerful and complete programing language.
 

 127. 

translates (replaces) or deletes characters.
 

 128. 

file that includes several shell commands.
 

 129. 

terminated when the exit status becomes nonzero.
 

 130. 

returns the current date in the form month-day.
 

 131. 

compares values and checks for files and their properties.
 

 132. 

a way to introduce a new condition within a loop.
 

 133. 

the expression contained in a variable is compared with a number of expressions, and a command is executed for each expression matched.
 
 
Match each item with a statement below.
a.
C++ language
f.
tar xzf xpenguins-2.2.tar.gz
b.
printf(“Please enter your name: ”);
g.
cd xpenguins-2.2/
c.
./configure --help
h.
char name[80];
d.
Colon
i.
return(0); inside a function
e.
#
 

 134. 

a successor of C.
 

 135. 

extracts the content of the specified tar archive.
 

 136. 

declares a variable name. The type of the variable is char.
 

 137. 

separates targets and dependencies in a makefile.
 

 138. 

prints out the message Please enter your name:.
 

 139. 

introduces comments in a makefile.
 

 140. 

returns 0 as the value of the function.
 

 141. 

changes the current directory to xpenguins-2-2/
 

 142. 

list all available configure options.
 
 
Match each item with a statement below.
a.
I/O process
f.
iostat
b.
top
g.
ip command
c.
KDE System Guard
h.
chkconfig apache2 3
d.
free
i.
hdparm -i /dev/hda
e.
vmstat
 

 143. 

displays a sorted list of applications and the three values for the average load values in the last 1, 5, and 15 minutes.
 

 144. 

displays how long I/O requests from applications take.
 

 145. 

displays the current utilization of the physical and swap memory.
 

 146. 

displays the settings of the device hda.
 

 147. 

can be user input or data that is read from or written to the hard disk.
 

 148. 

re-enables the service apache2 in runlevel 3.
 

 149. 

displays a graphical representation of the system load.
 

 150. 

displays the status of an interface as well as transmission errors.
 

 151. 

monitors the activity of swap memory and can also be used to display other system parameters.
 
 
Match each item with a statement below.
a.
driver
f.
hwdown bus-pci-0000:02:08.0
b.
sysfs
g.
The STARTMODE value of auto
c.
/sys/bus and /sys/devices directories
h.
SCRIPT{UP,DOWN}_[type]
d.
file system links
i.
SCRIPT{UP,DOWN}
e.
hwup bus-pci-0000:02:08.0
 

 152. 

contain different representations of system hardware.
 

 153. 

the glue between a device and its interfaces.
 

 154. 

specifies the script to be called for initialization and deconfiguration of a specific device type.
 

 155. 

deconfigures the specified network card.
 

 156. 

starts the specified network card.
 

 157. 

specifies the script to be called for initialization and deconfiguration of the device.
 

 158. 

indicates that the device is automatically started at boot time or by hotplug when the device is connected to the system.
 

 159. 

introduced with kernel version 2.6.
 

 160. 

connect an interface with a device.
 

Short Answer
 

 161. 

Mention some of the reasons why you need to understand and create shell scripts.
 

 162. 

What are the benefits of illustrating a program through a flow chart?
 

 163. 

Use an example to explain how to use command substitution.
 

 164. 

Write various examples of how to use variable substitution operators.
 

 165. 

Describe the basic usage of the if command and the optional else statement.
 

 166. 

Provide an example of how a multiple branch (case) works.
 

 167. 

How can you create loops using the while and until commands?
 

 168. 

Use an example to explain how to use the command getopts.
 

 169. 

Explain how to modify the output format used by date.
 

 170. 

Describe some of the most important command-line options for sed.
 

 171. 

What are the advantages and disadvantages of script and compiler languages?
 

 172. 

Describe the parts of a C program function head.
 

 173. 

How can you compile a simple C program?
 

 174. 

Mention various reasons why you must prepare the source code with a configure script before the actual compilation process can be started.
 

 175. 

Use an example to explain the tasks performed by a makefile.
 

 176. 

How can you install a compiled program using make install?
 

 177. 

Explain how to install the required packages for a build environment.
 

 178. 

Explain the concept of shared libraries.
 

 179. 

What are the parts of a shared library?
 

 180. 

Describe the steps to compile and install the xpenguins program from its source archive.
 

 181. 

Describe some of the questions that can help you to find performance bottlenecks.
 

 182. 

Describe the output produced by the free command.
 

 183. 

Describe the output produced by the iostat command.
 

 184. 

How can you analyze CPU intensive applications?
 

 185. 

Explain how to run a server system without X.
 

 186. 

Why should you keep your software up to date?
 

 187. 

What aspects should you consider before upgrading the CPU?
 

 188. 

What aspects should you consider when upgrading memory?
 

 189. 

Describe some of the most important options for the hdparm command.
 

 190. 

How can you change the read-ahead parameter?
 

 191. 

What are the two basic kinds of device drivers?
 

 192. 

Describe how to load a kernel module with modprobe.
 

 193. 

Describe how device drivers are loaded in SLES 9.
 

 194. 

How is system hardware represented in directories /sys/bus and /sys/devices?
 

 195. 

How can hotplug events be created?
 

 196. 

What are the two types of hotplug agents?
 

 197. 

What is the hotplug process for attaching a USB camera?
 

 198. 

What are the steps to add a new drive to the system?
 

 199. 

What are the steps to replace a graphics card?
 

 200. 

What are the steps to add a new network adapter?
 



 
Check Your Work     Start Over