ICS 215 Final Exam Solution
a. In Python, give an example of defining a new regular expression object that exactly matches
the string “Python” only.
b. In Python, what is the main difference between a list and a tuple?
c. What is the equivalent of Perl’s for each in Python?
d. What is one main advantage of PHP over Perl for server-side scripting of dynamic web
e. In PHP, how can you tell what is a variable?
It always begins with a $
h. In Perl, write a search program fragment to match periods followed by one or more white
space characters fol lowed by a capitalized word.
i. In Perl, what is the simplest way to set the value of the key ‘chin’ to be ‘David N. Chin’ in the
j. Name two key differences between scripting languages and systems programming languages .
2. Better Web App Development (2 pts)
In Sean Kelly Õs screen cast comparing different web development languages and framework :
a. What was the problem with developing user interfaces in C++ (be specific)?
b. What did he call having to set lots of parameters in XML files?
3. Perl scripting (3 pts)
Write a Perl subroutine called unique_name that takes as arguments a file name and a directory path that ends in the correct directory separator (Ò/Ó or Ò\Ó) and returns a non -conflicting file name. If the file name does not exist in the directory path, then the original file name is returned. If it does exist, modify the file name by adding different integers (starting from 1) to the base of the file name until a file name is found that does not exist in the path, e.g. document.doc would become document1.doc, then document2.doc, etc.
Write an HTML page with embedded...