Online Exam Quiz

questionQuestion  1 to 30

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 is the correct way to start a session in PHP?

  • session_start();
  • start_session();
  • begin_session();
  • session_begin();
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

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

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 of the following is a way to end a script execution in PHP?

  • stop();
  • break;
  • end;
  • die();
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

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

Which SQL statement is used to extract data from a database?

  • GET
  • OPEN
  • SELECT
  • EXTRACT
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 write "Hello World" in PHP?

  • echo "Hello World";
  • print("Hello World");
  • document.write("Hello World");
  • printf("Hello World");
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

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 check if a variable is set in PHP?

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

How do you end a session in PHP?

  • session_end();
  • session_destroy();
  • end_session();
  • session_unset();
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 close a MySQL connection in PHP?

  • mysql_end()
  • mysql_close()
  • close_mysql()
  • mysql_disconnect()
Mark for review

Which function is used to replace a substring in PHP?

  • replace()
  • substr_replace()
  • str_replace()
  • string_replace()
Mark for review

Which function is used to open a file in PHP?

  • open()
  • fopen()
  • file_open()
  • file()
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

How do you decode JSON data in PHP?

  • json_decode()
  • json_unserialize()
  • decode_json()
  • unserialize_json()
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

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 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 remove whitespaces from the beginning and end of a string?

  • trim()
  • strip()
  • ltrim()
  • rtrim()
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

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

  • number_format()
  • num_format()
  • format_number()
  • number_group_format()
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

What is the default file extension for PHP files?

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

Which function is used to replace a substring in PHP?

  • replace()
  • substr_replace()
  • str_replace()
  • string_replace()
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