Book Appointment Now

Building Web Applications in PHP Coursera Quiz Answers

Building Web Applications in PHP Week 01 Quiz Answers

Quiz: Request-Response

Q1. When a browser connects to a webserver to retrieve a document, what is the default TCP/IP port that is used?

  • 80

Q2. When a browser connects to a webserver to retrieve a document, what command is sent to the server?

  • GET

Q3. Which of the HTTP headers does the browser look at to decide how to display the retrieved document?

  • Format
  • ETAG
  • Content-length
  • Content-type
  • Display-type
  • Location

Q4. What does the second “T” of HTTP stand for?

  • Transpose
  • Transfer
  • movemenT
  • Transport

Q5. Which of the following is NOT part of a Uniform Resource Locator?

  • Protocol
  • Host
  • Operating System
  • Document

Q6. Which HTML tags typically generate a request to retrieve a document?

  • a
  • b
  • img
  • h1
  • p
  • div

Q7. What standards organization publishes many of the documents that describe the protocols we use on the Internet?

  • Educause
  • RIA
  • IETF
  • IRR
  • 6-Sigma

Building Web Applications in PHP Week 02 Quiz Answers

Quiz: HTML

Q1. What is true about the following HTML?

<a href="http://www.dr-chuck.com/page2.htm">Second Page</a> 
  • The reference is a relative reference
  • The HTML is improperly formed and there will be a syntax error
  • The reference is an absolute reference
  • The text “second page” is improperly placed and will not be seen

Q2. 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?

  • DOCTYPE
  • <meta type>
  • <html>
  • <xs:sequence>
  • <?xml version>
  • <body>

Q3. 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?

  • TITLE

Q4. 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?

  • ALT

Q5. 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”?

  • a
  • src
  • /a
  • Second Page
  • http://

Q6. How do you show a less-than (<) in an an HTML page?

  • <less-than>
  • <<<
  • <!– < –>
  • &lt;
  • //less-than

Q7. What does the <ul> tag accomplish?

  • Indicates that a sequence of HTML is certified to be safe
  • Reduces the space between lines (leading)
  • Enables upper-lower text
  • Begins an unordered list

Q8. In a table, what is the general order of tags from outer to inner when constructing a table?

  • <td> <tr> <table>
  • <table> <row> <column>
  • <table> <tr> <td>
  • <table> <td> <table> <tr> <table>
  • <table> <td> <tr>

Building Web Applications in PHP Week 03 Quiz Answers

Quiz: CSS

Q1. Which of the following is not a way to include CSS in an HTML page?

  • External Style Sheet
  • Directly on an HTML tag using the style= attribute
  • Using the <style> tag inline in the HTML document
  • Using the <font> tag to enclose other tags

Q2. 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?

  • SPAN

Q3. Why is there more than one font listed in the following CSS rule?

body { font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; }
  • They are listed in descending preference order if fonts are not present in the browser
  • This is a syntax error, the rule should start with “font-name”
  • They are the preferred fonts for Windows, Mac, Linux, and “Other” systems
  • This is a syntax error, square braces [ ] should be used for the CSS rule

Q4. Which CSS selector controls how a link (anchor tag) looks while the user mouses over the link (i.e. while hovering)?

  • HOVER

Q5. Which of these CSS rules make text appear in a bold face font?

  • strong: yes
  • font-expand: 10%
  • font-weight: bold
  • font-style: bold
  • font-bold: on

Q6. What CSS selector would style a tag that looks like this:

< ... class="puppy">
  • puppy { …
  • puppy !important { …
  • _puppy { …
  • %puppy { …
  • .puppy { …

Q7. What CSS rule allows you include a tag in markup but hide it from view in the browser?

  • status: off;
  • visibility: hidden;
  • right: 0;
  • font-size: -1px;
  • display: block;

Q8. Which of the following CSS selectors is between the content area and the border? (CSS box model)

  • margin
  • padding
  • perimeter
  • pixels
  • edge

Q9. What tag is used to import a style sheet into an HTML document?

  • LINK

Building Web Applications in PHP Week 05 Quiz Answers

Quiz: PHP

Q1. What does PHP stand for?

  • Private Home Page
  • Personal Hypertext Processor
  • Personal Home Page
  • PHP: Hypertext Preprocessor

Q2. PHP Server scripts are surrounded by?

  • <?php … ?>
  • <&>…</&>
  • <script>…</script>
  • <?php>…</?>

Q3. The PHP syntax is most similar to:

  • Perl and C
  • VBScript
  • JavaScript
  • Fortran

Q4. Which of the following are operators in PHP?

  • !=
  • ++
  • __
  • ===
  • .+
  • _:

Q5. What is the output of the following?123 $x = 12; $y = 12 + $x++; echo "y = $y x = $x";

  • y = 24 x = 12
  • y = $y x = $x
  • y = 24 x = 13
  • y = 25 x = 13

Q6. What value will var_dump show that echo will not show?

  • structures

Q7. What is a correct way to add a comment in PHP?

  • <comment> … </comment>
  • *\..\*
  • <!– … –\>
  • /* … */

Q8. All variables in PHP start with [_________] symbol.

  • $

Q9. What is the value returned by: (int) 9.9 – 1

  • 8

Q10. Use the [_____] operator to test if two values are identical in both value and type.

  • ===

Q11. What is the value of $x?

$x = 1200 + "34";
  • 1234

Q12. In PHP you can use both single quotes ( ‘ ‘ ) and double quotes ( ” ” ) for strings.

  • True
  • False

Q13. PHP and HTML cannot be intermingled in the same file.

  • True
  • False

Q14. Which escape sequences can be used in single quoted ( ‘ ) strings in PHP?

  • \’
  • \\
  • \n
  • \r
  • \”

Q15. You cannot run PHP files from the command line.

  • True
  • False

16. You can run PHP files on a server.

  • True
  • False

Q17. In PHP, variable names are case sensitive.

  • True
  • False

Q18. In PHP, functions names are not case sensitive.

  • True
  • False

Building Web Applications in PHP Week 06 Quiz Answers

Quiz: PHP Arrays

Q1. In PHP arrays can either be key / value (i.e. an associative array) or indexed by integers (i.e. a linear array).

  • True
  • False

Q2. Which symbol is used to associate a key to a value in an associative array?

  • ->
  • =>
  • >>
  • ==

Q3. Fill in the blank to echo ‘Arrays’

$stuff = array('course ' => 'PHP-Intro', 'topic' => 'Arrays');
echo ________;
  • $stuff[‘Arrays’]
  • $stuff[‘course’]
  • $stuff[1]
  • $stuff[‘topic’]

Q4. What is the output of

$stuff = array('course' => 'PHP-Intro', 'topic' => 'Arrays');echo isset($stuff['section']);
  • False
  • 0
  • True
  • There is no output
  • 1

Q5. In PHP you cannot make an array of associative arrays.

  • True
  • False

Q6. The [_____] function is used to rearrange an array in random order.

  • ->SHUFFLE()

Q7. Which of these are built-in sorting functions provided by PHP?

  • isort()
  • asort()
  • sort()
  • ksort()

Q8. What function is used to sort the array in alphabetical order of the keys?

  • ->ksort()

Q9. What function is used to sort the values in array and keep the keys intact?

  • asort()
  • Q10. 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!!!’.

    • ->explode()

    Q11. var_dump will display the name, key/value pairs, and data types of a variable.

    • True
    • False

    Building Web Applications in PHP Week 07 Quiz Answers

    Quiz: Functions

    Q1. Why should you use functions?

    • Break complex code into logical chunks
    • Organize your code
    • Avoid repetitive code
    • To make it harder for others to use your code

    Q2. Which keyword defines a new function?

    • new functions
    • new
    • define
    • function

    Q3. Return values are type-specific in php functions (a function only returns a value of a specified data type.)

    • True
    • False

    Q4. 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 = Doubled =
    • Value = 30 Doubled = 30
    • Value = 15 Doubled = 30
    • Value = 15 Doubled = 15

    Q5. Which keyword is used to use code from one php file into a different PHP file?

    • point
    • include
    • append
    • add

    Q6. Which function prints out the internal configuration capabilities of your particular PHP installation?

    • phpinfo()
    • version()
    • info()
    • phpver()

    Q7. Adding an ampersand ( & ) to a function parameter indicates that you are using call by [_____] for that parameter.

    • reference

    Q8. The keyword [_____] will expand the scope of a variable outside of its function.

    • global

    Q9. The [_____] function is used to check if a function already exists or not.

    • function_exists()

    Q10. It is common to use uppercase and/or long names for global variables to avoid confusion or mistaken reuse.

    • True
    • False

    Building Web Applications in PHP Week 08 Quiz Answers

    Quiz: Forms

    Q1. A properly formatted form element will always include an action attribute.

    • True
    • False

    Q2. 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 [_____].

    • POST

    Q3. Within PHP the [_____] array merges $_GET and $_POST data.

    • array_merge

    Q4. It is good practice for a web application to change data on a GET request.

    • True
    • False

    Q5. The [_____] attribute of an text input field will set a default value for the field.

    • value

    Q6. The function htmlentities will transform an ampersand character ( & ) into

    • &amp;

    Q7. The input type [_____] will display your form input as dots.

    • password

    Q8. 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 [_____] attribute.

    • name

    Q9. To set a checkbox as checked by default, use the [_____] attribute.

    • checked

    Q10. To set a default option in a drop-down list, use the [_____] attribute.

    • selected

    Q11. All browsers treat unknown input types as type= [_____] “

    • text

    Q12. In HTML5, the email input type doesn’t validate the value until you press

    • submit

    Q13. Post data is appended to the URL.

    • True
    • False

    Q14. In a PHP script, it is generally a good idea to process any incoming POST data before you produce page output.

    • True
    • False

    Q15. “View Page Source” allows you to see the HTML code.

    • True
    • False

    Q16. “View Page Source” allows you to see the PHP code.

    • True
    • False

    Q17. “View Page Source” allows you to see the output of the PHP code.

    • True
    • False
    Get All Course Quiz Answers of Web Applications for Everybody’s Specialization

    Building Web Applications in PHP Coursera Quiz Answers

    Introduction to Structured Query Language (SQL) Quiz Answers

    Building Database Applications in PHP Coursera Quiz Answers

    JavaScript, jQuery, and JSON Coursera Quiz Answers

    Share your love

    Newsletter Updates

    Enter your email address below and subscribe to our newsletter

    Leave a Reply

    Your email address will not be published. Required fields are marked *