Explore topic-wise InterviewSolutions in .

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.

1.

List of all important MySQLi function

Answer»

Below are the list of different MySQLi function and explained some details below
(1)mysqli_affected_rows - It gives the information about no. of affected rows in a previous MySQL operation

(2)mysqli_autocommit - It used to turn on/off auto-committing database operation

(3)mysqli_begin_transaction - Start a transaction

(4)mysqli_change_user - Used for changing the USER of the specified database connection

(5)mysqli_character_set_name - Returns default character set for the database connection.

(6)mysqli_client_info - Used to get MySQL client info.

(7)mysqli_client_version - Returns the MySQL client version as a string.

(8)mysqli_close - Closes a previously opened database connection.

(9)mysqli_commit - Commits the current transaction.

(10)mysqli_connect_errno - Returns the error code from last connect call.

(11)mysqli_connect_error - Returns a string description of the last connect error.

(12)mysqli__construct - It used to open a new connection to the MySQL server

(13)mysqli_debug - Used to performs DEBUGGING operations

(14)mysqli_dump_debug_info - Used to DUMP debugging information into the log

(15)mysqli_errno - It will return the error code for the most recent function call

(16)mysqli_error_list - Returns a list of errors from the last command executed

(17)mysqli_error - Returns a string description of the last error

(18)mysqli_field_count - It returns the number of columns for the most recent query

(19)mysqli_get_charset - Returns a character set object

(20)mysqli_get_client_info - Used to get MySQL client info

(21)mysqli_get_client_stats - It returns client per-process statistics

(22)mysqli_get_client_version - Returns the MySQL client version as an integer

(23)mysqli_get_connection_stats - Returns statistics about the client connection

(24)mysqli_host_info - Returns a string representing the type of connection used

(25)mysqli_protocol_version - Returns the version of the MySQL protocol used

(26)mysqli_server_info - Returns the version of the MySQL server

(27)mysqli_server_version - Returns the version of the MySQL server as integer

(28)mysqli_get_warnings - Used for getting result of SHOW WARNINGS

(29)mysqli_info - Retrieves information of most recently executed query

(30)mysqli_insert_id - Returns auto generated id used in the latest query

(31)mysqli_kill - Will ask the server to kill a MySQL thread

(32)mysqli_more_results - Used for checking if there are any more query results from a multi query

(33)mysqli_multi_query - It will perform a query on the database

(34)mysqli_next_result - It prepares next result from multi_query

(35)mysqli_options - Used to set options

(36)mysqli_ping - Used to ping a server

(37)mysqli_poll - Used to POLL connections

(38)mysqli_prepare - Prepare an SQL statement for execution.

(39)mysqli_query - Used for performing a query on the database.

(40)mysqli_real_connect - It opens a connection to a mysql server.

(41)mysqli_real_escape_string - It escapes special characters in a string for use in an SQL statement

(42)mysqli_real_query - Used to execute an SQL query.

(43)mysqli_real_async_query - Used to get result from async query

(44)mysqli_refresh - Used to refresh an SQL statement for execution.

(45)mysqli_release_savepoint - Removes the named savepoint from the set of savepoints of the current transaction

(46)mysqli_rollback - It rolls back current transaction

(47)mysqli_rpl_query_type - It will return RPL query type

(48)mysqli_select_db - Used to selects the default database for database queries

(49)mysqli_send_query - Used to send the query and return

(50)mysqli_set_charset - It sets the default client character set

(51)mysqli_set_local_infile_default - Used to unsets user defined handler for load local infile command

(52)mysqli_set_local_infile_handler - Used to set callback function for LOAD DATA LOCAL INFILE command

(53)mysqli_sqlstate - It returns the SQLSTATE error from previous MySQL operation.

(54)mysqli_ssl_set - Used for establishing secure connections using SSL

(55)mysqli_stat - Used to set callback function for LOAD DATA LOCAL INFILE command

(55)mysqli_stmt_init - Used to initialize a statement and returns an object for use with mysqli_stmt_prepare.

(56)mysqli_thread_id - It returns the thread ID for the current connection

(57)mysqli_thread_safe - It returns whether thread safety is given or not.

(58)mysqli_use_result - Used to initiate a result set retrieval

(59)mysqli_warning_count - It will return the number of warnings from the last query for the given LINK

2.

How to get data in the result set of MySQL using PHP

Answer» DATA can be TAKEN in 4 ways
1. mysql_fetch_row
2. mysql_fetch_array
3. mysql_fetch_object
4. mysql_fetch_assoc
3.

New features in MySQLi

Answer»

Below are the 6 new features of MySQLi COMES into PICTURES
(1)An Object-oriented interface
(2)Support for prepared statements
(3)Support for multiple statements
(4)Support for transactions
(5)ENHANCED debugging capabilities
(6)Embedded server support.

4.

Difference between MySQL Vs MySQLi Vs PDO

Answer»

When we say about the difference between all 3 above first we TAKE PDO and MYSQLI both PROVIDES an object-oriented approach. But MySQLi also provides a procedural way which is like old MySQL extension. We can also say MySQLi STANDS for improved MySQL.

5.

Do you knows the cURL in PHP?

Answer»

Do you knows the cURL in PHP?
cURL is one of the library in PHP which BASICALLY helps to CREATE a HTTP REQUESTS from the SERVER. Or we can ALSO say it allows to make HTTP requests.

6.

Do you some idea about T_PAAMAYIM_NEKUDOTAYIM in PHP?

Answer»

Do you some idea about T_PAAMAYIM_NEKUDOTAYIM in PHP?
T_PAAMAYIM_NEKUDOTAYIM in PHP is one of the scope resolution OPERATOR used as double COLON(::). And in PHP we used this to CALL static methods/variable of a class. Below is the syntax or code for the same:-
$Cache::getconfig($KEY);

7.

Choose the correct option from below list PHP resemble with programming Language?

Answer»

Choose the CORRECT option from below list PHP RESEMBLE with PROGRAMMING Language?
SELECT the correct option from below list
(1)Java and Javascript
(2)Perl and C
(3)C and c++
(4)Perl and VB

Answer:-(2)Perl and C

8.

Define 13 most common and important types of errors available in PHP?

Answer»

Define 13 most COMMON and important TYPES of errors available in PHP?
Below are the 13 most common types of errors available in PHP:-
(1)E_ERROR:-This is a fatal error which will causes script termination.
(2)E_WARNING:-This is run-time warning that which will not cause script termination.
(3)E_PARSE:-This is type of Compile time parse error.
(4)E_NOTICE:-This is a run time notice caused due to error in code.
(5)E_CODE_ERROR:-THis is Fatal errors which will USUALLY occur during PHP initial startup(At time of installation).
(6)E_CORE_WARNING:-THis is a warning which will usually occur during PHP initial startup.
(7)E_COMPILE_ERROR:-This is Fatal compile-time errors indication problem with script.
(8)E_USER_ERROR:-This is one of the user generated error message.
(9)E_USER_WARNING:-This is user generated warning message.
(10)E_USER_NOTICE:-THis is a user generated notice message.
(11)E_STRICT:-THis is one of the Run-time notices.
(12)E_RECOVERABLE_ERROR:-This is a catchable fatal error indicating a dangerous error.
(13)E_ALL:-This will catches all errors and warnings.

9.

Can we increase execution time of a PHP script?

Answer»

Can we increase execution time of a PHP script?
Yes, we can increase PHP script time. Default max execution time for PHP scripts is BASICALLY 30 SECONDS. And if a PHP script runs longer than 30 seconds then PHP STOP script and will produce error.
And we can increase this time to reduce the chance of error for time. We can increase the execution time by changing max_execution_time directive in our php.ini file. or we can call ini_set('max_execution_time',240);
which is EQUAL to 4 min and it is called at the TOP of our PHP script.

10.

Write down some facts about PHP?

Answer» WRITE down some FACTS about PHP?
Below are the some GOOD facts about the PHP
11.

Code to run PHP script from command line?

Answer»

Code to RUN PHP script from COMMAND line?
To run PHP script from command line we just OPEN PHP command line INTERFACE(CLI) and specify the filename of script and run below command:-

php scriptname.php

12.

How PHP handles Cookies?

Answer»

How PHP handles Cookies?
In PHP we generally used cookie to IDENTIFY a user. Cookie is little records that server stores on client computer. When the same PC asks for a page it will send the cookie as well. And with the help of PHP we can create and recover cookie values. Below are the some important aspects of cookies in PHP:-
(1)We can create 20 cookies per site or web app
(2)Initial size block for cookies is 50 bytes.
(3)And maximum size of cookie is 4096 bytes.
(4)By default cookies are temporary and transitory cookie saves in the browser only.
(5)Cookies are URL particular means not for gmail and YAHOO
(6)We can only stores string values not objects because not possible to access any objects across the websites or webapp
(7)Cookies will maintain SESSION id at back end after verify user identity in the encrypted form and it should be reside in browser of machine.

13.

What is NULL Value in PHP define with example?

Answer»

What is NULL VALUE in PHP define with example?
In PHP NULL is a special data TYPE which have only one value that is NULL. NULL data type is a variable that have no value assigned. When we create a variable without assigning a value to it. Then it will assigned a value of NULL automatically. We can also do by setting value as Null.
NULL is no a case SENSITIVE in PHP and below are the method to declared a NULL data type:-

(i)Case Sensitive
$var = NULL;
or
$var = null;

(ii)null values other facts use decrement
$x = null;
--$x; //$x is NULL no decrement
$x--; //$x is STILL null
$x-=1 //$ now it is -1


(iii)Use increment
$x = null;
++$x; //$x is 1

14.

How PHP interact with HTML with details?

Answer»

How PHP interact with HTML with details?
Here i will exaplin how .php FILES get processed by the PHP PROCESSOR below are some steps
(1)First of all user browser request webpage ending with .php extension and send request to server for that webpage.
(2)Server check this page if server does not find it it will sends back error.
(3)In next step if server will page will check extension of page if it is .html or .php
(4)If it is .html then server will send back that page to browser
(5)If it is .php then this page will handover to PHP processor.
(6)Now functioning of PHP processor starts it will scans the page line by line. And it will processes HTML page.
(7)If processor find HTML it passes that on as part of the processed HTML page it is building.
(8)If PHP script is there on the page the PHP processor may or may not output HTML.
(9)When PHP processor is done then processed page is handed to WEB server for sending to browser.

15.

Type of inheritance that php supports

Answer»

In PHP an extended class is ALWAYS dependent on a single base class, that is, MULTIPLE inheritance is not supported. CLASSES are extended using the keyword 'extends'.

16.

Different types of errors in PHP

Answer»

Below are the some common types of ERRORS in php:-
(1)E_ERROR: A fatal error that causes script termination
(2)E_WARNING: Run-time warning that does not cause script termination
(3)E_PARSE: COMPILE time parse error.
(4)E_NOTICE: Run time notice caused due to error in code
(5)E_CORE_ERROR: Fatal errors that occur during PHP's initial startup (installation)
(6)E_CORE_WARNING: Warnings that occur during PHP's initial startup
(7)E_COMPILE_ERROR: Fatal compile-time errors indication problem with script.
(8)E_USER_ERROR: User-generated error message.
(9)E_USER_WARNING: User-generated warning message.
(10)E_USER_NOTICE: User-generated notice message.
(11)E_STRICT: Run-time notices.
(12)E_RECOVERABLE_ERROR: CATCHABLE fatal error indicating a DANGEROUS error
(13)E_ALL: Catches all errors and warnings

17.

Advanced Multiple Choice Questions on PHP

Answer»

Below are the list of multiple choice question on php with answers

1. Version introduced the ADVANCED concepts of OOP of PHP?
a) PHP 4
b) PHP 5
c) PHP 5.3
d) PHP 6

2. Magic method used to help overloading in PHP?
a) __call
b) __invoke
c) __wakeup
d) __unset

3. Method is used to tweak an OBJECTS cloning behavior?
a) clone()
b) __clone()
c) _clone
d) object_clone()

4. If object must inherit behavior from a number of sources you must use a/an
a) Interface
b) Object
c) ABSTRACT class
d) Static class

5. Class from which the child class inherits is called..
i) Child class
ii) Parent class
III) Super class
iv) Base class
a) Only i)
b) ii), iii) and iv)
c) Only iii)
d) ii) and iv)

6. Which of the below advanced OOP features is/are not supported by PHP?
i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
a) All of the mentioned
b) None of the mentioned
c) i) and ii)
d) iii) and iv)

7. Which is the right way to clone an object?
a) _clone(targetObject);
b) destinationObject = clone targetObject;
c) destinationObject = _clone(targetObject);
d) destinationObject = clone(targetObject);

8. To create a model that will be assumed by a number of closely related objects, which class must be used?
a) Normal class
b) Static class
c) Abstract class
d) Interface

9. Which feature of call more than one method or FUNCTION of the class in single instruction?
a) Typecasting
b) Method Including
c) Method adding
d) Method chaining

Answer:-
(1)b
(2)a
(3)b
(4)a
(5)d
(6)c
(7)b
(8)c
(9)d

18.

Which function stores value of session in cookies

Answer»

setcookie() function help US to store VALUE of session in COOKIES

19.

PEAR in PHP

Answer»

PEAR is short for PHP Extension and Application Repository . It is the next revolution in PHP. It is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated WIZARD, and packing the STRENGTH and EXPERIENCE of PHP USERS into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install "packages"

20.

what are the Areas of application of PHP

Answer»

Below are the areas of possibility of PHP and the funcationality that we can do.
(1)Generating PDF files.
(2)Creating WordPress Plugins.
(3)For PROCESSING and generating images.
(4)Creating mailing lists.
(5)Designing applications (apps).
(6)Building an online community.
(7)For creating graphs and charts.
(8)For creating dynamic website TEMPLATES.
(9)It is a good Project Management tool.
(10)For web applications.

21.

Difference between HTML and PHP

Answer»

Below are the some of main differences between html and php and also have defination for both of them

HTMLPHP
HTML is a markup language and not a programming language. HTMl is Markup language which have SET of mark up tags and HTML which uses markup tags which are usually called HTML tags to understand web pages. HTML documents describe web pages and they contain HTML tags and plain text. HTML tags could be identified easily in a HTML document since they are surrounded by angle BRACKETS. HTML tags are typically inserted in to a document in PAIRS, where the first tag is the start tag (< b>) and the second tag is the end tag (< /b>). The task of a web browser (e.g. Internet Explorer, Firefox, etc.) is to read a HTML document and display it as a web page. The browser uses the HTML tags to interpret the content of the page and the HTML tags themselves are not displayed by the browser. HTML pages can embed images, objects and scripts written in languages like JavaScript. Further, HTML can be used to create interactive forms.As mentioned earlier, PHP is a SCRIPTING language that is specially suited for developing dynamic web pages. PHP is open source software and it is free to download and use. PHP scripts are executed on the web SERVER. PHP code in a requested file is executed by the PHP runtime and creates the dynamic web page content. PHP can be deployed in most web servers (Apache, IIS, etc.) and runs on different platforms such as Windows, Linux, UNIX, etc. PHP can also be used with many Relational Database Management Systems (RDBMS). Even though PHP was originally designed for creating dynamic web pages, it now focuses mainly on server-side scripting where it provides dynamic content from a web server to a client. PHP files can contain text, HTML tags and scripts. PHP files are processed by the web server and returned back to the browser as plain HTML. PHP files can be identified with the file extensions .php , .php3?, or .phtml
22.

What about multiple inheritance supported in PHP

Answer» PHP only support SINGLE INHERITANCE which means we can only extend only ONE single class by the help of keyword EXTENDED.
23.

Why Overloading concepts is not in php

Answer»

As all of us know OVERLOADING is concept of variable type and in PHP DATA type can be VARY

24.

difference between echo and print

Answer» ECHO is command
Print is function

echo is much much FASTER than print
When we use print it will return true(1) or false(0) or some VALUES and its SLOWER then echo.
25.

method to past value from one page to another in php

Answer»

There are MAINLY FIVE methods to transfer value from ONE PAGE to another these are as Belows
1.POST
2.GET
3.SESSION
4.COOKIES
5.QUERY STRING

26.

differenc between mysql_connect and mysql_pconnect

Answer»

mysql_connect OPENS up a database connection EVERY time a page is loaded. mysql_pconnect opens up a connection, and KEEPS it open ACROSS multiple requests.

mysql_pconnect uses less resources, because it does not need to establish a database connection every time a page is loaded.

27.

What is htaccess file

Answer»

.htaccess is are configuration files which is in Apache Server and basic function of this FILE is to make configuration changes on a per-DIRECTORY basis. If a file CONTAINING more then one configuration files in a DIRECTIVES and it is placed in a particular document directory and the directives apply to that directory and all SUBDIRECTORIES thereof.

28.

Code to combine or concatenate two variables in php

Answer»

Below are TWO SAMPLE to combine two variable sample 1 will work significantly faster. To try it we take large sets of DATA and we will see that concatenation WORKS significantly faster than variable substitution.
$var1 = 'Interview Question On';
$var2 = 'getproductprice.com';
Sample1:-
$VAR 3 = $var1.$var2;

Sample2:-
$var 3 = $var1$var2;

29.

PHP is most similar to which language

Answer» PERL and C are most SIMILAR to PHP
30.

Difference between asp.net and php

Answer»

Below are the some of common difference between PHP and ASP.NET both are very simple and attractive.

PHP.NET
DatabaseFor point of database connectivity PHP uses MySQL for the purpose of database connectivitybecasue its highly flexiblilty nature. Another IMPORTANT fact is that it will incurextra expenditure because MySQL can be accessed for free. ASP.Net uses MS-SQL for connecting database but MS-SQL can not be availed free fromMicrosoft.
CostLinux can be used for running PHP programs and Linux is free operating system. Therefore,the cost of developing a WEBSITE in PHP language is remarkably lowWe need to install Internet Information Server (IIS)on a Windows server platformif you want to run ASP.Net program. As Windows server platform is not a free product,the cost of production is bounded to be increased.
Run Time
It has been observed that ASP.Net code runs slower than PHP code. This is becauseASP.Net utilizes server space while running whereas inbuilt memory space is usedby PHP while running.
Coding Simplicity
PHP codes are very simple and a programmer does not haveto make a diligent effort because it is comparatively easier than other types ofprogramming languages.ASP.Net codes are somewhat complicated and a web developer needs to work hard toget the hang of it
Platform Connectivity ISSUE
PHP has a unique advantagein this issue. Its codes can be linked with different types of platforms such asWindows, Linux and UNIX.ASP codes are usually run on Windows platforms but if you install ASP-Apache inthe server than it can run on Linux platform as well.
Cost of Tools
PHP codes are available for free in various forums and BLOGS as it is a open sourcesoftware. Furthermore, some useful tools that can be used in PHP are also availablefor free. There is no such free tools are available for ASP.Net.
Language Support
The codes that are used in PHP are very much similar to that of C++ language andits syntax RESEMBLES the syntax used in C and C++. Therefore, if you have a fair knowledge in C++ or C, you will not face any difficulty while coding PHP language.The syntax of ASP is more or less similar to that of Visual basic syntaxand this is all but simple.
Security
Though PHP can offer enough measures for ensuring data securityASP. Net is reputedfor creating sophisticated techniques to ensure the safety of confidential data.This is the reason why government organizations opt for ASP.Net.