Deck 7: Advanced Shell Programming

Full screen (f)
exit full mode
Question
The ____ operator of the test command,combines two expressions and tests a logical OR relationship between them.

A)|
B)||
C)-O
D)-o
Use Space or
up arrow
down arrow
to flip the card.
Question
The line in the script for setting the Bash shell is: ____.

A)#!/bin/bash
B)!#/bin/bash
C)#/bin/bash
D)!/bin/bash
Question
After creating a flowchart,the next step in designing a program is to write the program code.
Question
The program development cycle begins with creating specifications for a program.
Question
A .bash_logout file in each Bash user's home directory executes commands when the user logs out.
Question
The .bashrc file is a hidden file contained in ____ directory.

A)the root
B)your home
C)the /usr
D)the /home
Question
When you create a script,you should include the command that sets the particular shell to use on ____.

A)the configuration file
B)your login script
C)the first line of the script
D)the last line of the script
Question
In a flowchart,a(n)____ is used to represent a decision.

A)diamond
B)rectangle
C)circle
D)arrow
Question
____ is a multifunction tool that enables you to manage openSUSE from one location.

A)User Manager
B)YaST
C)Control Panel
D)MC
Question
To view a list of the files in a directory,including the hidden files,you should enter ____.

A)ls -l
B)ls -r
C)ls -h
D)ls -a
Question
Pseudocode is a design tool only,and is never processed by the computer.
Question
Each record in the -etc-passwd file is simply a record with variable-length fields separated by ____.

A)dashes (-)
B)commas (,)
C)semicolons (;)
D)colons (:)
Question
In UNIX-Linux,all shells support the same commands and programming statements.
Question
In a flowchart,a(n)____ is used to indicate process flow.

A)diamond
B)rectangle
C)circle
D)arrow
Question
For your own account,the shell that is set up by default is established by the system administrator in the ____ file.

A)/etc/shell
B)/etc/passwd
C)/etc/shadow
D)/etc/default
Question
The second step in the program development cycle is ____.

A)creating program specifications
B)coding the program
C)the design process
D)debugging
Question
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
B)map
C)block chart
D)pseudocode
Question
In a flowchart,a(n)____ is an on-page connector to continue process flow.

A)diamond
B)rectangle
C)circle
D)arrow
Question
In a flowchart,a(n)____ is used to represent a process.

A)diamond
B)rectangle
C)circle
D)arrow
Question
Each step in the program is represented by a(n)____ in the flowchart.

A)block
B)arrow
C)label
D)symbol
Question
____________________ enable you to determine the type of data needed for input,the processes that must be performed,and the output requirements.
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and can be read
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
logical AND
Question
Two popular and proven analysis tools are used to help you design your programs to meet the program specifications: the flowchart and ____________________.
Question
A function name differs from a variable name because a function name is followed by a set of ____.

A)parentheses
B)curly brackets
C)square brackets
D)angle brackets
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
logical negation
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
performs a relational integer test
Question
What are pseudocode instructions used for?
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
tests for a nonzero string length
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
compares the first file in the argument with the second file to determine if the first file is newer
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and is a regular file
Question
____________________ instructions are similar to actual programming statements.
Question
The ____________________ that connect the symbols in a flowchart represent the direction in which the program flows.
Question
What are flowcharts used for?
Question
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and its size is greater than zero
Question
You can define functions from the command line by first entering the name of the function and then completing the ____________________ to define it.
Question
The -____________________-bashrc file sets default functions and aliases.
Question
To format record output you can use the translate utility,____.

A)tr
B)trns
C)trans
D)translate
Question
A simple way to delete a record using ____ is with the -d (delete)option.

A)awk
B)sed
C)test
D)tr
Question
What is a Boolean operator?
Question
The clear command is a useful housekeeping utility for clearing the screen,but you can use a faster method.Describe this alternative method.
Question
How can you view the most recent command's exit status?
Question
What is a shell function?
Question
What is the test command used for?
Question
If you are using the Bash shell,what scripts are run automatically when you log in?
Question
How can you set defaults for using the vi editor?
Question
What does "input validation" mean?
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/48
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 7: Advanced Shell Programming
1
The ____ operator of the test command,combines two expressions and tests a logical OR relationship between them.

A)|
B)||
C)-O
D)-o
D
2
The line in the script for setting the Bash shell is: ____.

A)#!/bin/bash
B)!#/bin/bash
C)#/bin/bash
D)!/bin/bash
A
3
After creating a flowchart,the next step in designing a program is to write the program code.
False
4
The program development cycle begins with creating specifications for a program.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
5
A .bash_logout file in each Bash user's home directory executes commands when the user logs out.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
6
The .bashrc file is a hidden file contained in ____ directory.

A)the root
B)your home
C)the /usr
D)the /home
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
7
When you create a script,you should include the command that sets the particular shell to use on ____.

A)the configuration file
B)your login script
C)the first line of the script
D)the last line of the script
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
8
In a flowchart,a(n)____ is used to represent a decision.

A)diamond
B)rectangle
C)circle
D)arrow
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
9
____ is a multifunction tool that enables you to manage openSUSE from one location.

A)User Manager
B)YaST
C)Control Panel
D)MC
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
10
To view a list of the files in a directory,including the hidden files,you should enter ____.

A)ls -l
B)ls -r
C)ls -h
D)ls -a
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
11
Pseudocode is a design tool only,and is never processed by the computer.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
12
Each record in the -etc-passwd file is simply a record with variable-length fields separated by ____.

A)dashes (-)
B)commas (,)
C)semicolons (;)
D)colons (:)
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
13
In UNIX-Linux,all shells support the same commands and programming statements.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
14
In a flowchart,a(n)____ is used to indicate process flow.

A)diamond
B)rectangle
C)circle
D)arrow
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
15
For your own account,the shell that is set up by default is established by the system administrator in the ____ file.

A)/etc/shell
B)/etc/passwd
C)/etc/shadow
D)/etc/default
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
16
The second step in the program development cycle is ____.

A)creating program specifications
B)coding the program
C)the design process
D)debugging
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
17
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
B)map
C)block chart
D)pseudocode
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
18
In a flowchart,a(n)____ is an on-page connector to continue process flow.

A)diamond
B)rectangle
C)circle
D)arrow
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
19
In a flowchart,a(n)____ is used to represent a process.

A)diamond
B)rectangle
C)circle
D)arrow
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
20
Each step in the program is represented by a(n)____ in the flowchart.

A)block
B)arrow
C)label
D)symbol
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
21
____________________ enable you to determine the type of data needed for input,the processes that must be performed,and the output requirements.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
22
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and can be read
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
23
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
logical AND
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
24
Two popular and proven analysis tools are used to help you design your programs to meet the program specifications: the flowchart and ____________________.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
25
A function name differs from a variable name because a function name is followed by a set of ____.

A)parentheses
B)curly brackets
C)square brackets
D)angle brackets
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
26
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
logical negation
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
27
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
performs a relational integer test
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
28
What are pseudocode instructions used for?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
29
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
30
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
tests for a nonzero string length
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
31
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
compares the first file in the argument with the second file to determine if the first file is newer
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
32
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and is a regular file
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
33
____________________ instructions are similar to actual programming statements.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
34
The ____________________ that connect the symbols in a flowchart represent the direction in which the program flows.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
35
What are flowcharts used for?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
36
Match each option of the test command with a statement below.
a.-a
f.-n
b.!
g.-nt
c.-r
h.-s
d.-f
i.-e
e.-ne
true if a file exists and its size is greater than zero
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
37
You can define functions from the command line by first entering the name of the function and then completing the ____________________ to define it.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
38
The -____________________-bashrc file sets default functions and aliases.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
39
To format record output you can use the translate utility,____.

A)tr
B)trns
C)trans
D)translate
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
40
A simple way to delete a record using ____ is with the -d (delete)option.

A)awk
B)sed
C)test
D)tr
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
41
What is a Boolean operator?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
42
The clear command is a useful housekeeping utility for clearing the screen,but you can use a faster method.Describe this alternative method.
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
43
How can you view the most recent command's exit status?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
44
What is a shell function?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
45
What is the test command used for?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
46
If you are using the Bash shell,what scripts are run automatically when you log in?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
47
How can you set defaults for using the vi editor?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
48
What does "input validation" mean?
Unlock Deck
Unlock for access to all 48 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 48 flashcards in this deck.