InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 51. |
Which version of PHP introduced the visibility keywords i.e public, private, and protected?(a) PHP 4(b) PHP 5(c) PHP 5.1(d) PHP 5.3This question was addressed to me in an online interview.My question is from Object Basics-1 topic in portion Objects and Databases in PHP of PHP |
|
Answer» Correct choice is (b) PHP 5 |
|
| 52. |
Fill in the blank with the best option. An Object is a/an ________ of a class.(a) type(b) prototype(c) instance(d) objectThe question was asked during an online exam.The origin of the question is Object Basics-1 in chapter Objects and Databases in PHP of PHP |
|
Answer» Right answer is (c) INSTANCE |
|
| 53. |
Which one of the following is not a valid class name?(a) ShopProduct(b) Shopproduct(c) Shopproduct1(d) 1shopproductI had been asked this question by my school principal while I was bunking the class.Origin of the question is Object Basics-1 in division Objects and Databases in PHP of PHP |
|
Answer» Right CHOICE is (d) 1shopproduct |
|
| 54. |
Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?(a) get_row()(b) fetch_row()(c) fetch()(d) mysqli_fetch_row()This question was posed to me in an international level competition.Enquiry is from Working with Databases-2 topic in portion Objects and Databases in PHP of PHP |
|
Answer» Correct ANSWER is (d) mysqli_fetch_row() |
|
| 55. |
Which method rolls back the present transaction?(a) commit()(b) undo()(c) mysqli_rollback()(d) rollback()The question was posed to me in a job interview.My question comes from Working with Databases-2 topic in section Objects and Databases in PHP of PHP |
|
Answer» The correct OPTION is (c) mysqli_rollback() |
|
| 56. |
Which one of the following methods is used to recuperating prepared statements resources?(a) end()(b) finish()(c) mysqli_close()(d) close()This question was addressed to me by my school principal while I was bunking the class.I need to ask this question from Working with Databases-2 in portion Objects and Databases in PHP of PHP |
|
Answer» Right option is (c) mysqli_close() |
|
| 57. |
Which of the following methods is used to execute the statement after the parameters have been bound?(a) bind_param()(b) bind_result()(c) bound_param()(d) bound_result()I had been asked this question during an internship interview.My doubt is from Working with Databases-2 in portion Objects and Databases in PHP of PHP |
|
Answer» Correct option is (a) bind_param() |
|
| 58. |
Which version of MySQL introduced the prepared statements?(a) MySQL 4.0(b) MySQL 4.1(c) MySQL 4.2(d) MySQL 4.3This question was addressed to me during an interview.I would like to ask this question from Working with Databases-2 in section Objects and Databases in PHP of PHP |
|
Answer» The correct option is (b) MYSQL 4.1 |
|
| 59. |
Which one of the following method is used to retrieve the number of rows affected by an INSERT, UPDATE, or DELETE query?(a) num_rows()(b) affected_rows()(c) changed_rows()(d) mysqli_affected_rows()This question was posed to me in my homework.I want to ask this question from Working with Databases-2 in portion Objects and Databases in PHP of PHP |
|
Answer» The correct option is (d) mysqli_affected_rows() |
|
| 60. |
Which one of the following methods recuperates any memory consumed by a result set?(a) destroy()(b) mysqli_free_result()(c) alloc()(d) free()I have been asked this question in my homework.I need to ask this question from Working with Databases-2 topic in portion Objects and Databases in PHP of PHP |
|
Answer» The CORRECT answer is (B) mysqli_free_result() |
|
| 61. |
Which one of the following statements should be used to include a file?(a) #include ‘filename’;(b) include ‘filename’;(c) @include ‘filename’;(d) #include ;This question was addressed to me in my homework.Asked question is from Working with Databases-2 in portion Objects and Databases in PHP of PHP |
|
Answer» CORRECT choice is (b) include ‘FILENAME’; The explanation is: Include in PHP will takes all the code from the specified FILE and copies to the existing file containing include statement. An example of this- |
|
| 62. |
Which of the methods are used to manage result sets using both associative and indexed arrays?(a) get_array() and get_row()(b) get_array() and get_column()(c) fetch_array() and fetch_row()(d) mysqli_fetch_array() and mysqli_fetch_row()This question was posed to me in semester exam.I need to ask this question from Working with Databases-2 in portion Objects and Databases in PHP of PHP |
|
Answer» RIGHT ANSWER is (d) mysqli_fetch_array() and mysqli_fetch_row() EASIEST explanation: The method mysqli_fetch_array() is used to fetch a RESULT row as an associative array or a numeric array. And the function mysqli_fetch_row() is used to fetche one row from a result-set and returns it as an enumerated array. The method fetch_array() and fetch_row() were used in the previous version of PHP. |
|
| 63. |
Which one of the following methods is responsible for sending the query to the database?(a) query()(b) send_query()(c) sendquery()(d) mysqli_query()The question was asked in an online quiz.I want to ask this question from Working with Databases-2 in section Objects and Databases in PHP of PHP |
|
Answer» Right choice is (d) mysqli_query() |
|
| 64. |
If there is no error, then what will the error() method return?(a) TRUE(b) FALSE(c) Empty String(d) 0This question was posed to me by my college professor while I was bunking the class.My doubt is from Working with Databases-1 in division Objects and Databases in PHP of PHP |
|
Answer» RIGHT choice is (C) Empty String The BEST explanation: The function error is used to deal with error handling and logging. If there is no error, then the error() METHOD will RETURN an empty string. |
|
| 65. |
Which method returns the error code generated from the execution of the last MySQL function?(a) errno()(b) errnumber()(c) errorno()(d) errornumber()I have been asked this question in unit test.My query is from Working with Databases-1 topic in section Objects and Databases in PHP of PHP |
|
Answer» Correct answer is (a) errno() |
|
| 66. |
Which one of the following methods can be used to diagnose and display information about a MySQL connection error?(a) connect_errno()(b) connect_error()(c) mysqli_connect_errno()(d) mysqli_connect_error()This question was posed to me in my homework.This question is from Working with Databases-1 in division Objects and Databases in PHP of PHP |
|
Answer» Right ANSWER is (C) mysqli_connect_errno() |
|
| 67. |
Which one of the following statements can be used to select the database?(a) $mysqli=select_db('databasename');(b) mysqli=select_db('databasename');(c) mysqli->select_db('databasename');(d) $mysqli->select_db('databasename');I got this question in an interview for job.This is a very interesting question from Working with Databases-1 in chapter Objects and Databases in PHP of PHP |
|
Answer» The CORRECT OPTION is (d) $mysqli->select_db('DATABASENAME'); |
|
| 68. |
Which one of the following statements instantiates the mysqli class?(a) mysqli = new mysqli()(b) $mysqli = new mysqli()(c) $mysqli->new.mysqli()(d) mysqli->new.mysqli()The question was posed to me during an online interview.Origin of the question is Working with Databases-1 topic in chapter Objects and Databases in PHP of PHP |
|
Answer» Right choice is (B) $mysqli = new mysqli() |
|
| 69. |
Which one of the following statements is used to create a table?(a) CREATE TABLE table_name (column_name column_type);(b) CREATE table_name (column_type column_name);(c) CREATE table_name (column_name column_type);(d) CREATE TABLE table_name (column_type column_name);This question was posed to me during an interview for a job.My enquiry is from Working with Databases-1 in chapter Objects and Databases in PHP of PHP |
|
Answer» The correct option is (a) CREATE TABLE table_name (column_name column_type); |
|
| 70. |
In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?(a) PHP 5.0(b) PHP 5.1(c) PHP 5.2(d) PHP 5.3I got this question in an interview for job.The origin of the question is Working with Databases-1 topic in chapter Objects and Databases in PHP of PHP |
|
Answer» Correct option is (d) PHP 5.3 |
|
| 71. |
Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?(a) extension=php_mysqli.dll(b) extension=mysql.dll(c) extension=php_mysqli.dl(d) extension=mysqli.dlI have been asked this question in exam.My question is based upon Working with Databases-1 topic in chapter Objects and Databases in PHP of PHP |
|
Answer» Right answer is (a) extension=php_mysqli.dll |
|
| 72. |
Which one of the following databases has PHP supported almost since the beginning?(a) Oracle Database(b) SQL(c) SQL+(d) MySQLI had been asked this question in an online quiz.The doubt is from Working with Databases-1 topic in section Objects and Databases in PHP of PHP |
|
Answer» Correct CHOICE is (d) MYSQL |
|
| 73. |
The updated MySQL extension released with PHP 5 is typically referred to as _______________(a) MySQL(b) mysql(c) mysqli(d) mysqlyI got this question during an internship interview.My doubt stems from Working with Databases-1 topic in section Objects and Databases in PHP of PHP |
|
Answer» RIGHT ANSWER is (C) mysqli Explanation: The updated MySQL EXTENSION with PHP 5 is known as MySQL and typically REFERRED to as mysqli. |
|
| 74. |
Parameter flags was added in which version of PHP?(a) PHP 4.0(b) PHP 4.1(c) PHP 4.2(d) PHP 4.3The question was posed to me in an online interview.Question is taken from Introduction to Preg in PHP topic in portion Objects and Databases in PHP of PHP |
|
Answer» Correct option is (d) PHP 4.3 |
|
| 75. |
Which one of the following is not a preg PHP function?(a) preg_match(b) preg_match_all(c) preg_matchall(d) preg_splitThis question was posed to me by my college director while I was bunking the class.Asked question is from Introduction to Preg in PHP in division Objects and Databases in PHP of PHP |
|
Answer» CORRECT OPTION is (c) preg_matchall The explanation: The function preg_match_all() MATCHES all occurrences of pattern in STRING. |
|
| 76. |
Which one of the following preg PHP functions is used to take a string, and put it in an array?(a) preg_destroy()(b) preg_split()(c) preg_unchain()(d) preg_divide()The question was asked in semester exam.Enquiry is from Introduction to Preg in PHP topic in division Objects and Databases in PHP of PHP |
|
Answer» Right ANSWER is (b) preg_split() |
|
| 77. |
Which one of the following preg PHP function is used to do a find and replace on a string or an array?(a) preg_replace()(b) preg_find()(c) preg_find_replace()(d) preg_findre()I had been asked this question in class test.Asked question is from Introduction to Preg in PHP topic in chapter Objects and Databases in PHP of PHP |
|
Answer» CORRECT choice is (a) preg_replace() The best I can EXPLAIN: In preg_replace() FUNCTION, after the replacement has occurred, the modified STRING will be returned and if no matches are found, the string will REMAIN unchanged. |
|
| 78. |
Which one of the following functions are used to search a string?(a) preg_match(b) preg_search(c) preg_find(d) preg_foundThe question was asked by my school principal while I was bunking the class.I'd like to ask this question from Introduction to Preg in PHP in chapter Objects and Databases in PHP of PHP |
|
Answer» CORRECT choice is (a) preg_match Explanation: The function preg_match() searches string for PATTERN and it returns true if pattern EXISTS, and false otherwise. The function returns 1 if SEARCH was SUCCESSFUL else returns 0. |
|
| 79. |
What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?(a) Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)(b) Array([2]=>two [3]=>three [4]=>four)(c) Array([1]=> 1)(d) Array([0]=>0 [5]=>5)I have been asked this question by my school teacher while I was bunking the class.This question is from Introduction to Preg in PHP in section Objects and Databases in PHP of PHP |
|
Answer» Right CHOICE is (b) Array([2]=>two [3]=>THREE [4]=>four) |
|