Quiz 8: Manipulating Mysql Databases With Php
Computing
Q 1Q 1
The PHP Extension and Application Representation (PEAR) is a committee that oversees the open source PHP code.
Free
True False
False
Q 2Q 2
One of the most popular PEAR code modules is PEAR DB, which simplifies access between PHP and a database server.
Free
True False
True
Q 3Q 3
How you enable MySQL support in PHP depends on the version of PHP and how you installed MySQL.
Free
True False
True
Free
True False
Q 5Q 5
The mysql_connect() function returns a 1 if it connects to the database successfully or 0 if it doesn't.
Free
True False
Free
True False
Free
True False
Free
True False
Free
True False
Q 10Q 10
You can use the mysql_select_db() function to select a database or change to a different database.
Free
True False
Free
True False
Free
True False
Free
True False
Free
True False
Q 15Q 15
To prevent code from trying to create a table that already exists, use the SHOW EXISTING TABLES command.
Free
True False
Free
True False
Q 17Q 17
The NOT NULL keywords are often used with primary keys to require that a field include a value.
Free
True False
Q 18Q 18
When you add records to a table that includes an AUTO_INCREMENT field, you omit the column name and value from the lists.
Free
True False
Q 19Q 19
The first record added to a table that has an auto-incrementing primary key will be assigned a value of 0.
Free
True False
Q 20Q 20
To update records in a table, use the UPDATE, SET, and WHERE keywords with the mysql_query() function.
Free
True False
Q 21Q 21
To delete records in a table, use the DELETE and WHERE keywords with the mysql_query() function.
Free
True False
Q 22Q 22
With queries that return results, such as SELECT queries, you can use the mysql_num_rows() function to find the number of records returned from a query.
Free
True False
Q 23Q 23
With queries that modify tables, but do not return results, such as INSERT, UPDATE, and DELETE queries, you use the mysql_modified_rows() function to determine the number of changed rows.
Free
True False
Q 24Q 24
You pass the mysql_affected_rows() function the variable containing the result pointer from the mysql_query() function.
Free
True False
Q 25Q 25
The mysql_info() function returns the number of operations for various types of actions, depending on the type of query.
Free
True False
Free
True False
Q 27Q 27
The mysql_query() function returns a result pointer that represents the query results when the SELECT or SHOW statement which returns a resultset.
Free
True False
Q 28Q 28
The mysql_fetch_row() function returns the fields in the current row of a resultset into an indexed array and moves the result pointer to the next row.
Free
True False
Q 29Q 29
The mysql_fetch_assoc() function returns the fields into an associative array and uses each row name as the array key.
Free
True False
Q 30Q 30
When you are finished working with query results retrieved with the mysql_query() function, you should use the mysql_free_resultset() function to close the resultset.
Free
True False
Q 31Q 31
You use the mysql_num_fields() function to return the number of _______________ in a query result.
Free
True False
Q 32Q 32
The ____ package is designed to work with MySQL version 4.1.3 and higher.
A) mysql
B) mysqli
C) libmysql
D) ext_mysqli
Free
Multiple Choice
Q 33Q 33
To open a connection to a MySQL database server, use ____.
A) mysql_connect()
B) open_connect()
C) connection_mysql()
D) open_mysql()
Free
Multiple Choice
Q 34Q 34
To close a database connection, use ____.
A) close_connection()
B) mysql_close()
C) mysql_exit()
D) close_mysql()
Free
Multiple Choice
Q 35Q 35
To return information about the MySQL database server version, use the ____ function.
A) mysql_get_client_info()
B) mysql_host_info(connection)
C) mysql_get_proto_info(connection)
D) mysql_get_server_info(connection)
Free
Multiple Choice
Q 36Q 36
The ___ function returns a text string describing the error in PHP code.
A) mysql_error()
B) mysql_errno()
C) mysql_err()
D) mysql_error_number()
Free
Multiple Choice
Q 37Q 37
The symbol (@), used to suppress error messages, is called ____.
A) supression operator
B) error control operator
C) null operator
D) no_error operator
Free
Multiple Choice
Q 38Q 38
You select a database or change to a different database with the ____ function.
A) mysql_select_database()
B) mysql_change_database()
C) mysql_select_db()
D) mysql_change_db()
Free
Multiple Choice
Q 39Q 39
To delete a database, use the ____ function.
A) mysql_delete_db()
B) mysql_drop_db()
C) mysql_delete_database()
D) mysql_drop_database()
Free
Multiple Choice
Q 40Q 40
Almost every command sent to MySQL from PHP is executed with the ____ function.
A) mysql_connect()
B) mysql_select()
C) mysql_send()
D) mysql_query()
Free
Multiple Choice
Q 41Q 41
A result pointer is a special type of ____ that refers to the currently selected row in a resultset.
A) variable
B) option
C) function
D) command
Free
Multiple Choice
Q 42Q 42
The list of records that is returned from a mysql_query() is a called a ____.
A) recordset
B) resultset
C) result
D) result query
Free
Multiple Choice
Q 43Q 43
When mysql_query() returns a resultset, you use the ____ function to determine the number of records in the resultset.
A) mysql_result_rows()
B) mysql_num_result()
C) mysql_num_rows()
D) mysql_num_records()
Free
Multiple Choice
Q 44Q 44
The ____ command with a mysql_query() function executes successfully if the table already exists.
A) SHOW EXISTING TABLE
B) SHOW MATCHING TABLE
C) SHOW SAME TABLE
D) SHOW TABLES LIKE
Free
Multiple Choice
Q 45Q 45
The ___ keyword is often used with the primary key to generate a unique id for each new row in a table.
A) UNIQUE_ID
B) INCREMENT_ID
C) AUTO_INCREMENT
D) AUTO_INCREMENT_ID
Free
Multiple Choice
Q 46Q 46
The ___ keyword, often used with the primary key, requires that the field include a value.
A) NOT NULL
B) NOT BLANK
C) NOT EMPTY
D) NOT VOID
Free
Multiple Choice
Q 47Q 47
To add multiple records to a database from an external file, you use the ____ statement with the name of the local text file that contains the records you want to add.
A) INSERT DATA
B) LOAD DATA
C) INSERT RECORDS
D) UPLOAD RECORDS
Free
Multiple Choice
Q 48Q 48
To change records in a table, use the UPDATE keyword to specify the name of the table to update and the ___ keyword to specify the value to assign to the fields in the records that match the condition in the WHERE keyword.
A) CHANGE
B) INSERT
C) PUT
D) SET
Free
Multiple Choice
Q 49Q 49
To delete records in a table, use the keywords ____.
A) DELETE, RECORD
B) DELETE, WHERE
C) REMOVE, WHERE
D) REMOVE, RECORD
Free
Multiple Choice
Q 50Q 50
When a query modifies a table but does not return a result, you use the ___ function to determine how many rows/records were affected.
A) mysql_rows_affected()
B) mysql_affected_rows()
C) mysql_affected_records()
D) mysql_records_affected()
Free
Multiple Choice
Q 51Q 51
With an INSERT query, the ___ function returns the number of records added and duplicated along with the number of warnings.
A) mysql_update_info()
B) mysql_info()
C) mysql_update()
D) mysql_info_update()
Free
Multiple Choice
Q 52Q 52
The mysql_info() function only returns query information when you add ___ records with the INSERT keyword.
A) one
B) more than one
C) less than five
D) no records
Free
Multiple Choice
Q 53Q 53
The function ____ returns the fields in the current row into an indexed array.
A) mysql_fetch_assoc()
B) mysql_data_seek()
C) mysql_fetch_row()
D) mysql_fetch_lengths()
Free
Multiple Choice
Q 54Q 54
The function ____ returns the fields in the current row of a resultset into an associative array and moves the result pointer to the next row.
A) mysql_fetch_lengths()
B) mysql_fetch_assoc()
C) mysql_fetch_rows()
D) mysql_fetch_array()
Free
Multiple Choice
Q 55Q 55
To close the resultset, use ____.
A) mysql_close()
B) mysql_kill()
C) mysql_exist()
D) mysql_free_result()
Free
Multiple Choice
Q 56Q 56
Use the ___ function to return the number of fields in a query result.
A) mysql_return_fields()
B) mysql_num_fields()
C) mysql_count_fields()
D) mysql_field_results()
Free
Multiple Choice
Free
Short Answer
Q 58Q 58
Although they perform similar functions, PEAR DB is designed specifically to work with PHP and ____________________ is a more generic protocol used by many programming languages and database management systems.
Free
Short Answer
Q 59Q 59
The mysqli (____________________) package became available with PHP 5 and is designed to work with MySQL version 4.1.3 and above.
Free
Short Answer
Q 60Q 60
The mysql_connect() function returns a ____________________ as an integer if it connects successfully to a database or a Boolean FALSE if it doesn't.
Free
Short Answer
Q 61Q 61
If you are connecting to an instance of the MySQL database server that is running on the same server as the PHP scripting engine, use a value of ____________________ or "127.0.0.1" for the host argument.
Free
Short Answer
Q 62Q 62
You pass the mysql_close() function the database ____________________ variable to close the database.
Free
Short Answer
Q 63Q 63
Because the client and server are defined in relation to MySQL, the Web server where the PHP script is running is the ____________________ when communicating with the MySQL server.
Free
Short Answer
Free
Short Answer
Q 65Q 65
Because the ____________________ function exits the script immediately if an error occurs, any further script output is not displayed.
Free
Short Answer
Free
Short Answer
Q 67Q 67
The ____________________ function is used to select a database or change to a different database.
Free
Short Answer
Free
Short Answer
Free
Short Answer
Q 70Q 70
The ____________________ is a special type of variable that refers to the currently selected row in records returned by MySQL.
Free
Short Answer
Free
Short Answer
Free
Short Answer
Q 73Q 73
To prevent your code from trying to create a table that already exists, use the ____________________ command.
Free
Short Answer
Q 74Q 74
The first field created using the AUTO_INCREMENT keyword is assigned a value of ____________________.
Free
Short Answer
Free
Short Answer
Q 76Q 76
When adding a record to a table, you can specify ____________________ in any fields for which you do not have a value.
Free
Short Answer
Q 77Q 77
To add multiple records to a database from an external file, you use the ____________________ statement with the name of the local text file that contains the records you want to add.
Free
Short Answer
Q 78Q 78
To delete all the records in a table, you use the DELETE statement but omit the ____________________ keyword.
Free
Short Answer
Q 79Q 79
Use the _________________________ function to determine the number of rows affected by an INSERT statement.
Free
Short Answer
Free
Short Answer
Q 81Q 81
The ____________________ function returns the number of operations for various types of actions, depending on the type of query.
Free
Short Answer
Free
Short Answer
Q 83Q 83
The _________________________ function returns the fields in the current row of a resultset into an associative array and moves the result pointer to the next row.
Free
Short Answer
Free
Short Answer