ICT Exam Review - PHP and MySQL

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/69

flashcard set

Earn XP

Description and Tags

Flashcards for reviewing PHP and MySQL concepts for the ICT exam.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

70 Terms

1
New cards

1. What does PHP stand for?

A. Personal Home Page

B. Preprocessed Hypertext Page C. Hypertext Preprocessor

D. Programming HTML Pages

Hypertext Preprocessor

2
New cards

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
New cards

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
New cards

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
New cards

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
New cards

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
New cards

7. In the script $name = "John";, what type of data is stored in $name?

A. Integer B. Float

C. String D. Boolean

String

8
New cards

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
New cards

9. Which operator is used to join strings and variables in PHP?

A. +

B. &

C. . (dot) D. *

.(dot)

10
New cards

What happens if you remove the semicolon at the end of a PHP statement?

An error will occur

11
New cards

In PHP, what symbol is used to start a variable name?

$

12
New cards

What is the data type of the variable $name = "John";?

String

13
New cards

What is the data type of the variable $age = 30;?

Integer

14
New cards

What function in PHP can be used to find out the data type of a variable?

gettype()

15
New cards

What does the data type Boolean represent in PHP?

TRUE or FALSE values

16
New cards

Which of the following is the correct description of the modulus operator (%) in PHP?

Finds the remainder of a division

17
New cards

What will be the result of this PHP expression: 15 % 5?

0

18
New cards

In the code $sum = $a + $b;, what does $sum store?

The sum of $a and $b

19
New cards

If $a = 20 and $b = 5, what will be the output of $quotient = $a / $b;?

5

20
New cards

Which PHP data type is used to store multiple values in a single variable?

Array

21
New cards

What is the main purpose of conditional statements in PHP?

To make decisions in code based on conditions

22
New cards

Which of the following is NOT a conditional statement in PHP?

while

23
New cards

What does the comparison operator == check in PHP?

If values are equal regardless of type

24
New cards

Which operator checks if both value and type are the same?

===

25
New cards

What will the following code display if $grade = 9? if($grade >= 10){ echo "the student passed"; }else{ echo "the student failed"; }

the student failed

26
New cards

What is the purpose of the else statement in PHP?

To run code if the if condition is false

27
New cards

Which of these will return TRUE if the left value is greater than the right?

>

28
New cards

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!

29
New cards

Which keyword allows checking multiple conditions in an if-else structure?

elseif

30
New cards

If $t = 25, what will the output be for the same script above?

Have a good night!

31
New cards

What tag indicates the start of an HTML document?

<html>

32
New cards

Which attribute of the

tag specifies where to send the form data?

action

33
New cards

What does setting the form method to "post" do?

Hides the data in the request

34
New cards

Which HTML tag is used to create input fields for users?

<input>

35
New cards

What does the name attribute in an tag do?

Identifies the data in the PHP file

36
New cards

What is the correct PHP syntax to begin and end a script?

<?php … ?>

37
New cards

Which PHP variable is used to retrieve data sent using the POST method?

$_POST

38
New cards

What does the type="submit" do in an element?

Sends the form data

39
New cards

Which of the following types is used to allow users to choose a date?

date

40
New cards

What happens after the form is submitted and processed by PHP?

The browser redirects to a PHP file

41
New cards

What is the first step in creating a simple HTML form?

Start with the <html> tag

42
New cards

Where is the metadata placed in an HTML document?

Inside the <head> tag

43
New cards

What is the purpose of the action attribute in the

tag?

To tell the form where to send the data

44
New cards

What does the method="post" attribute in the form do?

Sends the data hidden inside the request

45
New cards

Which input type should be used to allow users to select a date?

date

46
New cards

What is the correct PHP tag syntax to start a script?

<?php ?>

47
New cards

What PHP variable is used to access form data sent by POST?

$_POST

48
New cards

Which HTML input type is used to send the form data?

submit

49
New cards

What does the echo command in PHP do?

Displays data on the screen

50
New cards

Where should both htmlform.html and process.php files be saved?

htdocs directory

51
New cards

What is MySQL primarily used for?

Storing, retrieving, and managing data

52
New cards

Which of the following is true about online databases?

They are good for real-time data access

53
New cards

What tool helps manage MySQL databases in XAMPP?

phpMyAdmin

54
New cards

What two services must be started in XAMPP to use phpMyAdmin?

Apache and MySQL

55
New cards

In a MySQL table, each row represents:

A single student or record

56
New cards

What data type should you use to store a student’s age?

INT

57
New cards

Which data type is ideal for storing paragraphs or article descriptions?

TEXT

58
New cards

The data type FLOAT is most useful for:

Storing decimal numbers or currency

59
New cards

What is an example of a value stored using the DATE data type?

2005-06-12

60
New cards

Which of the following allows setting a maximum character limit like 100 characters?

VARCHAR

61
New cards

What SQL command is used to change data in an existing table?

UPDATE

62
New cards

Which SQL keyword is used to assign new values to columns during an update?

SET

63
New cards

What clause should always be used with the UPDATE statement to avoid changing all records?

WHERE

64
New cards

What will the command UPDATE students SET Name='Tom' WHERE ID=1; do?

Change the name of the student with ID 1 to Tom

65
New cards

How can you update multiple columns in a single row?

By separating columns with commas in the SET clause

66
New cards

Which SQL statement is correct for updating two columns for students under age 18?

UPDATE students SET Name='Ray', Age=21 WHERE Age<18;

67
New cards

What SQL command is used to remove one or more rows from a table?

DELETE

68
New cards

Why is it important to use the WHERE clause with DELETE statements?

To avoid deleting all records

69
New cards

What happens if you run DELETE FROM students WHERE ID=3;?

It deletes the student with ID 3

70
New cards

What is a possible consequence of running UPDATE or DELETE without caution?

Data can be printed incorrectly