Draw what will appear in the browser as a result of accessing the following PHP file.
<html> <head><title>Mystery</title></head> <body> <?php $i = 1; while($i <= 4) { $k = 3 * $i + 1; echo "$k,"; $i = $i + 1; } ?> </body> </html>
Draw what will appear in the browser as a result of accessing the following PHP file.
<html> <head><title>Mystery</title></head> <body> <?php $a = 1; $b = 1; while($b < 10) { $c = $a + $b; $a = $b; $b = $c; echo "$b<br />\n"; } ?> </body> </html>
2
3
5
8
13
Draw what will appear in the browser as a result of accessing the following PHP file.
<html> <head><title>Mystery</title></head> <body> <?php $i = 0; $k = 1; while($i < 4) { $i = $i + 1; $k = $k * $i; echo "$k,"; } ?> </body> </html>
1, 2, 6, 24
Suppose we have the HTML file at left below, which contains a
form where the user can type an integer.
Complete the count.php file at right so that it
displays all the numbers counting from 1 to the integer given
by the user. (You don't need to worry about the
possibility that the user's integer
is invalid.)
<html> <head><title>Form</title></head> <body> <form method="post" action="count.php"> <input type="text" name="k" /> <input type="submit" value="Compute" /> </form> </body> </html> <?php import_request_variables("pg", "form_"); ?> <html> <head><title>Response</title></head> <body> <?php ?> </body> </html>
$i = 1; while($i < $form_k) { echo "$i,"; $i = $i + 1; } echo $form_k;
Suppose we have a table named States, which contains three columns:
name the state's name area the state's area (in acres) pop the state's current population
Write an SQL query that lists the names of all states whose population density is at least one person per acre.
SELECT name FROM States WHERE pop >= area
Suppose we have two tables. The first, named Customers, lists information about users.
userid a unique identifier for the customer name the customer's name
The second, named Orders, contains informations about items purchased.
userid the user making the purchase item the name of the item purchased amount the amount of the purchase
Write an SQL query that lists all purchases of more than $100; the result should include both the customer name and the name of the item purchased.
SELECT name, item FROM Customers, Orders WHERE Customers.userid = Orders.userid AND amount > 100
Suppose we have the following two tables in our database.
Cities table cityid location elevation 1 Conway 316 2 Little Rock 350 3 Fayetteville 1400
Colleges table cityid name 1 Hendrix 1 UCA 3 U of A
What is the result of the following SQL query? (It's not necessarily what you would first expect.)
SELECT name, location FROM Cities, Colleges WHERE elevation < 1000
Hendrix | Conway |
Hendrix | Little Rock |
UCA | Conway |
UCA | Little Rock |
U of A | Conway |
U of A | Little Rock |
[The order of the rows is not significant.]