1/69
Flashcards for reviewing PHP and MySQL concepts for the ICT exam.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
1. What does PHP stand for?
A. Personal Home Page
B. Preprocessed Hypertext Page C. Hypertext Preprocessor
D. Programming HTML Pages
Hypertext Preprocessor
2. Which of the following is an example of a dynamic web page?
A. A webpage showing the same content every time B. A static HTML file with images
C. A webpage showing current weather data
D. A PDF document
A webpage showing current weather data.
3. What is the main purpose of XAMPP?
A. To design web graphics
B. To create static websites
C. To convert the PC to a local server
D. To write JavaScript
To convert the PC to a local server
4. Which one is NOT part of the XAMPP setup process?
A. Downloading XAMPP
B. Installing and launching XAMPP
C. Starting Apache and MySQL
D. Uploading code to a live server
Uploading code to a live server
5. Where should you save your PHP files for XAMPP to run them?
A. Desktop folder
B. Notepad++ directory
C. htdocs folder inside the XAMPP installation
D. Downloads folder
htdocs folder inside the XAMPP installation
6. What is the correct way to write a simple PHP echo statement?
A. <php echo “Welcome”;>
B. <?php echo "Welcome back to PHP!"; ?> C. <? echo "Welcome!"; >
D. <script>echo "Welcome";</script>
<?php echo “Welcome back to PHP!”;?>
7. In the script $name = "John";, what type of data is stored in $name?
A. Integer B. Float
C. String D. Boolean
String
8. What does the echo command do in PHP?
A. Reads input from the user
B. Stores data into a file
C. Displays output on the web page D. Terminates the script
Displays output on the web page
9. Which operator is used to join strings and variables in PHP?
A. +
B. &
C. . (dot) D. *
.(dot)
What happens if you remove the semicolon at the end of a PHP statement?
An error will occur
In PHP, what symbol is used to start a variable name?
$
What is the data type of the variable $name = "John";?
String
What is the data type of the variable $age = 30;?
Integer
What function in PHP can be used to find out the data type of a variable?
gettype()
What does the data type Boolean represent in PHP?
TRUE or FALSE values
Which of the following is the correct description of the modulus operator (%) in PHP?
Finds the remainder of a division
What will be the result of this PHP expression: 15 % 5?
0
In the code $sum = $a + $b;, what does $sum store?
The sum of $a and $b
If $a = 20 and $b = 5, what will be the output of $quotient = $a / $b;?
5
Which PHP data type is used to store multiple values in a single variable?
Array
What is the main purpose of conditional statements in PHP?
To make decisions in code based on conditions
Which of the following is NOT a conditional statement in PHP?
while
What does the comparison operator == check in PHP?
If values are equal regardless of type
Which operator checks if both value and type are the same?
===
What will the following code display if $grade = 9? if($grade >= 10){ echo "the student passed"; }else{ echo "the student failed"; }
the student failed
What is the purpose of the else statement in PHP?
To run code if the if condition is false
Which of these will return TRUE if the left value is greater than the right?
>
What will the following code display if $t = 15? if($t < 10){ echo "Have a good morning!"; }elseif($t < 20){ echo "Have a good day!"; }else{ echo "Have a good night!"; }
Have a good day!
Which keyword allows checking multiple conditions in an if-else structure?
elseif
If $t = 25, what will the output be for the same script above?
Have a good night!
What tag indicates the start of an HTML document?
<html>
Which attribute of the
action
What does setting the form method to "post" do?
Hides the data in the request
Which HTML tag is used to create input fields for users?
<input>
What does the name attribute in an tag do?
Identifies the data in the PHP file
What is the correct PHP syntax to begin and end a script?
<?php … ?>
Which PHP variable is used to retrieve data sent using the POST method?
$_POST
What does the type="submit" do in an element?
Sends the form data
Which of the following types is used to allow users to choose a date?
date
What happens after the form is submitted and processed by PHP?
The browser redirects to a PHP file
What is the first step in creating a simple HTML form?
Start with the <html> tag
Where is the metadata placed in an HTML document?
Inside the <head> tag
What is the purpose of the action attribute in the
To tell the form where to send the data
What does the method="post" attribute in the form do?
Sends the data hidden inside the request
Which input type should be used to allow users to select a date?
date
What is the correct PHP tag syntax to start a script?
<?php ?>
What PHP variable is used to access form data sent by POST?
$_POST
Which HTML input type is used to send the form data?
submit
What does the echo command in PHP do?
Displays data on the screen
Where should both htmlform.html and process.php files be saved?
htdocs directory
What is MySQL primarily used for?
Storing, retrieving, and managing data
Which of the following is true about online databases?
They are good for real-time data access
What tool helps manage MySQL databases in XAMPP?
phpMyAdmin
What two services must be started in XAMPP to use phpMyAdmin?
Apache and MySQL
In a MySQL table, each row represents:
A single student or record
What data type should you use to store a student’s age?
INT
Which data type is ideal for storing paragraphs or article descriptions?
TEXT
The data type FLOAT is most useful for:
Storing decimal numbers or currency
What is an example of a value stored using the DATE data type?
2005-06-12
Which of the following allows setting a maximum character limit like 100 characters?
VARCHAR
What SQL command is used to change data in an existing table?
UPDATE
Which SQL keyword is used to assign new values to columns during an update?
SET
What clause should always be used with the UPDATE statement to avoid changing all records?
WHERE
What will the command UPDATE students SET Name='Tom' WHERE ID=1; do?
Change the name of the student with ID 1 to Tom
How can you update multiple columns in a single row?
By separating columns with commas in the SET clause
Which SQL statement is correct for updating two columns for students under age 18?
UPDATE students SET Name='Ray', Age=21 WHERE Age<18;
What SQL command is used to remove one or more rows from a table?
DELETE
Why is it important to use the WHERE clause with DELETE statements?
To avoid deleting all records
What happens if you run DELETE FROM students WHERE ID=3;?
It deletes the student with ID 3
What is a possible consequence of running UPDATE or DELETE without caution?
Data can be printed incorrectly