今天同学去honeywell面试 Unix面试题 分享一下 大家做做看。

AntonlioX 2005-04-13 12:58:20

1. Jane has two identical files, filea.txt and fileb.txt. What message will she get when she types diff filea.txt fileb.txt ?


2. Jack forgot to sort his two files before a merge. Would sort provide an error message when he typed sort -m-o sorted_file.out filea.txt fileb.txt at the command line?


3. A file named filein contains the two amounts 123. and 123.33 The command is typed sort -nro sort.out filein. In sort.out which amount is displayed first, 123. or 123.33 ?


4. Assume filea.c and fileb.c both contain the line #include stdio.h What is the output of the command grep '^include' *.c |uniq ?

5. Write the grep command to display lines from the file text2 that contain a string of characters starting with st, followed by zero or more characters and ending with ing E.G. sting,straining,string,staining



6.This assignment works with a file called survey. From left to right, the columns in the file contain the name of the country, the area (in thousands of square kilometers, the population (in millions) and the continent that the country is located in. The fields are separated by a colon (:) A cat survey follows:

Canada:3852:25:North America
USA:3615:237:North America
Brazil:3286:134:South America
England:94:56:Europe
France:211:55:Europe
Japan:144:120:Asia
Mexico:762:78:North America
China:3705:1032:Asia
India:1267:746:Asia


Write an awk program file named summary.awk that will be run from the command line :

awk -f summary.awk survey



The program file should perform the following actions:

1) In the BEGIN section, headers should be printed as follows

Country Area Pop Continent Status
----------------------------------------------------------------------------------------------

Ensure that headers are aligned with the columns
Both Field Separator and Output Field Separator should be set to colon (:)
(Hint FS=":")


2) Processing section: Compare field #4
If the field is "North America" then field #5's contents should be "Complete"
If the field is "Asia" then field #5's contents should be "In progress"
If the field is "Europe" then field #5's contents should be "Not Started"
If the field is "South America" then field #5's contents should be "N/A"

The printf statement should be:
printf "%-10s %10d %10d %+15s %+12s\n",$1,$2,$3,$4,$5



3) In the END section, use the NR variable and printf to print out the string
"Number of countries survyed = ?


7. Write a Perl program that asks the user to enter two numeric values. Use the strict and warning pragmas.

Store the variables in $x and $y.

If $y is not zero, divide $x by $y and display the result.

If $y is zero display the message "Division by zero is an illegal operation" and exit the program immediately using the die function.


8. Write a Perl CGI script. The script should open a new browser window and display the messages :

For promotion of CGI scripts into cgi-bin, e-mail the Web-Admin
Direct your requests to Rocket.J.Squirrel@Bullwinkle.com

Both lines should be bold face.

Hints:

1) Use the warning pragma.

2) The @ sign in the e-mail address should be escaped ( e.g. \@ ) so that Perl does not evaluate @Bullwinkle.com as an array

3) Ensure your HTML tags are well-formed (e.g. every <BODY> has a corresponding </BODY> )

...全文
1293 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
AntonlioX 2005-04-23
  • 打赏
  • 举报
回复
Introduction - Honeywell

Manufacturer of civil and military avionics and other aerospace products, integrator
and also service provider.
AntonlioX 2005-04-23
  • 打赏
  • 举报
回复
我是在linux redhat9下作的
kaphoon 2005-04-23
  • 打赏
  • 举报
回复
honeyWell做什么的
每天早上上班的时候都能看到他们的班车,空空的
而我们公司的班车挤得要命
gettext 2005-04-23
  • 打赏
  • 举报
回复
这些面试题Unix和linux下答案不一样。
nodummy 2005-04-23
  • 打赏
  • 举报
回复
第一个题目是no message????怀疑阿怀疑……
AntonlioX 2005-04-22
  • 打赏
  • 举报
回复
我的解答:


1.
no message .


2.
Try ‘sort --help’ for more infomation




3.

123.33



4.

No output because '^include' represents a line beginning with include ,but here is “#include”.


5.


grep ‘^st.*ing$’ text2













6.

#!/bin/awk -f

BEGIN { FS=":"
print "Country Area Pop Continent Status"
print "----------------------------------------------------------------------------------------------"
}

{
if($4 == "North America" )
{
$5="Complete"
}
else if($4 == "Asia" )
{
$5="In progress"
}
else if($4 == "Europe" )
{
$5="Not Started"
}
else if($4 == "South America" )
{
$5="N/A"
}
printf "%-10s %10d %10d %+15s %+12s\n",$1,$2,$3,$4,$5
}

END { printf "Number of countries surveyed = %d\n" ,NR }






7.

#!usr/bin/perl -w
use strict;

my $x=0;
my $y=0;

print “Please input numeric value X : “;
$x=<STDIN>;
chomp $x;
print “Please input numeric value Y : “;
$Y=<STDIN>;
chomp $y;

if($y==0)
{
die “Division by zero is an illegal operation !\n”;
}
else
{
my $result =$x/$y;
print “$x / $y = $result\n”;
}














8.

#!/usr/bin/perl –w

use strict;
use CGI qw(:standard);

print header;

print qq(<HTML>
<BODY>
<H1 ALIGN=CENTER>
<FONT SIZE=3><b>For promotion of CGI scripts into cgi-bin, e-mail the Web-Admin</b></FONT>
</H1>
<H2><FONT SIZE=3><b>Direct your requests to Rocket.J.Squirreli\@Bullwinkle.com</b></FONT></H2>
</BODY>
</HTML>);

iwantsleep 2005-04-18
  • 打赏
  • 举报
回复
很少用到的命令
qfxx 2005-04-18
  • 打赏
  • 举报
回复
这个
应该是作系统管理员要考的题目吧
唉好多不会
继续努力
junnyfeng 2005-04-17
  • 打赏
  • 举报
回复
楼主厉害,什么时候公布一下你的答案,大家都在等候!

junnyfeng到时候倒给你100分 :)
nodummy 2005-04-17
  • 打赏
  • 举报
回复
楼上纯粹是……抢分来着?不愧是饼……
zhousqy 2005-04-17
  • 打赏
  • 举报
回复
慢难
slone 2005-04-16
  • 打赏
  • 举报
回复
「已注销」 2005-04-16
  • 打赏
  • 举报
回复
不懂
俺是初学者
lito_rat 2005-04-13
  • 打赏
  • 举报
回复
这是考unix 系统管理员的吧
nodummy 2005-04-13
  • 打赏
  • 举报
回复
这个是什么?

看起来根本不像是面试的题目……否则就是面试长期在Unix下面工作的人员的题目……
AntonlioX 2005-04-13
  • 打赏
  • 举报
回复
我当时看了一下 就是第六题不会做 因为awk没学过。大家帮忙来做一下啊。说不定以后你可能也去那面试

23,120

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧