PHP/PHP Mcq Set 4 Sample Test,Sample questions

Question:
A mutator method is also called as ___________

1.Setter

2.Accessor

3.Getter

4.Destructor

Posted Date:-2021-07-17 03:14:52


Question:
Code that uses a class, function, or method is often described as the ____

1.client code

2.user code

3.object code

4.class code

Posted Date:-2021-07-17 03:14:52


Question:
Fill in the blank with the best option. An Object is a/an ________ of a class.

1.type

2.prototype

3.instance

4.object

Posted Date:-2021-07-17 03:14:52


Question:
If there is no error, then what will the error() method return?

1.TRUE

2.FALSE

3.Empty String

4.0

Posted Date:-2021-07-17 03:14:52


Question:
If you omit the visibility keyword in your method declaration, by default the method will be declared as _____

1.public

2.private

3.protected

4.friendly

Posted Date:-2021-07-17 03:14:52


Question:
In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?

1.PHP 5.0

2.PHP 5.1

3.PHP 5.2

4.PHP 5.3

Posted Date:-2021-07-17 03:14:52


Question:
Inheritance is the means by which one or more classes can be derived from a/an ___________ class.

1.base

2.abstract

3.null

4.predefined

Posted Date:-2021-07-17 03:14:52


Question:
PHP stands for -

1.Hypertext Preprocessor

2.Pretext Hypertext Preprocessor

3.Personal Home Processor

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
Prior to which version of PHP did constructors took the name of the enclosing class.

1.PHP 4

2.PHP 5

3.PHP 5.3

4.PHP 5.4

Posted Date:-2021-07-17 03:14:52


Question:
Variable name in PHP starts with -

1.! (Exclamation)

2. $ (Dollar)

3.& (Ampersand)

4.# (Hash)

Posted Date:-2021-07-17 03:14:52


Question:
What does PEAR stands for?

1.PHP extension and application repository

2.PHP enhancement and application reduce

3.PHP event and application repository

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
What is the use of fopen() function in PHP?

1.The fopen() function is used to open folders in PHP

2.The fopen() function is used to open remote server

3.The fopen() function is used to open files in PHP

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
What is the use of isset() function in PHP?

1.The isset() function is used to check whether variable is set or not

2.The isset() function is used to check whether the variable is free or not

3.The isset() function is used to check whether the variable is string or not

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
What is the use of sprintf() function in PHP?

1.The sprintf() function is used to print the output of program

2.The sprintf() function is used to send output to variable

3.Both of the above

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
What should be used to refer to a method in the context of a class rather than an object you use?

1.>

2.__

3.$

4.::

Posted Date:-2021-07-17 03:14:52


Question:
Which characters is used to access property variables on an object-by-object basis?

1.::

2.=

3.->

4..

Posted Date:-2021-07-17 03:14:52


Question:
Which function is used to determine whether the variables value is either TRUE or FALSE?

1.boolean()

2.is_boolean()

3.bool()

4.is_bool()

Posted Date:-2021-07-17 03:14:52


Question:
Which keyword precedes a method name?

1.method

2.function

3.public

4.protected

Posted Date:-2021-07-17 03:14:52


Question:
Which method or property can only be accessed from within the enclosing class? Even subclasses have no access.

1.public

2.friendly

3.private

4.protected

Posted Date:-2021-07-17 03:14:52


Question:
Which method retrieves each row from the prepared statement result and assigns the fields to the bound results?

1.get_row()

2.fetch_row()

3.fetch()

4.mysqli_fetch_row()

Posted Date:-2021-07-17 03:14:52


Question:
Which method returns the error code generated from the execution of the last MySQL function?

1.errno()

2.errnumber()

3.errorno()

4.errornumber()

Posted Date:-2021-07-17 03:14:52


Question:
Which method rolls back the present transaction?

1.commit()

2.undo()

3.mysqli_rollback()

4.rollback()

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is correct to add a comment in php?

1.& .... &

2. // ....

3./* .... */

4.Both (b) and (c)

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is not a variable scope in PHP?

1.Extern

2.Local

3. Static

4.Global

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the correct use of the strcmp() function in PHP?

1.The strcmp() function is used to compare the strings excluding case

2.The strcmp() function is used to compare the uppercase strings

3.The strcmp() function is used to compare the lowercase strings

4.The strcmp() function is used to compare the strings including case

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the correct way of defining a variable in PHP?

1.$variable name = value;

2.$variable_name = value;

3.$variable_name = value

4.$variable name as value;

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the correct way to create a function in PHP?

1.Create myFunction()

2.New_function myFunction()

3.function myFunction()

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the default file extension of PHP?

1..php

2..hphp

3..xml

4..html

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the use of strlen() function in PHP?

1.The strlen() function returns the type of string

2.The strlen() function returns the length of string

3.The strlen() function returns the value of string

4.The strlen() function returns both value and type of string

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is the use of strpos() function in PHP?

1. The strpos() function is used to search for the spaces in a string

2.The strpos() function is used to search for a number in a string

3.The strpos() function is used to search for a character/text in a string

4.append()

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following is used to display the output in PHP?

1.echo

2.write

3.print

4.Both (a) and (c)

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following methods is used to execute the statement after the parameters have been bound?

1.bind_param()

2.bind_result()

3.bound_param()

4.bound_result()

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following PHP function is used to generate unique id?

1.id()

2.mdid()

3.uniqueid()

4.None of the above

Posted Date:-2021-07-17 03:14:52


Question:
Which of the following starts with __ (double underscore) in PHP?

1.Inbuilt constants

2.User-defined constants

3.Magic constants

4.Default constants

Posted Date:-2021-07-17 03:14:52


Question:
Which of the methods are used to manage result sets using both associative and indexed arrays?

1.get_array() and get_row()

2.get_array() and get_column()

3.fetch_array() and fetch_row()

4.mysqli_fetch_array() and mysqli_fetch_row()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following is not a valid class name?

1.ShopProduct

2.Shopproduct

3.Shopproduct1

4.1shopproduct

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?

1.extension=php_mysqli.dll

2.extension=mysql.dll

3.extension=php_mysqli.dl

4.extension=mysqli.dl

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following method is used to retrieve the number of rows affected by an INSERT, UPDATE, or DELETE query?

1.num_rows()

2.affected_rows()

3.changed_rows()

4.mysqli_affected_rows()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following methods can be used to diagnose and display information about a MySQL connection error?

1.connect_errno()

2.connect_error()

3.mysqli_connect_errno()

4.mysqli_connect_error()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following methods is responsible for sending the query to the database?

1.query()

2.send_query()

3.sendquery()

4.mysqli_query()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following methods is used to recuperating prepared statements resources?

1.end()

2.finish()

3.mysqli_close()

4.close()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following methods recuperates any memory consumed by a result set?

1.destroy()

2.mysqli_free_result()

3.alloc()

4.free()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following statements instantiates the mysqli class?

1.mysqli = new mysqli()

2.$mysqli = new mysqli()

3.$mysqli->new.mysqli()

4.mysqli->new.mysqli()

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following statements is used to create a table?

1.CREATE TABLE table_name (column_name column_type);

2.CREATE table_name (column_type column_name)

3.CREATE table_name (column_name column_type);

4.CREATE TABLE table_name (column_type column_name);

Posted Date:-2021-07-17 03:14:52


Question:
Which one of the following statements should be used to include a file?

1.#include ‘filename’;

2.include ‘filename’;

3.@include ‘filename’;

4.#include <filename>;

Posted Date:-2021-07-17 03:14:52


Question:
Which version of MySQL introduced the prepared statements?

1.MySQL 4.0

2.MySQL 4.1

3.MySQL 4.2

4.MySQL 4.3

Posted Date:-2021-07-17 03:14:52


Question:
Which version of PHP introduced class type hints?

1.PHP 4

2.PHP 4.3

3.PHP 5

4.PHP 5.3

Posted Date:-2021-07-17 03:14:52


Question:
Which version of PHP introduced the visibility keywords i.e public, private, and protected?

1.PHP 4

2.PHP 5

3.PHP 5.1

4.PHP 5.3

Posted Date:-2021-07-17 03:14:52


Question:
Who is known as the father of PHP?

1.Drek Kolkevi

2.list Barely

3.Rasmus Lerdrof

4.None of the above

Posted Date:-2021-07-17 03:14:52


More MCQS

  1. PHP Mcq Set 1
  2. PHP Mcq Set 2
  3. PHP Mcq Set 3
  4. PHP Mcq Set 4
  5. Current affairs mcq php
  6. Current affairs mcq php set 2
  7. Current affairs mcq php set 3
  8. PHP MCQ
  9. PHP MCQ– Basics
  10. PHP Mcq – Functions
  11. PHP Mcq Arrays
  12. PHP Mcq– Basics of Object-Oriented PHP
  13. PHP Mcq – Error Handling
  14. PHP Basics Mcq Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!