CMSC389N Final Exam Study Guide
Using the <img> tag define a image entry where the image name is myPhoto.jpg and the
message "Customer Photo" will appear when the image cannot be displayed. - ANSWER
<img src="myPhoto.jpg" alt="Customer Photo">
Define a CSS rule that associates the color blue with links that have not been visited. -
ANSWER a:visited {
color: purple;
}
What is the difference between an id selector and a class selector? - ANSWER Class
selector allow us to apply the same rules to many elements; an id selector allows to
apply rules to only one element. Another difference: class selectors are defined using #;
id selectors using a period.
Which of the following are considered false in PHP? Circle all that apply.
a. 0
b. "" (empty string)
c. false
d. 10
e. "0" - ANSWER a., b., c., e.
What is the difference between == and === while comparing objects? - ANSWER = = true
if two objects have same attributes and values and are instances of the same class; = = =
true if and ony if the two variables refer to the same object instance
Using PHP define a constant called MAX_LENGTH that has a value of 50. - ANSWER
define("MAX_LENGTH", 50);
What takes place when a file included using require_once is not found? - ANSWER A
fatal error will take place and the script will be terminated.
What is an empty variable? (PHP) - ANSWER a variable that has a value that evaluates to
false.
Name two differences that exits between echo and print. - ANSWER i. Print returns a
value; echo does not
ii. echo can print expressions separated by commas
, What is HTTP? - ANSWER Protocol that defines how user agents (e.g., browser) and web
server can communicate. Accept as valid Hypertext Transfer Protocol
Provide an example of what is possible by using server side includes. - ANSWER file
inclusion, timestamp for file modification, timestamp for local date / time or any other
valid one they may have provided.
In HTML what is the difference between an inline element and a block element? -
ANSWER Block elements begin on new lines whereas inline elements don't. Any other
valid difference receives full credit.
Which of the following are VALID variable names (will not cause an error during script
execution) in PHP? Circle the valid ones.
a. $age_55
b. $LOCATION
c. Area
d. window_position$ - ANSWER a. and b.
Name three PHP superglobals seen in class. - ANSWER $_GET, $_POST, $_COOKIE,
$_FILES, $_SERVER, $_ENV, $_REQUEST, $_SESSION
We have defined a PHP function as follows:
function process() { echo "hello"; }
Which of the following are VALID ways to call the function?
a. Process();
b. process();
c. PROcess();
d. None of the above. - ANSWER a., b., c.
Name two uses we saw in class for the header function. - ANSWER Redirection to a site
(e.g., header("Location:http://www.cs.umd.edu")) Authentication (to ask for a username
and password via a pop-up window)
Name one reason why you want to use post over get when submitting data to a server. -
ANSWER Security (password information will not be in the URL),
Amount of information to be sent is large,
The request changes the state of the server (e.g., adding or removing data from a
database)
Using the <img> tag define a image entry where the image name is myPhoto.jpg and the
message "Customer Photo" will appear when the image cannot be displayed. - ANSWER
<img src="myPhoto.jpg" alt="Customer Photo">
Define a CSS rule that associates the color blue with links that have not been visited. -
ANSWER a:visited {
color: purple;
}
What is the difference between an id selector and a class selector? - ANSWER Class
selector allow us to apply the same rules to many elements; an id selector allows to
apply rules to only one element. Another difference: class selectors are defined using #;
id selectors using a period.
Which of the following are considered false in PHP? Circle all that apply.
a. 0
b. "" (empty string)
c. false
d. 10
e. "0" - ANSWER a., b., c., e.
What is the difference between == and === while comparing objects? - ANSWER = = true
if two objects have same attributes and values and are instances of the same class; = = =
true if and ony if the two variables refer to the same object instance
Using PHP define a constant called MAX_LENGTH that has a value of 50. - ANSWER
define("MAX_LENGTH", 50);
What takes place when a file included using require_once is not found? - ANSWER A
fatal error will take place and the script will be terminated.
What is an empty variable? (PHP) - ANSWER a variable that has a value that evaluates to
false.
Name two differences that exits between echo and print. - ANSWER i. Print returns a
value; echo does not
ii. echo can print expressions separated by commas
, What is HTTP? - ANSWER Protocol that defines how user agents (e.g., browser) and web
server can communicate. Accept as valid Hypertext Transfer Protocol
Provide an example of what is possible by using server side includes. - ANSWER file
inclusion, timestamp for file modification, timestamp for local date / time or any other
valid one they may have provided.
In HTML what is the difference between an inline element and a block element? -
ANSWER Block elements begin on new lines whereas inline elements don't. Any other
valid difference receives full credit.
Which of the following are VALID variable names (will not cause an error during script
execution) in PHP? Circle the valid ones.
a. $age_55
b. $LOCATION
c. Area
d. window_position$ - ANSWER a. and b.
Name three PHP superglobals seen in class. - ANSWER $_GET, $_POST, $_COOKIE,
$_FILES, $_SERVER, $_ENV, $_REQUEST, $_SESSION
We have defined a PHP function as follows:
function process() { echo "hello"; }
Which of the following are VALID ways to call the function?
a. Process();
b. process();
c. PROcess();
d. None of the above. - ANSWER a., b., c.
Name two uses we saw in class for the header function. - ANSWER Redirection to a site
(e.g., header("Location:http://www.cs.umd.edu")) Authentication (to ask for a username
and password via a pop-up window)
Name one reason why you want to use post over get when submitting data to a server. -
ANSWER Security (password information will not be in the URL),
Amount of information to be sent is large,
The request changes the state of the server (e.g., adding or removing data from a
database)