ITN 171 EXAM 3 (chapter 7 review questions)

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

1- What symbol is typically used at the start and end of a flowchart?

a. terminator

1- 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

1- What does a down arrow represent in a flowchart?

a. process flow

1- Create a simple function that determines if the string variable, text, contains no characters (is of zero length).

stringtest ( ) { test -z $text echo $? }

1- Which of the following characters are placed right after a function name when you create a shell function?

a. ( )

1- 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. -o for a logical OR

1- Some Linux systems use the ___________________ script to perform the same actions each time a user logs out of her account.

a. .bash_logout

1- In your organization everyone uses the Bash shell in Red Hat Enterprise Linux and all users use the same aliases and shell functions. In what file or files can the system administrator place these aliases and functions so they are available to all users?

a. /etc/.bashrc b. /etc/profile

1- In which of the following files would a system administrator set the default shell used by your account?

a. /etc/passwd

1- What is an exit status and with what command is it used?

a. A numeric value that the test command returns to the operating system when test finishes performing an evaluation of an expression, string, integer, or other information. b. Used with the test command

1- When you enter echo $CLR your screen clears very quickly. Which of the following commands must you have entered previously to enable use of echo $CLR to clear the screen?

a. CLR='clear'

1- 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 the .exrc file in your home directory so this file contains the line: set number

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. Enter the line # !/bin/bash as the first line in the script.

1- When working on the script in Question 15, which of the following should you consider?

a. Input validation

1- 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. Load them via your login script

1- When you enter test -d tmp ; echo $?, you see a 0 displayed on the screen. What does this mean?

a. The tmp directory exists

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

1- You have a specialized data fie, 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. cat customers | tr "^" ":"

1- 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. sed -d

1- Which of the following statements enables you to determine if the variable, called value, is less than 750?

a. test $value - lt 750

1- 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. test -w clients

1- Create a statement that enables you to determine if the file /source/results is newer than the file /data/results.

a. test/source/results -nt /data/results; echo$?

1- Which of the following script statements accomplishes the same thing as the statement: while [ "$part" != "alternator" ] ; do? (choose all that apply.)

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

1- 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. write pseudocode before you create the actual script

1- 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. {


Ensembles d'études connexes

Teaching in a Diverse Society Exam

View Set

Ch. 22 - Lymphoid System & Immunity - Quiz

View Set

System and analysis chapter 7 & 8

View Set