Professional Documents
Culture Documents
TRUE/FALSE
1. The program development cycle begins with creating specifications for a program.
2. After creating a flowchart, the next step in designing a program is to write the program code.
4. In UNIX/Linux, all shells support the same commands and programming statements.
5. A .bash_logout file in each Bash user’s home directory executes commands when the user logs out.
MULTIPLE CHOICE
2. A ____ is a logic diagram that uses a set of standard symbols to visually explain the sequence of
events from the start of a process to its end point.
a. flowchart c. block chart
b. map d. pseudocode
ANS: A REF: 340
8. When you create a script, you should include the command that sets the particular shell to use on ____.
a. the configuration file c. the first line of the script
b. your login script d. the last line of the script
ANS: C REF: 344
9. The line in the script for setting the Bash shell is: ____.
a. #!/bin/bash c. #/bin/bash
b. !#/bin/bash d. !/bin/bash
ANS: A REF: 344
10. For your own account, the shell that is set up by default is established by the system administrator in
the ____ file.
a. /etc/shell c. /etc/shadow
b. /etc/passwd d. /etc/default
ANS: B REF: 345
11. Each record in the /etc/passwd file is simply a record with variable-length fields separated by ____.
a. dashes (-) c. semicolons (;)
b. commas (,) d. colons (:)
ANS: D REF: 345
12. ____ is a multifunction tool that enables you to manage openSUSE from one location.
a. User Manager c. Control Panel
b. YaST d. MC
ANS: B REF: 345
14. To view a list of the files in a directory, including the hidden files, you should enter ____.
a. ls -l c. ls -h
b. ls -r d. ls -a
ANS: D REF: 346
15. The ____ file is run each time you log in or give the command to set Bash as your current shell, but
not when you run a subshell.
a. .bash_profile c. .bashrc
b. .bash d. .bash_login
ANS: A REF: 347
16. The ____ file typically contains settings, such as environment variable settings, aliases, and other
settings that you always want in effect when you are in the Bash shell.
a. .bash_profile c. .bashrc
b. .bash d. .bash_login
ANS: A REF: 347
17. The ____ file runs when you log in using the Bash shell as the default, and each time you start a Bash
shell within a Bash shell.
a. .bash_profile c. .bashrc
b. .bash d. .bash_login
ANS: C REF: 347
18. The ____ operator of the test command, combines two expressions and tests a logical OR relationship
between them.
a. | c. -O
b. || d. -o
ANS: D REF: 353
19. To format record output you can use the translate utility, ____.
a. tr c. trans
b. trns d. translate
ANS: A REF: 353
20. A simple way to delete a record using ____ is with the -d (delete) option.
a. awk c. test
b. sed d. tr
ANS: B REF: 354
21. A function name differs from a variable name because a function name is followed by a set of ____.
a. parentheses c. square brackets
b. curly brackets d. angle brackets
ANS: A REF: 360
COMPLETION
1. ____________________ enable you to determine the type of data needed for input, the processes that
must be performed, and the output requirements.
ANS: Specifications
REF: 340
2. Two popular and proven analysis tools are used to help you design your programs to meet the program
specifications: the flowchart and ____________________.
ANS: pseudocode
REF: 340
3. The ____________________ that connect the symbols in a flowchart represent the direction in which
the program flows.
ANS: arrows
REF: 341
ANS: Pseudocode
REF: 343
ANS: etc
REF: 348
6. You can define functions from the command line by first entering the name of the function and then
completing the ____________________ to define it.
ANS: parameters
REF: 360
MATCHING
SHORT ANSWER
ANS:
Organizations use flowcharts to design and document all kinds of processes and procedures.
Programmers also use flowcharts to map and understand a program’s sequence and each action the
program takes. For the programmer the flowchart provides a map through the design process to show
what programs and logic must be created. It provides a way of linking what is wanted in the
specifications to the program code that is to be written.
REF: 340
ANS:
Pseudocode instructions are used to create a model that you can later use as a basis for a real program.
REF: 343
3. If you are using the Bash shell, what scripts are run automatically when you log in?
ANS:
With Bash set as your shell, two scripts run automatically when you log in: .bash_profile and .bashrc.
REF: 346
ANS:
If you like using the vi editor, you have the option of configuring a file called .exrc in your home
directory. .exrc can be used to automatically set up your vi environment.
REF: 348
ANS:
The test command is used to analyze an expression to determine if it is true—often used in shell scripts
to verify an environmental condition, such as the existence of a file.
REF: 349
6. How can you view the most recent command’s exit status?
ANS:
You can view the most recent command’s exit status by typing the command: echo $?.
REF: 350
ANS:
A Boolean operator is a logical operator that symbolizes AND, OR, or NOT to evaluate a relationship,
such as a comparison of two expressions—and the result of the evaluation is either true or false.
REF: 352
8. The clear command is a useful housekeeping utility for clearing the screen, but you can use a faster
method. Describe this alternative method.
ANS:
You can store the output of the clear command in a shell variable. The output of the clear command is
a sequence of values that erases the contents of the screen. Storing these values in a variable and then
echoing the contents of the variable on the screen accomplishes the same thing, but about 10 times
faster.
REF: 355
ANS:
Because users do not always enter valid data, a program should always check its input to ensure the
user has entered acceptable information. This is known as input validation.
REF: 358
ANS:
A shell function is a group of commands that is stored in memory and assigned a name. Shell scripts
can use the function name to execute the commands.
REF: 359