Web Application Development MCQs with Answers
Practice important Web Application Development MCQs with answers and explanations.
Chapter: 9
Q101:
What is the primary purpose of PHP filters?
A. Validating and sanitizing data
B. Encrypting data
C. Compressing data
D. Formatting data
Correct Answer:
A
Chapter: 9
Q102:
Fill in the blank: The filter_var() function is used to _______ and sanitize data.
A. validate
B. encode
C. decrypt
D. format
Correct Answer:
A
Chapter: 9
Q103:
Which PHP filter is used to sanitize a string by removing all HTML tags?
A. FILTER_SANITIZE_STRING
B. FILTER_SANITIZE_EMAIL
C. FILTER_SANITIZE_URL
D. FILTER_SANITIZE_INT
Correct Answer:
A
Chapter: 9
Q104:
Fill in the blank: To check if a variable $email contains a valid email address, you use _______ filter.
A. FILTER_VALIDATE_EMAIL
B. FILTER_SANITIZE_EMAIL
C. FILTER_VALIDATE_URL
D. FILTER_VALIDATE_INT
Correct Answer:
A
Chapter: 9
Q105:
Fill in the blank: To remove all illegal characters from a URL, use the filter_var() function with _______ filter.
A. FILTER_SANITIZE_URL
B. FILTER_SANITIZE_STRING
C. FILTER_VALIDATE_EMAIL
D. FILTER_VALIDATE_INT
Correct Answer:
A
Chapter: 9
Q106:
Which function is used to check if an IP address is valid?
A. filter_var() with FILTER_VALIDATE_IP
B. filter_ip()
C. validate_ip()
D. check_ip()
Correct Answer:
A
Chapter: 9
Q107:
Fill in the blank: The filter_var() function can sanitize an email address using _______ filter.
A. FILTER_SANITIZE_EMAIL
B. FILTER_SANITIZE_URL
C. FILTER_SANITIZE_STRING
D. FILTER_VALIDATE_INT
Correct Answer:
A
Chapter: 9
Q108:
What is the result if $url contains illegal characters and is processed with FILTER_SANITIZE_URL?
A. The illegal characters are removed
B. The URL becomes invalid
C. The URL remains unchanged
D. An error is thrown
Correct Answer:
A
Chapter: 9
Q109:
Fill in the blank: To ensure that $ip is a valid IP address, you use the filter_var() function with _______ filter.
A. FILTER_VALIDATE_IP
B. FILTER_VALIDATE_URL
C. FILTER_SANITIZE_IP
D. FILTER_SANITIZE_URL
Correct Answer:
A
Chapter: 10
Q110:
What is a database?
A. A collection of data
B. A type of software application
C. A programming language
D. A hardware component
Correct Answer:
A
Chapter: 10
Q111:
Which of the following is an example of a Database Management System (DBMS)?
A. MySQL
B. HTML
C. JavaScript
D. CSS
Correct Answer:
A
Chapter: 10
Q112:
Fill in the blank: MySQL is a _______ database system.
A. relational
B. non-relational
C. object-oriented
D. hierarchical
Correct Answer:
A
Chapter: 10
Q113:
What does the MySQLi extension stand for in PHP?
A. Improved MySQL extension
B. Interactive MySQL extension
C. Internet MySQL extension
D. Initial MySQL extension
Correct Answer:
A
Chapter: 10
Q114:
Which PHP function is used to establish a connection to a MySQL database?
A. mysqli_connect()
B. mysql_connect()
C. pdo_connect()
D. db_connect()
Correct Answer:
A
Chapter: 10
Q115:
Fill in the blank: To create a new database in MySQL, you use the _______ statement.
A. CREATE DATABASE
B. DROP DATABASE
C. ALTER DATABASE
D. SELECT DATABASE
Correct Answer:
A
Chapter: 10
Q116:
Which tool is used to manage MySQL databases over the Internet?
A. PhpMyAdmin
B. XAMPP
C. WAMP
D. MySQL Workbench
Correct Answer:
A
Chapter: 10
Q117:
Fill in the blank: To check the connection to a MySQL database in PHP, you use _______.
A. mysqli_connect_error()
B. mysqli_query()
C. mysqli_close()
D. mysqli_connect()
Correct Answer:
A
Chapter: 10
Q118:
What is the primary purpose of PhpMyAdmin?
A. To handle the administration of MySQL databases
B. To connect to MySQL databases
C. To execute PHP scripts
D. To manage server files
Correct Answer:
A
Chapter: 10
Q119:
Which PHP function is used to check if a database was created successfully?
A. mysqli_query()
B. mysqli_create()
C. mysqli_connect_error()
D. mysqli_error()
Correct Answer:
A
Chapter: 10
Q120:
Fill in the blank: The mysqli_connect() function requires _______ arguments to connect to a MySQL database.
A. 3
B. 2
C. 4
D. 5
Correct Answer:
A