Online Exam Quiz

questionQuestion  1 to 30

How do you generate a random number in PHP?

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

Which PHP function is used to get the length of a string?

  • strlen()
  • strlength()
  • string_length()
  • str_len()
Mark for review

Which of the following is the correct way to declare a PHP variable?

  • var $variable;
  • $variable;
  • declare $variable;
  • dim $variable;
Mark for review

What is the correct way to create a function in PHP?

  • function functionName() { }
  • create functionName() { }
  • define functionName() { }
  • make functionName() { }
Mark for review

How do you check if a variable is set in PHP?

  • isset($variable);
  • var_set($variable);
  • defined($variable);
  • is_set($variable);
Mark for review

Which operator is used to concatenate two strings in PHP?

  • +
  • .
  • &
  • CONCAT
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 function is used to format a number with grouped thousands?

  • number_format()
  • num_format()
  • format_number()
  • number_group_format()
Mark for review

How do you get the file extension of a file in PHP?

  • file_ext()
  • pathinfo()
  • get_extension()
  • file_extension()
Mark for review

Which function is used to start output buffering in PHP?

  • ob_start()
  • start_buffer()
  • buffer_start()
  • output_buffer_start()
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

Which of the following is not a valid PHP data type?

  • Integer
  • String
  • Float
  • Character
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

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

Which function is used to format a number with grouped thousands?

  • number_format()
  • num_format()
  • format_number()
  • number_group_format()
Mark for review

Which function is used to start output buffering in PHP?

  • ob_start()
  • start_buffer()
  • buffer_start()
  • output_buffer_start()
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 function is used to remove the last element from an array in PHP?

  • pop()
  • array_pop()
  • remove_last()
  • array_remove_last()
Mark for review

Which function is used to fetch a result row as an associative array?

  • mysql_fetch_array()
  • mysql_fetch_assoc()
  • mysql_fetch_row()
  • mysql_fetch_object()
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 decode JSON data in PHP?

  • json_decode()
  • json_unserialize()
  • decode_json()
  • unserialize_json()
Mark for review

How do you send an email using PHP?

  • mail()
  • send_mail()
  • email()
  • smtp_send()
Mark for review

How do you access a global variable inside a function in PHP?

  • global $variable;
  • $GLOBALS['variable'];
  • $global['variable'];
  • global_variable($variable);
Mark for review

Which function is used to redirect a user to another page in PHP?

  • redirect()
  • header("Location: url");
  • send_to("url");
  • move_to("url");
Mark for review

How do you create a MySQL database using PHP?

  • mysql_query("CREATE DATABASE dbname");
  • mysql_create_db("dbname");
  • mysql_database_create("dbname");
  • mysql_execute("CREATE DATABASE dbname");
Mark for review

What does PHP stand for?

  • Personal Home Page
  • Private Home Page
  • PHP: Hypertext Preprocessor
  • Professional Home Page
Mark for review

How do you create an array in PHP?

  • array[] = {1, 2, 3};
  • array(1, 2, 3);
  • new array(1, 2, 3);
  • create_array(1, 2, 3);
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

Which MySQL function is used to execute a query in PHP?

  • mysql_query()
  • mysql_execute()
  • mysql_run()
  • mysql_command()
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

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