Docsity

Practice Midterm Exam - Server side Web Programming | CS 174, Exams of Web Programming and Technologies

Toggle sidebar
bg1
CS174 Fall 2009 Practice Midterm
To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems.
(2) Go over your notes at least three times. Second and third time try to see how much you can
remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems
similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you
want to study in groups, at this point you are ready to quiz each other. The practice midterm is below.
Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be
p
ermitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will
be more than one version of the test. Each version will be of comparable difficulty. (d) One problem
(less typos) on the actual test will be from the practice test. (e) One problem on the actual test will be
about one of my HW solutions.
1. Write a minimal XHTML 1.1 page that would validate with the W3C validator.
2. What HTTP headers are required for the request in HTTP/1.0 and HTTP/1.1?
3. Given an example of an XHTML 1.1 and WAI validating form that contains at least a text field and
submit button on it. Can the same form have more that one submit button and validate? Can the same
document have more than one form and validate?
4. What is the HTML syntax for saying that both the CSS class selectors bob and jill should apply?
Show the CSS, for making the bob selector turn the text color red.
5. Write a short PHP program which determines the names of all form variables sent to it, print the
names of the variables which have integers, computes and outputs the sum of these values.
6. Explain the HTTP needed to set a cookie into a browser for the host somewhere.com, with the path
foo, and expiring in January 31, 2010.
7. Write a PHP abstract class AbstractStuff that has one abstract method getDatabaseStuff(). Write a
subclass of this Stuff which implements getDatabaseStuff() by opening a connections to a mysql
database on localhost using the default username and password. It then does a SELECT * FROM
MY_TABLE and prints in an XHTML validating table with appropriate table headers all of the rows
that it gets back.
8. Explain how function objects can be used like constructors in Javascript. Explain what the prototype
p
roperty is on a Javascript Function object is and how it can be used to create less fragile member
functions of a Javascript object.
9. Write a Javascript function checkForm(form) which when supplied a form objects checks that each
element on the form has a value. If each element did have a value it returns true. Otherwise, it displays
an alert "Please fill in all form elements!" and returns false.
10. Write a short XHTML 1.1 page with a Javascript in it that uses a times to count from 0 in a
p
aragraph tag, refershing every second. i.e., when the page loads you see the number 0, after a second
y
ou see 1, and so on...
Page 1 of 1CS174 Fall 2009
10/19/2009htt
p
://www.cs.s
j
su.edu/facult
y
/
p
ollett/174.1.09f/?PracMid1.shtml?[an%20error%20occu
r
...

Partial preview of the text

Download Practice Midterm Exam - Server side Web Programming | CS 174 and more Exams Web Programming and Technologies in PDF only on Docsity!

CS174 Fall 2009 Practice Midterm

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes at least three times. Second and third time try to see how much you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test. (e) One problem on the actual test will be about one of my HW solutions.

  1. Write a minimal XHTML 1.1 page that would validate with the W3C validator.
  2. What HTTP headers are required for the request in HTTP/1.0 and HTTP/1.1?
  3. Given an example of an XHTML 1.1 and WAI validating form that contains at least a text field and submit button on it. Can the same form have more that one submit button and validate? Can the same document have more than one form and validate?
  4. What is the HTML syntax for saying that both the CSS class selectors bob and jill should apply? Show the CSS, for making the bob selector turn the text color red.
  5. Write a short PHP program which determines the names of all form variables sent to it, print the names of the variables which have integers, computes and outputs the sum of these values.
  6. Explain the HTTP needed to set a cookie into a browser for the host somewhere.com, with the path foo, and expiring in January 31, 2010.
  7. Write a PHP abstract class AbstractStuff that has one abstract method getDatabaseStuff(). Write a subclass of this Stuff which implements getDatabaseStuff() by opening a connections to a mysql database on localhost using the default username and password. It then does a SELECT * FROM MY_TABLE and prints in an XHTML validating table with appropriate table headers all of the rows that it gets back.
  8. Explain how function objects can be used like constructors in Javascript. Explain what the prototype property is on a Javascript Function object is and how it can be used to create less fragile member functions of a Javascript object.
  9. Write a Javascript function checkForm(form) which when supplied a form objects checks that each element on the form has a value. If each element did have a value it returns true. Otherwise, it displays an alert "Please fill in all form elements!" and returns false.
  10. Write a short XHTML 1.1 page with a Javascript in it that uses a times to count from 0 in a paragraph tag, refershing every second. i.e., when the page loads you see the number 0, after a second you see 1, and so on...

CS174 Fall 2009 Page 1 of 1

http://www.cs.sjsu.edu/faculty/pollett/174.1.09f/?PracMid1.shtml?[an%20error%20occur... 10/19/