Ics 215 Final Exam Solution Essay

609 Words Nov 4th, 2015 3 Pages
ICS 215 Final Exam Solution https://hwguiders.com/downloads/ics-215-final-exam-solution 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 pages? e. In PHP, how can you tell what is a variable?
It always begins with a $
f. In JavaScript, how do you redirect the current window to a different location?

g. In JavaScript, how would you get the first 9 digit substring of the string str\?
h. In Perl, write
…show more content…
When the user changes the social security number, the program checks that it is in the form ddd -dd
-dddd with no extra stuff before or after and pop up an alert if incorrect.
4. PHP Scripting (6 pts)
Write a PHP program, register.php, that initially has a text type input box for the userÕs name, a radio button for three different date s 6/1, 6/2, or 6/3 and a Submit button with an action that is the same register.php. If the user has submitted successfully (name is not empty and one date is selected), then the program says only ÒThank you name for registering for the seminar on date .Ó
5. Python Scripting (6 pts)
Write a Python class Rectangle whose __init__ takes two numbers (the length and width), has a @property called area that returns the product of the length and width, and overloads the __add__ operator so that if the other argument is also a Rectangle, then a new rectangle is returned with length equal to the sum of the lengths of the added Rectangles and likewise for the width h. Finally, write a generator called rectangle multiples that takes a Rectangle as an argument and yields new Rectangles that are positive integer multiples of the original Rectangle with length progressing from l to 2 the width. The first call to next() should return a Rectangle identical in length and width to the

Related Documents