Which of the following SQL clauses is used to filter the results of a query?
- SELECT
- FROM
- WHERE
- ORDER BY
The 'WHERE' clause in SQL is used to filter the results of a query. It allows you to specify conditions that must be met for a row to be included in the result set.
In PHP, how can you check if a defined constant exists?
- defined()
- exists()
- constant_exists()
- is_constant_defined()
You can use the defined() function in PHP to check if a defined constant exists. It returns true if the constant is defined and false if it's not.
In a multidimensional array, how would you access the second element of the first array?
- $array[0][1]
- $array[1][0]
- $array[2][1]
- $array[0][2]
In a multidimensional array, you access elements by specifying the indices for each dimension. To access the second element of the first array, you would use $array[0][1], where 0 represents the first array and 1 represents the second element within that array.
Which of the following is a predefined function in PHP used to get the length of a string?
- str_length()
- strlen()
- string_length()
- lengthOfString()
The 'strlen()' function in PHP is used to find the length of a string, counting the number of characters in the string. It's a commonly used function for string manipulation.
When a child class inherits from a parent class, it can also be referred to as a ________ relationship.
- Inheritance
- Association
- Aggregation
- Composition
In object-oriented programming, when a child class inherits from a parent class, it forms an inheritance relationship, inheriting properties and methods.
Which of the following PHP functions is commonly used to create a hashed password?
- encrypt()
- hash_password()
- password_hash()
- create_hashed_password()
The password_hash() function in PHP is commonly used for creating hashed passwords. It incorporates strong encryption algorithms and automatically generates a unique salt for each password, enhancing security.
When using PDO, which method is used to prepare a statement for execution?
- prepare()
- execute()
- query()
- bindParam()
The prepare() method in PDO is used to prepare an SQL statement for execution. It's typically used with placeholders to prevent SQL injection and to improve query performance by reusing the prepared statement with different parameter values.
The ________ function in PHP can be used to regenerate a session ID.
- session_regenerate_cookie
- session_regenerate_id
- session_reset_id
- session_destroy
The correct option is session_regenerate_id. It regenerates the session ID and helps enhance session security.
The ________ operator in PHP is used to check if two values are not equal.
- != (Not Equal)
- == (Equal)
- >= (Greater Than or Equal)
- !== (Identically Not Equal)
In PHP, the '!=' operator checks for inequality between two values. It returns true if the values are not equal.
In PHP, which keyword is used to define a constant?
- constant
- define
- const
- let
Constants in PHP are defined using the define function. It's not a keyword but a function used to create named constants with a specific value.