Online Exam Quiz

questionQuestion  1 to 30

How do you write "Hello World" in PHP?

  • echo "Hello World";
  • print("Hello World");
  • document.write("Hello World");
  • printf("Hello World");
Mark for review

How do you write "Hello World" in PHP?

  • echo "Hello World";
  • print("Hello World");
  • document.write("Hello World");
  • printf("Hello World");
Mark for review

Which function is used to read a file into an array?

  • file()
  • read_file()
  • file_read()
  • array_file()
Mark for review

What is the correct way to include a file in PHP?

  • include "file.php";
  • require_once("file.php");
  • include_file("file.php");
  • load_file("file.php");
Mark for review

How do you insert a comment in PHP code?

  • /* This is a comment */
  • // This is a comment
  • <!-- This is a comment -->
  • # This is a comment
Mark for review

How do you define a constant in PHP?

  • define("CONSTANT", "value");
  • constant("CONSTANT", "value");
  • set_constant("CONSTANT", "value");
  • define_constant("CONSTANT", "value");
Mark for review

What is the correct way to check if a variable is an array in PHP?

  • is_array($variable);
  • check_array($variable);
  • array_check($variable);
  • is_arr($variable);
Mark for review

How do you end a session in PHP?

  • session_end();
  • session_destroy();
  • end_session();
  • session_unset();
Mark for review

Which function is used to check if a file exists in PHP?

  • file_exist()
  • file_exists()
  • is_file_exist()
  • does_file_exist()
Mark for review

How do you create a cookie in PHP?

  • setcookie("name", "value", time()+3600);
  • cookie_create("name", "value", time()+3600);
  • create_cookie("name", "value", time()+3600);
  • add_cookie("name", "value", time()+3600);
Mark for review

Which operator is used to concatenate two strings in PHP?

  • +
  • .
  • &
  • CONCAT
Mark for review

What is the default file extension for PHP files?

  • .ph
  • .php
  • .phtml
  • .php3
Mark for review

How do you check if a file is readable in PHP?

  • is_readable($file);
  • readable($file);
  • file_readable($file);
  • check_readable($file);
Mark for review

What is the correct way to connect to a MySQL database in PHP?

  • mysql_connect("hostname", "username", "pwd");
  • connect("hostname", "username", "pwd");
  • mysql_open("hostname", "username", "pwd");
  • mysql("hostname", "username", "pwd");
Mark for review

How do you check if a file is readable in PHP?

  • is_readable($file);
  • readable($file);
  • file_readable($file);
  • check_readable($file);
Mark for review

Which function is used to read a file into an array?

  • file()
  • read_file()
  • file_read()
  • array_file()
Mark for review

How do you get the last inserted ID in MySQL using PHP?

  • mysql_insert_id()
  • mysql_last_id()
  • mysql_get_id()
  • mysql_last_insert_id()
Mark for review

Which method is used to retrieve data from a form using the GET method?

  • $_POST[]
  • $_REQUEST[]
  • $_GET[]
  • $_FORM[]
Mark for review

Which operator is used to concatenate two strings in PHP?

  • +
  • .
  • &
  • CONCAT
Mark for review

Which of the following is not a valid variable name in PHP?

  • $var_name
  • $varName
  • $var-name
  • $varName2
Mark for review

What does PEAR stand for in PHP?

  • PHP Extension and Application Repository
  • PHP Event and Application Repository
  • PHP Extension and Application Resource
  • PHP Event and Application Resource
Mark for review

How do you generate a random number in PHP?

  • rand()
  • random()
  • generate_random()
  • randomize()
Mark for review

What is the correct way to get the length of an array in PHP?

  • count($array);
  • array_length($array);
  • sizeof($array);
  • length($array);
Mark for review

What does PEAR stand for in PHP?

  • PHP Extension and Application Repository
  • PHP Event and Application Repository
  • PHP Extension and Application Resource
  • PHP Event and Application Resource
Mark for review

How do you define a constant in PHP?

  • define("CONSTANT", "value");
  • constant("CONSTANT", "value");
  • set_constant("CONSTANT", "value");
  • define_constant("CONSTANT", "value");
Mark for review

Which of the following is used to encrypt passwords in PHP?

  • crypt()
  • md5()
  • password_hash()
  • hash()
Mark for review

How do you create a loop in PHP?

  • for loop
  • while loop
  • do loop
  • foreach loop
Mark for review

What is the correct way to start a session in PHP?

  • session_start();
  • start_session();
  • begin_session();
  • session_begin();
Mark for review

How do you create a loop in PHP?

  • for loop
  • while loop
  • do loop
  • foreach loop
Mark for review

What is the correct way to check if a variable is an array in PHP?

  • is_array($variable);
  • check_array($variable);
  • array_check($variable);
  • is_arr($variable);
Mark for review

blinkerOnline

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • Answered
  • Not Answered
  • Marked for Review