
Mastering PHP Fundamentals

Quiz
•
Computers
•
12th Grade
•
Hard
B Prabhu Shankar VelTech
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is the correct way to start a PHP block?
php<?
>?php
<?php
<php>
2.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
Which of the following is a valid variable name in PHP?
$1var
$var1
var-name
var@123
3.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
How do you connect to a MySQL database using PHP?
Connect using PDO with new PDO('mysql:host=host;dbname=database', 'username', 'password');
Use pg_connect('host', 'username', 'password', 'database');
Use mysqli_connect('host', 'username', 'password', 'database') or die('Connection failed: ' . mysqli_connect_error());
Use mysql_connect('host', 'username', 'password');
4.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What function is used to execute a SQL query in PHP?
mysqli_query() or PDOStatement::execute()
execute_query()
db_query()
run_sql()
5.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
How can you retrieve data from a form using the POST method in PHP?
Use the $_POST superglobal array to access form data.
Retrieve data using the $_REQUEST array only.
Data cannot be retrieved from a form using the POST method.
Use the $_GET superglobal array to access form data.
6.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
What is the purpose of PHP sessions?
To enhance the speed of PHP execution.
To execute PHP scripts on the server side.
The purpose of PHP sessions is to maintain state and store user data across multiple pages.
To store files on the server permanently.
7.
MULTIPLE CHOICE QUESTION
10 sec • 1 pt
How do you set a cookie in PHP?
setcookie('name', 'value');
setcookie('cookie_name', 'cookie_value', time() + 3600, '/');
setcookie('name', 'value', time() - 3600, '/');
setcookie('name', 'value', 0, '/');
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Operator dan Kontrol Struktur PHP

Quiz
•
2nd Grade - University
10 questions
QUIZ PEMOGRAMAN WEB

Quiz
•
11th Grade - University
10 questions
Technical Terms - Internet (A-Z) - IIS

Quiz
•
12th Grade
8 questions
CMS Web Servers

Quiz
•
12th Grade
7 questions
Keterampilan Web Programming

Quiz
•
12th Grade
10 questions
Technical Terms - Internet (A-Z) - Webpages

Quiz
•
12th Grade
15 questions
Servidores Web y Bases de Datos

Quiz
•
12th Grade
8 questions
12th comp app lesson 9

Quiz
•
12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade