Shells, Scripting and Data Management Flashcards
To pass part 2 exam
What is true regarding the statement beginning with #! that is found in the first line of a script?
A. It prevents the script from being executed until the ! is removed.
B. It specifies the path and the arguments of the interpreter used to run the script.
C. It is a comment that is ignored by the script.
D. It specifies the character encoding of the script.
It specifies the path and the arguments of the interpreter used to run the script.
Which Bash option prevents a user from accidentally overwriting a file with a “>”?
A. set -o safe B. set -o noglob C. set -o noclobber D. set -o append E. set -o nooverwrite
set -o noclobber
Which of the following commands prints the exit value of the most recently executed program in Bash? A. echo $? B. echo $# C. echo $exit D. echo $status E. echo $&
echo $?
What word will complete an if statement in bash such as the following: if [ -x “$file” ]; then echo
$file _____
(Please provide the missing word only)
fi
What word is missing from the following SQL statement? update tablename ____
fieldname=’value’ where id=909;
(Please specify the missing word using lower_case letters only.)
set
Which of the following SQL statements will select the fields name and address from the contacts table? A. SELECT (name, address) FROM contacts; B. SELECT (name address) FROM contacts; C. SELECT name, address FROM contacts; D. SELECT name address FROM contacts;
SELECT name, address FROM contacts;
Which of the following configuration files should be modified to globally set shell variables for all users? A. /etc/bashrc B. /etc/profile C. ~/.bash_profile D. /etc/.bashrc
/etc/profile
Which of the following commands are used to manage the environment and shell variables within
a shell process? (Choose TWO correct answers.)
A. export B. init C. reset D. set E. tset
export
set
Which of the following are operators used for comparisons by the test command? (Choose TWO correct answers.) A. equals B. = C. -is D. -eq E. null
=
-eq
Which of the following commands creates a function in Bash that outputs the sum of two numbers?
A. function sumitup { echo $(($1 + $2)) ; }
B. command sumitup { echo $(($1 + $2)) ; }
C. function sumitup { echo $1 + $2 ; }
D. method sumitup { echo $1 + $2 ; }
E. command sumitup { echo $1 + $2 ; }
function sumitup { echo $(($1 + $2)) ; }
What output will the following command sequence produce?
echo ‘1 2 3 4 5 6’ | while read a b c; do echo result: $c $b $a; done
A. result: 3 4 5 6 2 1 B. result: 1 2 3 4 5 6 C. result: 6 5 4 D. result: 6 5 4 3 2 1 E. result: 3 2 1
result: 3 4 5 6 2 1
When the command echo $? outputs 1, which of the following statements are true?
A. It is the process ID of the echo command.
B. It is the process ID of the current shell.
C. It is the exit value of the command executed immediately before echo.
D. It is the exit value of the echo command.
It is the exit value of the command executed immediately before echo.
What word is missing from the following SQL statement? insert into tablename ________(909,
‘text’);
(Please specify the missing word using lower-case letters only.)
VALUES, values
Which command makes the shell variable named VARIABLE visible to subshells? A. export $VARIABLE B. export VARIABLE C. set $VARIABLE D. set VARIABLE E. env VARIABLE
export VARIABLE
What output will the command seq 10 produce?
A. A continuous stream of numbers increasing in increments of 10 until stopped.
B. The numbers 1 through 10 with one number per line.
C. The numbers 0 through 9 with one number per line.
D. The number 10 to standard output.
The numbers 1 through 10 with one number per line.