WorksheetsPHP Basics Quiz
Total questions: 29
Worksheet time: 15mins
Which of the following is used to declare a variable in PHP?
$var_name
var var_name
@var_name
#var_name
Which symbol is used to concatenate strings in PHP?
+
&
.
#
What is the default extension of a PHP file?
.html
.xml
.php
.js
Which of the following is NOT a valid PHP data type?
Boolean
Integer
String
Real
Which method sends form data as part of the URL?
GET
POST
REQUEST
SUBMIT
Which of the following is used to include one PHP file into another?
add()
import()
include()
require_once()
Which PHP superglobal collects GET data?
$_FORM
$_POST
$_GET
$_REQUEST
Which method is more secure for sensitive data like passwords?
GET
POST
COOKIE
SERVER_METHOD
What attribute is required in the form tag to send data?
name
action
value
required
Which HTML input type sends the form?
type="reset"
type="text"
type="submit"
type="button"
How do you get a POST value in PHP?
$_POST['name']
$_GET['name']
$POST['name']
getPost('name')
Which is not a valid form method?
GET
POST
SEND
REQUEST
Which function starts a session in PHP?
begin_session()
start_session()
session_start()
init_session()
How do you store a session variable?
$_SESSION['user'] = "Ali";
$_SESSION = "Ali";
session['user'] = "Ali";
$SESSION['user'] = "Ali";
How can you delete all session variables?
session_end()
session_unset()
session_destruct()
unset_session()
What does CRUD stand for?
Create, Run, Update, Delete
Create, Read, Update, Delete
Create, Remove, Update, Drop
Create, Retrieve, Upload, Drop
Function to connect MySQL in PHP?
mysql_connect()
mysqli_connect()
db_connect()
connect_db()
SQL statement to insert data?
ADD
INSERT INTO
PUT INTO
CREATE
Execute query in PHP using MySQLi?
mysqli_query($conn, $sql)
mysql_query($sql)
execute_query($sql)
query_exec($conn, $sql)
Fetch result as associative array?
mysqli_fetch_array()
mysqli_fetch_row()
mysqli_fetch_assoc()
fetch_result()
Used to update records in DB?
UPDATE
CHANGE
MODIFY
SET
Used to delete a record?
REMOVE
DELETE
ERASE
DROP
Which is NOT a valid SQL command?
INSERT
SELECT
FETCH
DELETE
Count rows in a result set?
mysqli_num_rows()
count_rows()
get_rows()
row_count()
What does WHERE clause do?
Filters records
Sorts records
Joins tables
Groups records
What is required before using $_SESSION?
echo
include()
session_start()
session_init()
Function to destroy a session?
end_session()
session_destroy()
destroy_session()
remove_session()
Check if session variable is set?
isset($_SESSION['user'])
if($_SESSION)
session_exists('user')
$_SESSION->exists('user')
Correct syntax for a while loop in PHP?
while i < 10 { }
while (i < 10) { }
while ($i < 10) { }
loop while ($i < 10) { }
