Font size
WorksheetsBuilding Web Applications in PHP
Total questions: 80
Worksheet time: 56mins
When a browser connects to a web server to retrieve a document, what is the default TCP/IP port that is used?
(a)
When a browser connects to a web server to retrieve a document, what command is sent to the server?
(a)
Which of the HTTP headers does the browser look at to decide how to display the retrieved document?
Format
Display-type
Content-type
Content-length
Location
What does the second "T" of HTTP stand for?
Transpose
Transfer
movemenT
Transport
Which of the following is NOT part of a Uniform Resource Locator?
Host
Operating System
Document
Protocol
Which HTML tags typically generate a request to retrieve a document?
a
b
img
h1
p and div
What standards organization publishes many of the documents that describe the protocols we use on the Internet?
IETF
Educause
IRR
RIA
6-Sigma
Which of the following is not a way to include CSS in an HTML page?
Directly on an HTML tag using the style= attribute
Using the <font> tag to enclose other tags
Using the <style> tag inline in the HTML document
External Style Sheet
Why is there more than one font listed in the following CSS rule?
body { font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; }
This is a syntax error, square braces [ ] should be used for the CSS rule
This is a syntax error, the rule should start with "font-name"
They are the preferred fonts for Windows, Mac, Linux, and "Other" systems
They are listed in descending preference order if fonts are not present in the browser
Which HTML tag does nothing to the text it surrounds and has as its sole purpose to create a "handle" so as to be able to apply CSS to the text?
(a)
Which CSS selector controls how a link (anchor tag) looks while the user mouses over the link (i.e. while hovering)?
(a)
Which of these CSS rules make text appear in a bold face font?
font-weight: bold
font-expand: 10%
font-style: bold
strong: yes
font-bold: on
What CSS selector would style a tag that looks like this:
1 < ... class="puppy">
%puppy { ...
.puppy { ...
_puppy { ...
puppy !important { ...
puppy { ...
What CSS rule allows you include a tag in markup but hide it from view in the browser?
visibility: hidden;
status: off;
font-size: -1px;
right: 0;
display: block;
Which of the following CSS selectors is between the content area and the border? (CSS box model)
edge
margin
padding
pixels
perimeter
What tag is used to import a style sheet into an HTML document?
(a)
What does PHP stand for?
Personal Hypertext Processor
Personal Home Page
Private Home Page
PHP: Hypertext Preprocessor
PHP Server scripts are surrounded by?
<&>...</&>
<?php ... ?>
<script>...</script>
<?php>...</?>
The PHP syntax is most similar to:
Perl and C
VBScript
JavaScript
Fortran
What is the output of the following?
1 $x = 12;
2 $y = 12 + $x++;
3 echo "y = $y x = $x";
y = $y x = $x
y = 25 x = 13
y = 24 x = 13
y = 24 x = 12
Which of the following are operators in PHP?
_:
===
++
__
!=
What value will var_dump show that echo will not show?
(a)
What is a correct way to add a comment in PHP?
/* ... */
\..\
<!-- ... --\>
<comment> ... </comment>
All variables in PHP start with [ (a) ] symbol.
What is the value returned by: (int) 9.9 - 1
(a)
Use the [ (a) ] operator to test if two values are identical in both value and type.
What is the value of $x?
$x = 1200 + "34";
(a)
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings.
True
False
PHP and HTML cannot be intermingled in the same file.
True
False
You cannot run PHP files from the command line.
True
False
You can run PHP files on a server.
True
False
In PHP, variable names are case sensitive.
True
False
In PHP, functions names are not case sensitive.
True
False
Which escape sequences can be used in single quoted ( ' ) strings in PHP?
\r
\n
\'
\"
\\
In PHP arrays can either be key / value (i.e. an associative array) or indexed by integers (i.e. a linear array).
True
False
Which symbol is used to associate a key to a value in an associative array?
->
>>
==
=>
Fill in the blank to echo 'Arrays'
$stuff = array('course ' => 'PHP-Intro', 'topic' => 'Arrays');
echo ________;
$stuff['Arrays']
$stuff['course']
$stuff[1]
$stuff['topic']
What is the output of
$stuff = array('course' => 'PHP-Intro', 'topic' => 'Arrays');
echo isset($stuff['section']);
1
False
There is no output
True
0
In PHP you cannot make an array of associative arrays.
True
False
The [ (a) ] function is used to rearrange an array in random order.
Which of these are built-in sorting functions provided by PHP?
sort()
ksort()
isort()
asort()
What function is used to sort the array in alphabetical order of the keys?
(a)
What function is used to sort the values in array and keep the keys intact?
(a)
What function can be used to split a string into an array words based on a delimiter? For instance, create a three element array from the string 'I am great!!!'.
(a)
var_dump will display the name, key/value pairs, and data types of a variable.
True
False
Why should you use functions?
To make it harder for others to use your code
Organize your code
Avoid repetitive code
Break complex code into logical chunks
Which keyword defines a new function?
function
define
new functions
new
Return values are type-specific in php functions (a function only returns a value of a specified data type.)
True
False
What output does the following code produce?
function double($val){ $val = $val * 2; return $val; } $val = 15; $dval = double($val); echo "Value = $val Doubled = $dval";
Value = 30 Doubled = 30
Value = 15 Doubled = 15
Value = Doubled =
Value = 15 Doubled = 30
Which keyword is used to use code from one php file into a different PHP file?
include
point
add
append
Which function prints out the internal configuration capabilities of your particular PHP installation?
version()
phpinfo()
phpver()
info()
Adding an ampersand ( & ) to a function parameter indicates that you are using call by [ (a) ] for that parameter.
The keyword [ (a) ] will expand the scope of a variable outside of its function.
The [ (a) ] function is used to check if a function already exists or not.
It is common to use uppercase and/or long names for global variables to avoid confusion or mistaken reuse.
True
False
A properly formatted form element will always include an action attribute.
True
False
Web crawlers follow anchor tags <a href=".... and may even fill in forms with a method of GET, but will never submit a form with a method= attribute of [ (a) ].
Within PHP the [ (a) ] array merges $_GET and $_POST data.
It is good practice for a web application to change data on a GET request.
True
False
The [ (a) ] attribute of an text input field will set a default value for the field.
The function htmlentities will transform an ampersand character ( & ) into
(a)
The input type [ (a) ] will display your form input as dots.
To connect the behavior of multiple radio buttons (e.g. to make sure that only one is "on" at the same time), make sure to give each radio button the same [ (a) ] attribute.
To set a checkbox as checked by default, use the [ (a) ] attribute.
To set a default option in a drop-down list, use the [ (a) ] attribute.
All browsers treat unknown input types as type= [ (a) ] "
In HTML5, the email input type doesn't validate the value until you press
(a)
Post data is appended to the URL
True
False
In a PHP script, it is generally a good idea to process any incoming POST data before you produce page output.
True
False
"View Page Source" allows you to see the HTML code.
True
False
"View Page Source" allows you to see the PHP code.
True
False
"View Page Source" allows you to see the output of the PHP code.
True
False
What is true about the following HTML?
<a href="http://www.dr-chuck.com/page2.htm">Second Page</a>
The reference is an absolute reference
The reference is a relative reference
The text "second page" is improperly placed and will not be seen
The HTML is improperly formed and there will be a syntax error
What do you put at the beginning of an HTML file to inform the browser which variant of HTML you will be using in this document?
<html>
<body>
DOCTYPE
<?xml version>
<xs:sequence> and <meta type>
What is the name of the tag that is used in a document's <head> area to set the text shown in the tab of the browser or title bar?
(a)
In HTML, what attribute is used to indicate text that will be shown if an image is not loaded or read to a user that is using a screen reader?
(a)
For the following HTML:
<img src="csev_ian_dolphin_small.jpg" alt="Photo Credit: Ian Dolphin" width="160" align="middle">
What is an example of an "attribute"?
http://
a
src
Second Page
/a
How do you show a less-than (<) in an an HTML page?
<less-than>
<
<<<
//less-than
<!-- < -->
What does the <ul> tag accomplish?
Indicates that a sequence of HTML is certified to be safe
Reduces the space between lines (leading)
Begins an unordered list
Enables upper-lower text
In a table, what is the general order of tags from outer to inner when constructing a table?
t
<table> <td> <table> <tr> <table>
<table> <row> <column>
<td> <tr> <table>
<table> <td> <tr>
<table> <tr> <td>
