Shells, Scripting and Data Management Flashcards

To pass part 2 exam

1
Q

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.

A

It specifies the path and the arguments of the interpreter used to run the script.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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
A

set -o noclobber

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
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 $&
A

echo $?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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)

A

fi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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.)

A

set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
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;
A

SELECT name, address FROM contacts;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
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
A

/etc/profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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
A

export

set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
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
A

=

-eq

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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 ; }

A

function sumitup { echo $(($1 + $2)) ; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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
A

result: 3 4 5 6 2 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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.

A

It is the exit value of the command executed immediately before echo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What word is missing from the following SQL statement? insert into tablename ________(909,
‘text’);
(Please specify the missing word using lower-case letters only.)

A

VALUES, values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
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
A

export VARIABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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.

A

The numbers 1 through 10 with one number per line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

By default, the contents of which directory will be copied to a new user’s home directory when the
account is created by passing the -m option to the useradd command? (Specify the full path to the
directory.)

A

/etc/skel, /etc/skel/

17
Q
What word is missing from the following SQL statement?
\_\_\_\_\_\_\_\_\_\_ count(*) from tablename;
(Please specify the missing word using lower-case letters only.)
A

select

18
Q
Which of the following files, when existing, affect the behavior of the Bash shell? (Choose TWO correct answers.)
A. ~/.bashconf
B. ~/.bashrc
C. ~/.bashdefaults
D. ~/.bash_etc
E. ~/.bash_profile
A

~/.bashrc

~/.bash_profile

19
Q
After issuing:
function myfunction { echo $1 $2 ; }
in Bash, which output does:
myfunction A B C
Produce?
A. A B
B. A B C
C. A C
D. B C
E. C B A
A

A B

20
Q
Which of the following commands puts the output of the command date into the shell variable mydate?
A. mydate="$(date)"
B. mydate="exec date"
C. mydate="$((date))"
D. mydate="date"
E. mydate="${date}"
A

mydate=”$(date)”