Linux Final Exam Questions

Choose the best answer – Which of the following best describes what will occur in vi by entering the following command (while in command mode) :wq?

a. The file will be saved.
b. The program will exit.
c. The file will be saved and the program will exit.
d. The file will be saved.

c. The file will be saved and the program will exit.

Choose the best answer – Which key can be pressed in command mode of vi to undo the last change?

a. d
b. u
c. i
d. a

b. u

True / False – With Emacs, yanking text means to copy it to the kill buffer, so that it may be pasted later.
True

True/ False – Line wrapping in Nano happens automatically by default.
False

Choose all that apply – Which of the following statements about Emacs are true?

a. It is highly extensible
b. Modal design
c. Guaranteed to be on every installation of Unix or Linux
d. Can run on almost any platform

a. It is highly extensible
b. Can run on almost any platform

Choose the best answer – Which one of the following environment variables contains the default login shell?

a. $TERM
b. $SHELL
c. $LOGIN
d. $ENV

b. $SHELL

Choose the best answer – Which one of the following Bourne-Again Shell (bash) variables defines the maximum number of lines to store in the ~/.bash_history file?

a. $HISTFILESIZE
b. $HISTSIZE
c. $HISTCONTROL
d. $HISTIGNORE

a. $HISTFILESIZE

True / False – The Bourne-Again Shell (bash) is not completely backwards compatible with the Bourne Shell (sh).
False

Choose the best answer – Which of the following bash commands executes the previous command?

a. ??
b. !
c. !!
d. ?

c. !!

Choose the best answer – Which one of the following lines could a user add to ~/.bashrc to force the rm command to always be interactive?

a. eval rm=”rm -i”
b. echo rm=”rm -i”
c. source rm=”rm -i”
d. alias rm=”rm -i”

d. alias rm=”rm -i”

True / False – On the first line of a script, the magic number #! must always reference /bin/sh as the interpreter.
False

Choose the best answer – Which of the following Bash commands prints text to STDOUT?

a. print
b. put
c. echo
d. post

c. echo

Choose the best answer – In bash scripting, what represents a logical OR?

a. &&
b. !!
c. ||
d. ;;

c. | |

Choose the best answer – Which of the following best describes the following Bash script?
while true; do
echo “Jake is a cylon”
sleep 5
done

a. Every five seconds, the echo command will print “Jake is a cylon” to the screen.
b. After the echocommand prints “Jake is a cylon” to the screen five times, the script will exit
c. The echo command will print “Jake is a cylon” to the screen five times every second
d. Since the while loop is always true, the code inside the loop will never be executed, so the script will just exit

a. Every five seconds, the echo command will print “Jake is a cylong” to the screen.

True / False – In a BASH shell script, an if conditional statement can contain multiple conditions.
True

True / False – Executing a program will start one or more processes.
True

True / False – If a child process is not properly reaped by a parent process, the child process is in a zombie state.
True

Choose the best answer – What state is a process currently in if it is still loaded in memory, but not running?

a. Sleeping
b. Zombie
c. Stopped
d. Running

b. Zombie

Choose the best answer – What state is a process currently in if it is waiting for some event?

a. Sleeping
b. Zombie
c. Running
d. Stopped

a. Sleeping

Choose all that apply – Which of the following commands can be used to send signals to process by PID?

a. kill
b. killall
c. pkill
d. kill-by-pid

a. kill
c. pkill