CS 465 Final With Frogs

1-4) Design a database. Use as many or as few tables as you to hold the data best. Use correct column types. Use a good schema. Your database and schema should hold facts like this. There will be other cars and other people. You don't have to enter the data, but you do have to make the tables using mysql. SHOW ME THE TABLE ON THE COMPUTER.

Kermit has an Explorer

Piggy has a Jetta

Chef has a Schwinn

Cookie has an Explorer

All Explorers have 6 cylinders

All Jettas have 4 cylinders

All Schwinn have no cylinders

Kermit's car is white

Piggy's car is blue

All vehicles are either silver, white, blue, or green.

All vehicles have either 0,4,6, or 8 cylinders

5) Using the nations database, how many nations have a population of less than 1,000,000 people? SHOW ME THE QUERY ON THE COMPUTER.

6) Using the nations database, what are the three richest (gdp/pop) nations with a population over 10,000,000 people? SHOW ME THE QUERY ON THE COMPUTER.

7) Using the nations database, what is the nation with the largest population that borders Russia. Hint: There is a borders table that says who touches whom. SHOW ME THE QUERY ON THE COMPUTER.

8) Can a PHP program tell what kind of browser is requesting the page? (Circle all that apply)
Yes
Yes, but they might lie
No, it's typically not sent
No, it's never sent. That's not part of the protocol.

9) Show me a regular expression that matches aircraft N-numbers. An N-number starts with a capital N, and then has one to five upper case letters or digits.
GOOD BAD

N12345 N 1234
N3080X N$.!
N1 N

10) I don't use mysql_real_escape_string or anything like it in my code. What might happen to me? Use no more than 20 words.

11) I make a page using AJAX as we did in class. The AJAX is triggered by key press events. I press a key on some input field, and the request is sent to the server. The server crashes and no reply is received. A second key is pressed. What will the use notice?

The second key is ignored.

The second key is only echoed to the input field after the server finally responds.

The second key is processed normally.

Frogs

12) I have a Django template. What goes in between {% and %}?
HTML Python Javascript

13) Write a url rule in Djamgo that directs both and Use fewer than three lines of code.

You may only get 4 PHP points, 4 Django points, 4 Javascript points, and 5 points total.

(up to four points) Write me a page that asks a user to enter a word, and grabs that word when the user presses a button. If it shows the most recent word typed somewhere besides the input field, two point. If it keeps a list of words entered, three points. If it eliminates duplicates, four points.

(up to three points) Write me a page asking for my social security number, gender, and name. Names start with a capital and never have digits (one point). Social security numbers (one point) and genders (one point) are restricted in the obvious way. Reject bad entries using either javascript or PHP or Django.

(Two points) Write me a web page that prints every word with two vowels in a row from the file /usr/share/dict/words. Be careful to count both upper and lower case letters. 'Y' counts as a vowel.


(Up to four points) Write me a program that offers a web form that uses the nations database. When the user enters a plane, it prints every nation using that plane. Two point for the basics, another if you can print nation names and not nation codes(i.e. China and not 'ch'), and a fourth if this is in order by national name. Hint: There is a table named 'planes'.

(one point) The program sets a cookie named 'frog' to equal 'kermit'. It expires in 10 seconds.

(one point) The program prints the value of a cookie named 'frog'.