perl 期末考试题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
PERL复习题
一、选择题B
1. What is the simplest type of data that Perl can work with?
A element
B scalar
C vector
D component
2. Which operator can be used to take the bottom item from an array?
A pop
B push
C pull
D plant
3. Which operator is used to arrange items in character order?
A ascend
B sort
C arrange
D descend
4. Rather than using print, what is often used in Perl when formatting is important?
A printf
B format
C align
D show
5. Which modifier can be used when matching in Perl to ignore case?
A s
B v
C i
D c
6. Which operator can be used to break up a string into more than one part based upon a separator?
A chop
B split
C divide
D parse
7. What option do you use when starting Perl to tell it to run in warning mode? __________ (Fill in the blank.)
8. Which control structure can be used to execute only a condition is false?
A until
B unless
C while
D without
9. Which of the following commands should be used to open a filehandle named KAREN to an existing file named sw?
A open KAREN “>sw”;
B open KAREN, “>sw”;
C open “sw” KAREN;
D open “>sw”, KAREN;
10. Within Perl, which operator is used to change the working directory?
A cd
B chdir
C pwd
D wd
11. Which operator can be used to access the first item in an array?
A shift
B start
C right$
D left$
12. Within a loop, which operator immediately ends execution of the loop?
A next
B last
C redo
D leave
13. Which function can be used to make sure your program exits with a nonzero status even if there a standard error?
A hash
B noexit
C nozero
D die
14. Which of the following operators work most like simple searching/pattern matching?
A /f
B /g
C s///
D m//
15. Which keyword is used in Perl to define a subroutine?
A branch
B sub
C split
D make
16. You want to close the directory handle EV AN. Which of the following should you use to accomplish this?
A close EV AN;
B closedir EV AN;
C close_directory EVAN;
D none of the above
17. Which of the following lines of code accomplishes the same thing as $price = $price + 9;?
A $price +9;
B $price =+9;
C $price +=9;
D 9 + $price
18. What value do variables have before they are first assigned?