SIA 402 — Reviewer for Midterm

  1. What does PHP stand for?
    PHP: Hypertext Preprocessor
  2. Which of the following tags is used to embed PHP code in an HTML document?
    <?php ?>
  3. What is the correct way to start a PHP script block?
    <?php
  4. Which of the following is used to display output in PHP?
    echo
  5. What is the PHP function to check the length of a string?
    strlen()
  6. In PHP, how do you define a constant?
    define()
  7. What is the default method for sending data to the server in an HTML form using PHP?
    GET
  8. Which of the following is not a valid PHP data type?
    char
  9. How can you comment out a single line in PHP?
    // Comment
  10. What is the operator used for concatenating two strings in PHP?
    . – Dot Symbol
  11. What is the function used to establish a database connection in PHP?
    mysqli_connect()
  12. Which superglobal variable in PHP is used to access form data sent with the GET method? -
    $_GET
  13. How can you prevent SQL injection in PHP?
    Use prepared statements
  14. Which PHP function is used to check if a file exists?
    file_exists()
  15. What is the purpose of the PHP function include()?
    To include a file in the current script
  16. Which of the following functions is used to remove leading and trailing white spaces from a string in PHP?
    trim()
  17. What is the purpose of the PHP session_start() function?
    To start a new session or resume the existing one
  18. Which PHP function is used to redirect a user to a different URL?
    header()
  19. What is the purpose of the empty() function in PHP?
    To check if a variable is empty or not set
  20. Which of the following is not a valid way to access an array element in PHP?
    $array(1)
  21. What is the correct way to start a PHP session?
    session_start()
  22. How do you define a function in PHP?
    functionmyFunction() {}
  23. Which of the following is a valid way to comment out multiple lines in PHP?
    /* This is a comment */
  24. What is the purpose of the header() function in PHP?
    To set HTTP headers for a response
  25. How do you declare an array in PHP?
    $array = array();
  26. What is the output of the following code?
    $x = 5;
    $y = 10;
    echo $x + $y;
    15
  27. How can you include an external PHP file in your script?
    require()
  28. What is the purpose of the var_dump() function in PHP?
    To output the value of a variable and its type
  29. Which function is used to remove a cookie in PHP?
    setcookie() with an expired time
  30. What does the $_SESSION superglobal variable store in PHP?
    Session data that can be shared across multiple pages
  31. What is the purpose of the die() function in PHP?
    Terminate a script and display an error message
  32. In PHP, which operator is used for strict equality comparison (including data type)?
    ===
  33. What is the purpose of the break statement in a PHP loop?
    Terminate the loop and exit it
  34. Which function is used to sort an array in descending order in PHP?
    arsort()
  35. What is the purpose of the continue statement in a PHP loop?
    Skip the current iteration and move to the next
  36. What is the correct way to declare a global variable in PHP?
    global $variable;
  37. How can you retrieve the number of elements in an array in PHP?
    count()
  38. What does the array_push() function do in PHP?
    Adds one or more elements to the end of an array
  39. Which of the following PHP superglobal variables is used to access session variables?
    $_SESSION
  40. What is the purpose of the array_merge() function in PHP?
    Create a new array by merging two or more arrays
  41. In PHP, what does the function json_encode() do?
    Encodes a PHP array into a JSON string
  42. Which PHP function is used to open a file for reading?
    fopen()
  43. What is the purpose of the unlink() function in PHP?
    Delete a file
  44. How do you declare a variable as a constant in PHP with a case-insensitive name?
    const()
  45. Which PHP function is used to format a number with thousands separators?
    number_format()
  46. What is the purpose of the file_get_contents() function in PHP?
    Read the contents of a file into a string
  47. In PHP, which operator is used for the modulus operation (finding the remainder of a
    division)?
    %
  48. What is the correct way to check if a variable is an array in PHP?
    is_array($variable)
  49. Which function is used to send an email in PHP?
    mail()
  50. What is the purpose of the mysqli_query() function in PHP?
    Execute a SQL query on a MySQL database
  51. What does HTML stand for?
    Hyper Text Markup Language
  52. Which HTML tag is used to create a hyperlink?
    <a>
  53. What is the primary purpose of CSS in web development?
    To style the presentation of web content
  54. Which programming language is commonly used for both front-end and back-end web
    development?
    JavaScript
  55. What does the acronym "HTTP" stand for in the context of web development?
    Hypertext Transfer Protocol
  56. What is the purpose of the HTML tag?
    To set metadata for a web page, such as character encoding and description
  57. Which CSS property is used to change the text color of an element?
    color
  58. What is the purpose of the HTML element?
    To create a container for input elements
  59. Which file extension is commonly used for Cascading Style Sheets?
    .css
  60. Which web development tool is often used for version control and collaborative coding?
    VCS (Version Control System)
  61. What does "SEO" stand for in web development?
    Search Engine Optimization
  62. Which HTML element is used for creating an ordered list?
    <ol>
  63. What is the purpose of the JavaScript function getElementById()?
    To retrieve an element from the DOM by its ID
  64. What is the primary purpose of the HTML element?
    To create a navigation bar or header section
  65. Which of the following is NOT a commonly used front-end framework/library for web
    development?
    Django
  66. What is a responsive web design?
    A design that adapts to different screen sizes and devices
  67. What is the purpose of the HTML element?
    To create a footer for a web page
  68. Which web development language is often used to create dynamic web pages and interact
    with databases?
    PHP
  69. What is a web developer's role in the context of front-end development?
    Creating the user interface and user experience
  70. What is the purpose of the CSS box model in web development?
    To specify the layout and spacing of elements on a web page
  71. Which HTML element is used to create an image in a web page?
    <img>
  72. In web development, what does "HTTP" stand for?
    Hypertext Transfer Protocol
  73. Which CSS property is used to set the size of text relative to its parent element?
    font-size
  74. What does the acronym "URL" stand for in web development?
    Uniform Resource Locator
  75. What is the purpose of the HTML element?
    To define navigation links within a document
  76. Which HTML element is used to create an unordered list?
    <ul>
  77. What is the purpose of the CSS property "margin"?
    To control the space outside of an element
  78. Which HTML element is used to create a paragraph of text?
    <p>
  79. What is the primary role of the HTML <table> element?
    To structure and display tabular data
  80. In web development, what is the purpose of the CSS property "padding"?
    To control the space inside of an element