NEW
Font size
Worksheets504850205155495A33
Total questions: 10
Worksheet time: 6mins
Which HTML form attribute is required to specify the PHP file that will process the submitted data?
method
action
name
id
When comparing GET and POST, which statement is true regarding security?
GET is more secure because it hides data from the URL.
POST is more secure because it hides data from the URL, making it ideal for sensitive input like logins.
Both methods are equally secure for processing passwords.
GET should always be used for important or sensitive data.
What is a "Rule of Thumb" for choosing between GET and POST?
Use POST for search bars and filters.
Use GET for logins and form submissions.
Use GET for displaying information and POST for important or sensitive input.
There is no rule; they are interchangeable.
Which PHP function is used to validate that an input field is not blank before processing it?
$_POST["name"]
echo()
empty()
validate()
What is a common pitfall that causes errors when handling user input?
Saving the PHP file inside the htdocs folder.
Opening PHP files through localhost.
Method mismatches, such as a form using POST while the PHP script uses $_GET.
Including a semicolon at the end of a PHP statement.
What is the primary purpose of using loops in PHP programming?
To make the code run slower for debugging.
To repeat specific actions automatically, eliminating the need for redundant code.
To create a static webpage with fixed content.
To define the name of a variable.
Which looping structure is guaranteed to execute its code block at least once?
While loop
For loop
Do-While loop
Static loop
Which loop is considered the most efficient choice for a fixed number of repetitions, such as counting from 1 to 10?
While loop
Do-While loop
For loop
Repeat-Until loop
In the command for ( i=1; i<=10; i++), what is the purpose of i++?
It initializes the variable to 1.
It is a comparison operator to check if the condition is true.
It is an increment operator used to update the control variable and prevent infinite cycles.
It ends the PHP script immediately.
How are loops frequently used to create dynamic HTML content?
To change the background color of a page permanently.
To generate elements like unordered lists
- and
- or table rows based on data.
To replace the need for an Apache server.
To convert a PHP file into a plain HTML file.
