Linux Exam 2 CH 7

Ace your homework & exams now with Quizwiz!

18. In which of the following files would a system administrator set the default shell used by your account? a. .shell b. /home/shell c. /etc/passwd d. /home

c. /etc/passwd

5. Your company has assigned you to revise 22 scripts. Since you use the vi editor, how can you set it to automatically display lines as numbered so it is easier for you to work on these revisions? a. Create a vi macro that enables you view the lines as numbered when you press n in the command mode. b. Create the .exrc file in your home directory so this file contains the line: set number. c. Type set_lines and press Enter before you start vi. d. Press # while you are in the ex mode in vi.

b. Create the .exrc file in your home directory so this file contains the line: set number.

16. When working on the script in Question 15, which of the following should you consider? a. output strength b. input validation c. functional reciprocation d. user vacillation

b. input validation

15. The script you are creating takes data input to use for updating a file. Before taking the data input, you want the script to verify that the file to be updated, called clients, exists and that the script user has permission to write to that file. Which of the following statements enables you to do this? a. string -w clients b. test -w clients c. chmod -all clients d. tr -ew clients

b. test -w clients

19. Which of the following characters are placed right after a function name when you create a shell function? a. ( ) b. !# c. [[ d. //

a. ( )

9. Which of the following are examples of Boolean operators used with the test command? (Choose all that apply.) a. -a for a logical AND b. -m for a partial MERGE c. -n for logical NEGATION d. -o for a logical OR

a. -a for a logical AND d. -o for a logical OR

12. Some Linux systems use the script to perform the same actions each time a user logs out of her account. a. .bash_logout b. .bash_rc c. /bin/bashout d. /etc/logoff_bash

a. .bash_logout

3. Your shell script, called .filetests, contains several functions used to run tests on files, such as to determine if a file is empty or has the correct permissions. Which of the following is/are true about .filetests? (Choose all that apply.) a. You can load the file's functions into memory by entering. .filetests. b. This is a hidden file. c. You can run the functions in the file by entering !. file tests. d. This is a character special file

a. You can load the file's functions into memory by entering. .filetests. b. This is a hidden file.

14. Which of the following are examples of symbols you might use in a flowchart? (Choose all that apply.) a. decision b. document c. data d. magnetic disk

a. decision b. document c. data d. magnetic disk

8. What does a down arrow represent in a flowchart? a. process flow b. manual input c. stored data d. display

a. process flow

21. What symbol is typically used at the start and end of a flowchart? a. terminator b. display c. connector d. manual operation

a. terminator

2. Which of the following script statements accomplishes the same thing as the statement: while [ "$part" != "alternator" ] ; do ? (Choose all that apply.) a. while $part "alternator" ; do b. while test $part != "alternator" ; do c. for test $part > "alternator" ; do d. test $part -eq "alternator" | do

b. while test $part != "alternator" ; do

20. When you create a shell function from the command line, what character do you enter at the first > prompt just after you declare the function's name? a. " b. { c. ' d. $

b. {

1. You have been asked to write a script for use by the faculty at the engineering school at your college.The script you write uses the Bash shell, but some faculty members often use a different shell in their work. How can you best ensure that the Bash shell is invoked when this script is run? a. Have the script print a warning to the screen that it requires the Bash shell. b. Have the system administrator adjust all faculty accounts so the Bash shell is the default. c. Enter the line # !/ bin/bash as the first line in the script. d. Create a function for all faculty user accounts that prevents use of shells other than Bash.

c. Enter the line # !/ bin/bash as the first line in the script.

6. You use the same five shell functions every day and are looking for a way to ensure they are available as soon as you log into your account. What can you do? a. Make them residual system variables. b. Make them permanent environment variables. c. Load them via your login script. d. Make them permanent functions by adding them to the /func directory.

c. Load them via your login script.

7. When you enter test -d tmp ; echo $?, you see a 0 displayed on the screen.What does this mean? a. The tmp file is empty. b. The tmp file contains over 1 MB. c. The tmp directory exists. d. The tmp directory is empty.

c. The tmp directory exists.

10. You have a specialized data file, called customers, in which the fields in the file are separated by the character ^. You want to view this file with a colon between the fields before you convert it to remove the ^ characters and insert colons. Which of the following commands enables you to view the file in this way? a. insert -t : ^ | customers b. test - i [^] [:] customers c. cat customers | tr "^" ":" d. sub ':' '^' > customers

c. cat customers | tr "^" ":"

11. Which of the following statements enables you to determine if the variable, called value, is less than 750? a. echo $value -l 750 b. comm value$ to 750 c. test $value - lt 750 d. test "value" >! 750

c. test $value - lt 750

4. When you enter echo $CLR your screen clears very quickly. Which of the following commands must you have entered previously to enable the use of echo $CLR to clear the screen? a. set =:clear b. let clear=CLR c. $clear=CLR d. CLR='clear'

d. CLR='clear'

13. You have recently met with your company's budget committee about creating a script to for producing the same budget reports at the end of each month. Because this is an important undertaking you've started by creating a flowchart. What step should you take next? a. Immediately write the functions you'll need for the script. b. Create a menu script. c. Find the three most important fields in the Budget file that you can use as keys d. Write pseudocode before you create the actual script

d. Write pseudocode before you create the actual script

17. Each month your business manually deletes specific records for employees who have left the company. You have been asked to write a script to automate this process. Which of the following commands works well for deleting records in a file? a. cut -a b. purge -d c. trdel -r d. sed -d

d. sed -d


Related study sets

Pharmacology Chapter 12 Central Nervous System Depressants and Muscle Relaxants

View Set

Self-Determination Theory (EXSC)

View Set

BEHV 5612 - Study Guide: Social Validity (Wolf)

View Set

Immunity Inflammation Infection PrepU

View Set