The $_FILES superglobal in PHP has an array key named ________ which provides the original name of the uploaded file.
- $_FILES['file']
- $_FILES['name']
- $_FILES['original']
- $_FILES['temp_name']
In PHP, the '$_FILES' superglobal contains information about the uploaded files, and the 'name' key specifically provides the original name of the uploaded file.
An array that has named indexes instead of numeric is called a(n) ________ array.
- Associative Array
- Indexed Array
- Numeric Array
- Sequential Array
An array with named indexes is known as an Associative Array. In PHP, you can use strings as keys to access values in the array, making it very flexible.
In a switch-case structure, the ________ keyword is used to specify the default action when no case matches.
- if
- default
- else
- break
In a switch-case structure, the default keyword specifies the action when no case matches the switch expression.
In a database transaction, what does the term "atomicity" refer to?
- The transaction's ability to be rolled back if an error occurs
- The transaction's ability to be divided into smaller parts
- The transaction's ability to be completed without any errors
- The transaction's ability to be scheduled concurrently
"Atomicity" in the context of a database transaction refers to its ability to be completed without any errors. It ensures that all the operations within the transaction are executed successfully, or the transaction is rolled back entirely if any part of it fails, maintaining the database's integrity.
What does the PHP function func_num_args() return?
- The number of function arguments
- The function name
- An array of function arguments
- An associative array of arguments
The func_num_args() function returns the number of function arguments, which is useful for functions with a variable number of arguments.
Which of the following is a correct way to destroy a specific session variable in PHP?
- unset($_SESSION['variable_name']);
- session_destroy();
- session_unset();
- session_unset($_SESSION['variable_name']);
The correct way to destroy a specific session variable in PHP is by using the unset function, followed by the variable name in $_SESSION. This clears the variable without destroying the entire session.
The control structure that allows for multiple conditions to be checked in a single statement is called ________.
- Switch
- If
- For
- While
In PHP, the 'switch' control structure allows you to check multiple conditions in a single statement, making your code more efficient and organized.
Constants in PHP are by default ________ (case-sensitive/case-insensitive).
- case-insensitive
- uppercase-sensitive
- lowercase-sensitive
- case-sensitive
Constants in PHP are, by default, case-sensitive. This means that constant names are distinct based on their case (e.g., "CONSTANT" and "constant" are considered different).
Consider a scenario where you need to ensure that a particular piece of code only executes once, regardless of how many times a function is called. Which PHP feature or function would you utilize?
- Singleton Pattern
- Static Variable
- sleep()
- exit()
To ensure a piece of code only executes once, you can use a static variable inside a function to keep track of whether it has already been executed.
In PHP OOP, what does the term "inheritance" mean?
- Passing properties
- Extending a class
- Object duplication
- Class encapsulation
In PHP Object-Oriented Programming, "inheritance" means extending a class to create a new class with the same properties and methods as the parent class.