Advanced PHP quiz part 1

--/10

Loading...

What happens if a user forgets to close an open MySQL connection within a PHP script?

  • The connection stays open and can be recycled by other processes
  • The web server runs into a timeout
  • PHP closes the connection when the script has ended
  • PHP throws an exception, it is mandatory that you close the connection

When should you start a session using session_start()?

  • Before any HTML output
  • At the end of the script to minimize resource usage
  • Right before accessing $_SESSION
  • No need to call the function, as PHP will do that automatically

PHP will automatically convert strings to numbers when it needs to.

  • False
  • True

Is it possible to pass data from PHP to JavaScript?

  • No, because PHP is server-side, and JavaScript is client-side.
  • No, because PHP is a loosely typed language.
  • Yes, because JavaScript executes before PHP.
  • Yes, because PHP can generate valid JavaScript

Is it possible to submit form without having submit button ?

  • Yes
  • No

When a form with a password field is submitted to the server, which data is sent for that field?

  • Its content, Base64-encoded
  • Its content, in clear text
  • The user is prompted to switch to SSL prior to form submit
  • Its content, hashed with SHA-1
  • Password fields are not sent to the server due to security reasons

Which of these file types should usually not be loaded into the page using readfile()?

  • HTML
  • CSS
  • PHP
  • JavaScript

 

Where is PHP code most commonly run?

  • Within the HTML interpreter
  • In a web browser
  • On a web server
  • In a database

 

Where is the actual session data stored?

  • In shared memory
  • In a cookie
  • On the client
  • On the server

 

Which attack can be avoided with mysqli_real_escape_string()?

  • Cross-Site Scripting
  • Replay Attack
  • SQL Injection
  • Cross-Site Request Forgery
You have scored out of 10 Questions.
;