NOS 120 Final
symbolic name
A ____ is a name consisting of letters, numbers, or characters and is used to reference the contents of a variable.
It performs numeric sorts in Perl.
A colleague at work has overheard you discussing the spaceship operator and is curious about what this is. What do you tell him?
source
A program's high-level language statements are stored in a file called the ____ file.
Should replace "run" with "sub"
A programmer in your group has written the following subroutine, which does not work. What is the problem? run sort { if ($a < $b) { -1; } elsif ($a == $b) { 0; } else { +1; } }
ifconfig
A user on your network has received an error message that there is another computer on the same network using the same IP address, so the user cannot access the network.You send out a message to the 18 Linux users on your network to ask that they check the IP addresses on their computers and e-mail this information to you, so that you can determine who has the duplicate IP address.What utility do you tell users to run to determine their IP addresses?
$income = 62,859; $lname = McGregor ;
Which of the following is an example of a scalar? (Choose all that apply.)
@ <>
Which of the following operators is used to access data in an open file in Perl? (Choose all that apply.)
Bash csh zsh
Which of the following shells enables the use of scripts? (Choose all that apply.)
glob
Wildcard characters are also known as ____ characters.
.dat
You are creating a data file for an inventory system. Which of the following is a common file extension to show this is a data file?
echo $PATH
You are currently in the source directory, which is the new directory you have just created for storing and running your scripts.You want to make certain that the source directory is in your default path.Which of the following commands enables you to view the current default path settings?
It saves the name of a file passed from the command line in ARGV[0].
You have written the following line in a Perl program: $filein = $ARGV[0]; What is the purpose of this line?
STDOUT STDERR
Which of the following are automatically opened by Perl? (Choose all that apply.)
! < % *
Which of the following are examples of arithmetic or relational operators? (Choose all that apply).
0 5
Which of the following are levels of backups that can be made with the dump command? (Choose all that apply.)
let x=5*9 let x=y+10 let m=12/4 let r=128-80
Which of the following are valid expressions? (Choose all that apply.)
a file a partition of directories and files a directory a subdirectory
Which of the following can you restore from a backup tape made via the dump command? (Choose all that apply.)
kill
Which of the following commands enables you to stop the process mentioned in Question 18?
case
Which of the following commands works well for menus used in a script? (Choose all that apply.)
-It facilitates the exchange of information over the Web. -It is a protocol or set of rules
Which of the following describes Common Gateway Interface (CGI). (Choose all that apply.)
chmod 755
____ gives the owner read, write, and execute permissions.
RPC
A(n) ____ enables services and software on one computer to use services and software on a different computer.
False
An IP address uses a dotted decimal notation that consists of 16-bit binary numbers (octets) separated by periods used to identify a computer or network device and the network it is on.(T/F)
if
For which of the following logic structures used within a script is fi the final line for that logic structure? (Choose all that apply.)
Use the -f option
How can you specify which device to use for a restore from a backup tape created by the dump command?
-can be numeric -can be nonnumeric -is scalar
In Perl a variable that starts with $, such as $value, (Choose all that apply.)
single or double quotation marks
In Perl, strings are surrounded by which of the following? (Choose all that apply.)
designate a new line
In Perl, the control sequence \n is used to.
It is the "OR" operator
In the following command, what is the purpose of -o? find . "( " -name a.out -o -name core ")"
When open (FILEIN, "students") is false.
In the following statement, when is Could not open students file displayed? Open (FILEIN, "students") || warn "Could not open students file \n" ;
False
Most computers store text using EBCDIC codes.(T/F)
-Awk does not require explicitly setting up looping structures. -Awk uses fewer lines of code for pattern-matching extractions.
Name at least one difference between Perl and Awk programming. (Choose all that apply.)
variables, constants, scalars, numbers, strings, arrays, and hashes.
Name five data types used by Perl. (Choose all that apply.)
a. /etc/exports b. /etc/hosts.allow c. /etc/hosts.deny
Name some files that should be modified for security when using NFS. (Choose all that apply).
a. Network protocol communications b. Network connections established by the host computer c. Network routing information d. Information about computers remotely logged onto the host computer e. Data and communications errors
Name types of information that you can obtain using netstat.(Choose all that apply)
The script does not have a beginning line that contains the path to Perl, such as #!/usr/bin/perl.
One of your colleagues has written a Perl script, but it does not run on some people s computers who use a different Linux distribution or who do not use the Bash shell. Which of the following might be the problem?
traceroute
One use of ____ is to get a general idea of how efficiently your network is designed.
if statement while loop index jump
Perl supports using which of the following logic structures? (Choose all that apply.)
dd
Possessing a rich set of options that allow it to handle copies when other methods are inappropriate, the ____ command can handle conversions to and from legacy EBCDIC to ASCII.
SMB
Samba is a utility that uses the ____ protocol, which is also used by Windows systems for sharing folders and printers.
top
The ____ command displays a listing of the most CPU-intensive tasks, such as the processor state, in real time (the display is updated every five seconds by default).
free
The ____ command displays the amount of free and used memory in the system.
trap
The ____ command is useful when you want your shell program to automatically remove any temporary files that are created when the shell script runs.
-C
The ____ option of the ispell utility is used to ignore concatenated words.
-q
The ____ option of the ping command displays only a summary of the results.
Bash
The ____ shell, when compared to the other shells, has a more powerful programming interface.
case
The ____ statement simplifies the selection of a match when you have a list of choices.
netstat
The ____ utility gathers statistics and information about IP communications on a computer.
iptables
The ____ utility manages a firewall and packet filtering.
1024
The df utility reports the number of ____-byte blocks that are allocated, used, and available; the percentage used; and the mount point-for mounted file systems.
True
Unlike top, the free utility runs and then automatically exits.(T/F)
+ for addition - for subtraction * for multiplication / for division
What arithmetic operators are used in Perl scripts?
printenv
What command can you use to view the environment and configuration variables already configured on your system?
tput cup 10 15
What command would you use to place the cursor in row 10 and column 15 on the screen or in a terminal window?
There should be a dollar sign in front of selection, as in "$selection"
What error is in the following script code? case "selection" in " i ") ./listscript ;; " ii ") ./numberscript ;; " iii ") ./findscript ;; esac
It is the name for an I/O connection and is used to open, read, write to, or close a file that you are accessing.
What is a filehandle in Perl? (Choose all that apply.)
service
What is the command that you can use (from root) to start the service mentioned in Question 14?
compiler converts the code into machine language in a separate file. An interpreter takes commands or code to run on the spot.
What is the difference between a compiler and an interpreter?
-The login script runs each time you log into your account. -The login script can include commands, such as aliases and the set -o noclobber command, that take effect as soon as the script runs and that last for the duration of the login session.
What is the purpose of a login script?
The top command enables the user to monitor CPU-intensive tasks. A process/task can be stopped when you enter the k command and provide the PID.
What is the purpose of the top command and how can you use it to stop a process?
absolute path to user's home directory
What would you expect to find in the HOME environment variable?
@
When you assign values for an array, what character should precede the name of the array?
SH
When you create a section name in a man page, such as the DESCRIPTION section, what tag should you use just before the section name?
<HTML>
When you make a Web page using HTML, what line do you start with to show that what follows after that line consists of HTML tags?
do
When you type for wood maple spruce oak pine at the command line and then press Enter, what should you type next at the > prompt?
True
When you use restore, by default it copies back to your current working directory. (T/F)
du
You are gathering information about the amount of disk space occupied by users' home directories.
portmap
You are setting up NFS to share files on the network from your Fedora Linux computer.Which of the following is a service that must be running to enable you to use NFS for sharing files?
-It is popularly used to create reports, such as business reports. -It can be used to manipulate text and numeric information.
You are training a new employee and have been asked to help him learn Perl. Which of the following statements can you use to help describe Perl? (Choose all that apply.)
du -h | more
You are working on a report about disk usage on your company's server to help determine if it is time to purchase additional disks.Which of the following commands enables you to obtain disk usage statistics for your report?
sh -n value
You are working with a colleague on a script called value that updates several files.You want to test the script, but not update the files. Which of the following commands can you use?
Create a subroutine.
You are writing a Perl script that uses a segment of code over and over again, and you are tired of repeatedly typing in this code. Which of the following should you do?
<H1>
You colleague is creating an HTML-based Web page and wants the first line to have the largest heading size, and so he uses the tag .This tag isn t producing the expected result. What tag should he use instead?
alias l=" ls -a"
You frequently use the command ls -a and want to save time by just entering l to do the same thing.Which of the following commands enables you to set your system to view hidden files by only entering l ?
traceroute
You have a small network in your business with just a few network devices connected along with 22 Linux computers and you want to see how efficiently your network is designed.Which of the following commands can you use from different computers to determine the route information takes from one computer to another?
You did not give all users in your department execute permission for that script.
You have created a script for use by your entire department in a commonly accessed directory. Only you are able to run the script, which works perfectly.Which of the following is likely to be the problem?
You need to use the export command so these variables have global use.
You have created a series of scripts that use the same environment variables. However, when you run these scripts, some of them do not seem to recognize the environment variables you have set. What is the problem?
The variable value is less than 2842.
You have created the following expression in Perl: $value < 2842.What does this expression mean?
watchit&
You have obtained a new utility, called watchit, to monitor security on your computer, and you decide to run the utility in the background. Normally, to start the utility you would enter watchit at the command line. Which of the following commands enables you to start and run this utility in the background?
OSTYPE
You have remotely logged into a computer running UNIX or Linux, but you are not certain about which operating system you are using. However, when you display the contents of the variable it shows which operating system you are using.
Enter the command, set -o noclobber before you start.
You have spent the last two hours creating a report in a file and afterwards you use cat to create a new file. Unfortunately the new file name you used was the same as the name you used for the report, and now your report is gone.What should you do next time to prevent this from happening?
sh -v sh -x
You have written a script, but when you run it there is an error. Which of the following commands can you use to debug your script? (Choose all that apply.)
trap
You have written a shell program that creates four temporary files.Which of the following commands can you use to remove these files when the script has completed its work?
uptime
You help manage the Linux server for your department. Right now the server has no protection against power failures and there have been several power failures recently.To help make your case for a power protection device, you want to keep track of the amount of time the server has been running since the last power outage that caused it to go down.What command enables you to track how long the server has been up?
You have placed the directory from which you run the scripts in your PATHvariable.
You only have to enter the name of a script to have it run, such as entering myscript. What setting enables you to do this?
True
You should omit spaces when you assign a variable without using single or double quotation marks around its value.(T/F)
ping
You suspect that your computer's connection to the network is not working because you don't seem to be able to connect to the Internet through the network.Which of the following commands can help you determine if your connection is working? (Choose all that apply.)
False
You use the chexec command to indicate that a (shell script) file can be executed.(T/F)
myfiles='ls -l'
You want to store a long listing of your files in a variable called myfiles.Which of the following commands enables you to do this?
df
You've obtained over a hundred large graphics files to use in publications, but you want to be sure there is enough available disk space on your computer to store these files.Which of the following commands should you use?
New or unopened messages begin with an N or a U
You've opened your mail on the company's server by using the mail command. Several messages are listed. How can you tell which ones are new or unopened messages?
free
You've purchased a new program for your computer, but the computer seems to slow down when you run the program.Which of the following commands enables you to monitor the memory usage as you run the program so you can determine if the program is a memory hog?
groff
Your colleague is creating a new man page to document a manufacturing process used by your company. She wants to be able to quickly view the man page as she works on it so that she can have other people view it before copying the man page into production.Which of the following commands enables her and others to periodically review her work in a format similar to the man page format?
He should use the eq operator, instead.
Your colleague is writing a Perl script and wants to determine if two strings are the same. He used the = operator, but it is not working properly. What is the problem?
dd if=promotion of=promotion_uppercase conv=ucase
Your company is launching a marketing campaign, and to start, you've created a file called promotion in normal uppercase and lowercase letters that will be used to place text for ads on the Internet and in newspapers.When you show the promotional text to your boss, she is curious about how it would look in all uppercase letters for emphasis.Which of the following commands enables you to convert the text and save the result to the file, promotion_uppercase?
ps
Your computer is slowing down because you've started a process that is taking most of the memory and CPU resources.Which of the following commands enables you to find the process id so you can stop that process?
more account[ a,b,c,d,e ]
Your current working directory contains a series of files that start with the word "account" combined with a, b, c, d, and e, such as accounta, accountb, and so on. Which of the following commands enables you to view the contents of all of these files? (Choose all that apply.)
Samba
Your network has a combination of Linux and Microsoft Windows computers.There is a Windows server that offers shared files for clients to access.Which of the following enables you to access the shared files from your Linux computer?
Require that script writers place comment lines inside the scripts using the # symbol to begin each comment line.
Your organization routinely uses scripts, but as some employees have left, there are scripts that contain only command lines and no one is certain of their purpose.What steps can be taken to ensure a way for others to know the purpose of a script?
strings
____ are sequences of any types of characters (including numbers that are treated as characters rather than digits).