PERL PROGRAMMING

2010 Jawaharlal Nehru Technological University, Hyderabad JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD M.C.A IV Semester Regular Examinations July 2010 PERL PROGRAMMING Question paper

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
M.C.A IV Semester Regular Examinations July 2010
PERL PROGRAMMING
Time: 3hours Max.Marks:60
Answer any five questions
All questions carry equal marks
- - -
1. a) Differentiate between the following control statements of Perl.
i) If and unless
ii) While and until
iii) Next and last
b) What is the output of the following Perl program segment?
$a=567;
$b=123;
$c=3;
print $a + $b;
print $a. $b;
print $a x $c;
print "$a is not equal to $b"
print $a <=> $b;
print '$a is not equal to $b'
2. a) How do you activate Perl debugger? What does it do?
b) List and explain any six Perl debugger commands.
3. List out the categories of Perl functions and write any two functions for each
category.
4. a) List the rules of regular expression matching of Perl
b) Write Perl statements using regular expressions for the following:
i) Matches any of these words in the string: cat , rat, mat
ii) Matches the date format dd -mm- yyyy
iii) Count the number of times the word "the" occurs in the given text.
iv) Occurrence of digit 5 for 3 or more times
v) Substitute lower case with upper case
vi) Splitting paragraph into sentences
5. Write a Perl subroutine that takes a text string as input parameter and returns the
frequency of occurrences of various words in the text as a hash.
6. a) What is a reference? Where do you use references?
b) Write a Perl program that reads a file containing city and country as records
and creates a hash of arrays containing countries as key and cities as values. For
example for the input {Delhi: India, Hyderabad: India, New York: USA, Chicago:
USA}, the program is required to create hash table {India: [Delhi, Hyderabad],
USA: [New York, Chicago]}
7. Create a CGI form that inputs user name and outputs Hello followed by username.
8. a)What is a cookie? Write one application using cookies.
b) Write CGI script for uploading the selected file.
KEYWORDS:PERL PROGRAMMING,PERL PROGRAMMING QUESTION PAPER,JNTU,JNTU QUESTION PAPER,JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD MCA-IV SEMESTER SUPPLEMENTARY EXAMINATIONS JULY PERL PROGRAMMING