Section 3: Scripting Languages

Section 3 Assessments

For each of these assignments, complete each step and submit all files (PHP, CSS, scripts, images, etc.) necessary by zipping and submitting your assignment folder.

Your First PHP

  1. Comment your name and assignment number at the top of the file.
  2. Create a variable that contains the current date and time.
  3. Create a constant that contains the assignment title.
  4. Make the assignment title the title of the page using the constant.
  5. Output the date and time.
  6. Output the PHP version, and server operating system (use system references).
  7. Display the following string as shown:
    • “Chicken finger subs are the best!” said Clyde.
    • “I agree”, said Bill, “but only when they are extra hot.”
  8. Calculate and display the following. Use variables for each value used in the equation:
    • 8 + 9 = 17
    • 24 % 8 = 0
    • 5 / 3 = 1.667

Forms and More

  1. Create a website which presents the user with a registration form for a subscription service. Your form should request the following information:
    • First, last name
    • Occupation
    • Email address
    • Mailing address
    • Phone
    • Job Title
  2. All information should be hidden (i.e., not be shown in the address bar).
  3. Name, email, and mailing address fields should be required.
  4. When completed, the form values are stored in a unique text file for each submission.
  5. The user should see a confirmation that their submission was received.

What Time Is It?

  1. Create an HTML page and complete the following with JavaScript only.
  2. Output the current date and time to the screen.
  3. Convert local time and date to UTC and display the result.
  4. Add a button to your page that updates these times.

Let’s Play A Game!

  1. Create a page with a 3 by 3 grid to represent a tic-tac-toe board.
  2. Using jQuery, assign an X or O (alternating back and forth) when a cell is clicked on.
  3. Include a button to reset the board after a game.
  4. Using canvas, put a colorful gradient of the words Tic-Tac-Toe at the top of the page.

Discussion / Written Response

  1. How are tags in XML different from tags in HTML?
  2. What is the difference between single and double quoted strings in PHP?
  3. What is the difference between server side and client side scripting? What are good situations to use each?
  4. What is the difference between GET and POST?
  5. Describe the difference between notice, warning, and critical error messages in PHP.
  6. Describe the difference between include, require, and require once.

Questions

      1. The array $array = (“One”=>1, “Two”=>2, “Three”=>3) is numeric.
        1. True
        2. False
      2. Which equation equates to 14?
        1. 4 + 5 2 – 4
        2. (4 + 5) 2 – 4
        3. 4 + 5 (2 – 4)
        4. 4 + (5 2) – 4
      3. The foreach() function in PHP is used when dealing with:
        1. Strings
        2. Arrays
        3. Objects
        4. Lists
      4. Which PHP reserved array holds values passed in the URL?
        1. $_POST
        2. $_GET
        3. $_SESSION
        4. None of these
      5. Which of the following is NOT a valid variable name?
        1. $variable
        2. $string
        3. $_string1
        4. $and-then
      6. Which of the following is an incorrect definition?
        1. Apache = Web Server
        2. PHP = Object oriented language
        3. MySQL = Database Server
        4. HTML = Operating System
      7. Which of the following PHP functions runs until a condition is met?
        1. foreach()
        2. while()
        3. during()
        4. None of these
      8. Declaring strings using single quotes means PHP syntax in the string will be shown.
        1. True
        2. False
      9. Which HTML element is used for JavaScript?
        1. <scripting>
        2. <javascript>
        3. <jscript>
        4. <script>
      10. Where can we place JavaScript?
        1. <head>
        2. <body>
        3. A & B
        4. None of these
      11. JavaScript and Java are the same thing.
        1. True
        2. False
      12. DOM stands for
        1. Document Object Model
        2. Document Oriented Media
        3. Document Object Manager
        4. None of these
      13. When a user views a page containing a JavaScript program, which machine actually executes the script?
        1. The user’s browser
        2. The Web server
        3. Both
        4. None of the above
      14. Which of the following cannot be done with JavaScript?
        1. Validating a form
        2. Sending a form’s contents by email
        3. Storing the form’s contents to a database file on the server
        4. None of the above
      15. Which of the following is not a valid JavaScript variable name?
        1. 1stname
        2. _firstName
        3. FirstName
        4. None of these
      16. What is the correct JavaScript syntax to write “Hello World”?
        1. System.out.println(“Hello World”)
        2. println (“Hello World”)
        3. document.write(“Hello World”)
        4. response.write(“Hello World”)
      17. jQuery uses CSS selectors to interact with page elements.
        1. True
        2. False
      18. In jQuery, $(‘div’) would select
        1. The first div element
        2. All div elements
        3. An element named div
      19. Which jQuery function makes sure the contained code only runs when the page is done loading?
        1. $(body).onload()
        2. $(document).loaded()
        3. $document.ready()
        4. None of these
      20. jQuery is an add-on library for JavaScript, not an independent language.
        1. True
        2. False

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Section 3 Assessments by Michael Mendez is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.