CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Perl Questions


New User

Dec 30, 2008, 3:54 AM

Post #1 of 2 (866 views)
Perl Questions Can't Post

Hello All,

I have to attend a perl exam in my company. I have got previous exam questions. Please help me to find out the answersSly.

1. In perl key takes an associative array as an argument. keys return a regular scalar array consisting of all the keys in hash array specified. keys are returned in---?

a)sorted way b)random c)as per key vale pair

2. Which command will restart the loop block without evaluating the condition again in perl?

a)redo b)next c)last)
3. Like other two operators like next and last the redo will work with any ------?

4. while (/(<\/[^>]+>)|(<[^>]+>)|([^><]+)/go) { $closeTag=$1; $beginTag=$2; $ content=$3; Which operator is used in this program?

a)AND b)OR

5. -----used to exit the loop and takes control to specific label defined locations in perl.

6. Empty parentheses () may be used to indicate the pseudo file formed of the --------.

7. perl\'s length() function returns-----------------.

8. Evaluating a list in scalar or void context causes all list items to be evaluated and the value of last item-------.

9. Perl -I option is used for------------.

10. what is the command to sort contents of file
a) my @file=sort@file1, b)file=sort<stdin> c)none of the above

11. $href= \% herf is a-------reference? (Ans: Hash)

12. Which is a simple perl program?

a)perl -e \ "print 'Hello World'\n"\; b)perl -e \'print "Hello World"\n'\; c)both a and b d)none of the above.

13. Use strict in perl is a -------. (Ans:Pragma)

14. The advantage of closing the filehandle implicitly is that $. variable gets-----.(Ans: resets)

15. The redo operation is to ------------.

a) go back to the top of current loop b) go back to the top of current loop block

16. When you run perl program or any script in unix there will be certain -----------.(ans:environment variable set)

17. Ternary operator is similar to-----------. (ans: if then else)

18. What is the o/p of the script?

if (!($age<=100))
{print "found";
a) print "found" if age is less than 100. b)print the value as none as ! is used in condition

19. variables of the same name may exist concurrently in each--------

a. package b. module c. function

20. Default scope of variable in perl

21. The difference between "my" and "local" variable scope declaration in perl is?

22. What are the scops in perl i) lexical ii) static iii) dynamic

a. i and ii b. i and iii c. all the above



Dec 30, 2008, 10:20 AM

Post #2 of 2 (857 views)
Re: [achu] Perl Questions [In reply to] Can't Post

I wish you good luck on the test. You will need it. Unsure


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives