Unix/Linux

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

b. STDOUT c. STDERR

11. Which of the following are automatically opened by Perl? (Choose all that apply.)

a. When open (FILEIN, "students") is false.

12. In the following statement, when is "Could not open students file" displayed? open (FILEIN, "students") || warn "Could not open studentsfile \n" ;

a. $income = 62,859; b. $lname = "McGregor";

14. Which of the following is an example of a scalar? (Choose all that apply.)

d. It saves the name of a file passed from the command line in ARGV[0].

15. You have written the following line in a Perl program: $filein = $ARGV[0]; What is the purpose of this line?

b. .dat

17. 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?

c. <H1>

20. You colleague is creating an HTML-based Web page and wants the first line to havethe largest heading size, and so he uses the tag <LARGEHEAD>.This tag isn't pro-ducing the expected result.What tag should he use instead?

b. He should replace "run" with "sub."

7. A programmer in your group has written the following subroutine, which does notwork.What is the problem?run sort { if ($a < $b) { -1; } elsif ($a == $b) { 0; } else { +1; } }

d. 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?

a. 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 thenetwork.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?

c. Use the -f option.

How can you specify which device to use for a restore from a backup tape created by the dump command?

b. can be numeric c. can be nonnumeric d. is scalar

In Perl a variable that starts with $, such as $value,_______. (Choose allthat apply.)

d. single or double quotation marks

In Perl, strings are surrounded by which of the following? (Choose all that apply.)

b. designate a new line

In Perl, the control sequence \n is used to _____________.

b. It is the "OR" operator.

In the following command, what is the purpose of -o? find . "( " -name a.out -o -name core ")"

perl: The first statement is as follows: #! /usr/bin/perl The Perl language programmer explicitly defines the loop controls. A Perl language program file is saved with.pl extension. Its code length is more than that of awk awk: The first statement is as follows: #! /usr/bin/awk -f The awk language programmer is not required to explicitly define the loop controls. An awk language program file is saved with .a or .awk extension. It uses fewer lines to write the same purpose code.

Name at least one difference between Perl and Awk programming.

scalar string list array hash

Name five data types used by Perl.

1) /etc/hosts.deny -file denies the clients sharing of resources 2) /etc/hosts.allow -file will allow the share the resources

Name two files that should be modified for security when using NFS.

1) the program displays statistics of all communication ports that was used by the transport protocol. 2) the programmer shows currently running programs that are related to active ports. Syntax: netstat [-options] host

Name two types of information that you can obtain using netstat utility.

a. 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?

a. if statement b. while loop c. index jump

Perl supports using which of the following logic structures? (Choose all that apply.)

Four total +, -, *, / • addition operator (+) that adds two numeric values • subtraction operator (-) that subtracts one numeric value from the other • multiplication operator (*) that multiplies two numeric values • division operator (/) that divides one numeric value by the other

What arithmetic operators are used in Perl scripts?

1) filehandles connect the perl program file with the operating system to make I/O operations on it. 2) filehandle names are always UPPERCASE letters There are three default filehandles that automatically get opened as you start the perl language scripting. These include the following: • STDIN: This initiates the use of input from the input device keyboard. • STDOUT: This initiates the use of output screen on which print(), write() functions show their outputs. • STDERR: This initiates the use of output screen to show error messages in case an error occur while executing the program.

What is a filehandle in Perl?

a. service

What is the command that you can use (from root) to start the service mentioned in Question 14? a. service b. start c. init d. go REFERENCE: 14. 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? a. NFSstart b. share c. portmap d. netlink

1) the programmer displays most CPU-interactive tasks, that means processor rate, delay between screen updates and so on, in listing fashion. 2) The programmer uses s option to run the top utility in secure mode, which disables the interactive commands that means the programmer uses k word that kills the process. 3) The programmer uses interactive command such as k while running the top command for killing the process.

What is the purpose of the top command and how can you use it to stop a process?

c. @

When you assign values for an array, what character should precede the name of the array?

b. .SS

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?

c. <HTML>

When you make aWeb page using HTML, what line do you start with to show that what follows after that line consists of HTML tags?

a. 0

Which of the following are levels of backups that can be made with the dump command? (Choose all that apply.)

b. a partition of directories and files

Which of the following can you restore from a backup tape made via the dump command? (Choose all that apply.)

b. kill

Which of the following commands enables you to stop the process mentioned in Question 18? a. bye b. kill c. ci d. tar REFRENCE: 18. 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? a. ps b. df c. du d. free

a. It facilitates the exchange of information over theWeb. d. It is a protocol or set of rules.

Which of the following describes Common Gateway Interface (CGI). (Choose all that apply.)

b. @ d. <>

Which of the following operators is used to access data in an open file in Perl? (Choose all that apply.)

• The programmer wants to generate report for disk usage of the home directory, for that purpose the programmer should type the du | more command and then press enter key. • That shows the number of 512 byte blocks used in each sub directory. After that press word q for exit the more command. • The programmer wants to generate report for disk usage from individual directories under the home directory for that purpose the programmer should type the du-b | more command and then press enter key. After that press word q for exit the more command. • And then type the du-h | more utility, which displays the statistics of the disk usage in human readable format.

You are gathering information about the amount of disk space occupied by users' home directories.What command enables you to view a breakdown by individual directories under the /home directory? (Provide the actual command you would run and any special considerations for running it.)

c. 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?

b. It is popularly used to create reports, such as business reports d. 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.)

d. 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?

a. 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?

d. 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?

c. The variable value is less than 2842.

You have created the following expression in Perl: $value < 2842.What does this expression mean?

b. 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?

b. 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?

a. 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.)

a. 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?

b. 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?

a. 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?

c. 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?

c. 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?

d. 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?

a. 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?

c. Samba

Your network has a combination of Linux and MicrosoftWindows computers.There is aWindows server that offers shared files for clients to access.Which of the following enables you to access the shared files from your Linux computer?


Kaugnay na mga set ng pag-aaral

Chapter 15: Injuries to Muscles and Bones

View Set

BJU test 2 review geology chapter 6

View Set

Real Estate Basics: Real Property Appraisal

View Set

tRNA, rRNA structure and synthesis

View Set