Which network type spans a large geographic area, often connecting multiple cities or even countries?
- LAN
- MAN
- PAN
- WAN
WAN (Wide Area Network) is a network that covers a broad area, connecting multiple LANs that might be on opposite sides of the world. It can span cities, states, or even countries. The internet is the largest example of a WAN.
The PHP function that compares two arrays and returns the differences is called ________.
- array_diff()
- array_merge()
- array_intersect()
- array_unique()
The array_diff() function in PHP compares two arrays and returns the differences between them, providing a useful tool for array comparison and manipulation.
A class that cannot be instantiated and is intended to be inherited by other classes is known as a ________ class.
- 'abstract'
- 'final'
- 'static'
- 'interface'
An 'abstract' class in PHP is meant to be inherited by other classes. It can't be instantiated on its own and often contains abstract methods to be implemented by child classes.
Which PHP function can be used to strip tags from a string, often used to prevent XSS attacks?
- strip_tags()
- htmlspecialchars()
- htmlentities()
- xss_clean()
strip_tags() is used to remove HTML and PHP tags from a string, making it a useful tool for preventing cross-site scripting (XSS) attacks.
Which PDO method is used to begin a transaction?
- beginTransaction()
- startTransaction()
- openTransaction()
- initiateTransaction()
The beginTransaction() method is used to initiate a transaction in PDO. Transactions are essential for maintaining data integrity when multiple database operations need to be atomic.
A common method to prevent stored XSS attacks is to store user input in its ________ form.
- Encoded
- Original
- Encrypted
- Compressed
Storing user input in its encoded form can prevent stored Cross-Site Scripting (XSS) attacks, as the data is less likely to be executed as code.
The ________ function in PHP is used to get the last error that occurred during a file operation.
- error_get_last()
- file_get_contents()
- file_exists()
- error_reporting()
The error_get_last() function retrieves the details of the last error, which is useful for debugging and understanding file operation issues in PHP.
In PHP, which of the following keywords is used to access properties and methods of a parent class from a child class?
- super
- parent
- this
- self
In PHP, the 'parent' keyword is used to access properties and methods of a parent class from a child class. This is essential when you want to override a method in the child class while still using the parent class's method.
Which of the following functions in PHP is used to find the position of the first occurrence of a substring in a string?
- strpos()
- substr_position()
- find_string_position()
- locate_string_position()
The strpos() function in PHP is used to find the position of the first occurrence of a substring within a string.
The session data in PHP is stored by default in the ________ directory on the server.
- /tmp
- /var/sessions
- /sessions
- /session_data
In PHP, session data is, by default, stored in the /tmp directory on the server. Understanding where session data is stored is crucial for managing and securing user sessions in web applications.