These material are compiled for helping junior / senior software engineers and others.
1. What are the differences between GET and POST methods in form
submitting, give the case where we can use get and we can
use post methods?
On the server side, the main difference between GET and POST is where the submitted is stored.
The $_GET array stores data submitted by the GET method. The $_POST arrray
stores data submitted by the POST method.
On the browser side, the difference is that data submitted by the GET method will be
displayed in the browser's address field. Data submitted by the POST method will not
be displayed anywhere on the browser.
GET method is mostly used for submitting a small amount and less sensitive data.
POST method is mostly used for submitting a large amount or sensitive data.
2. Who is the father of php and explain the changes in php versions?
Rasmus Lerdorf for version changes goto http://php.net/
3. How can we submit form without a submit button?
We can use a simple JavaScript code linked to an event trigger of any form field.
In the JavaScript code, we can call the document.form.submit() function to submit
the form. For example:
4. How many ways we can retrieve the date in result set of mysql using
php?
As individual objects so single record or as a set or arrays.
5. What is the difference between mysql_fetch_object and
mysql_fetch_array?
MySQL fetch object will collect first single matching record where
mysql_fetch_array will collect all matching records from
the table in an array
6. What is the difference between $message and $$message?
They are both variables. But $message is a variable with a fixed name.
$$message is a variable who's name is stored in $message. For example,
if $message contains "var", $$message is the same as $var.
7. How can we extract string 'abc.com ' from a string
http://info@abc.com using regular expression of php?
We can use the preg_match() function with "/.*@(.*)$/" as
the regular expression pattern. For example:
preg_match("/.*@(.*)$/","http://info@abc.com",$data);
echo $data[1];
8. How can we create a database using php and mysql?
mysql_create_db()
9. What are the differences between require and include, include_once?
File will not be included more than once.
If we want to include a file once only and further calling of the file
will be ignored then we have to use the PHP function
include_once(). This will prevent problems with function redefinitions,
variable value reassignments, etc.
10. Can we use include ("abc.php") two times in a php page "makeit.php"?
Yes we can include..
11. What are the different tables present in mysql, which type of table
is generated when we are creating a table in the
following syntax: create table employee(eno int(2),ename varchar(10)) ?
Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. InnoDB
5. ISAM
6. BDB
MyISAM is the default storage engine as of MySQL 3.23.
12. Functions in IMAP, POP3 AND LDAP?
?
13. How can I execute a PHP script using command line?
Just run the PHP CLI (Command Line Interface) program and provide the
PHP script file name as the command line argument. For example,
"php myScript.php", assuming "php" is the command to invoke the CLI program.
Be aware that if your PHP script was written for the Web CGI interface,
it may not execute properly in command line environment.
14. Suppose your Zend engine supports the mode <? ?>. Then how can you configure your php Zend engine to support <?php ?> mode?
?
15. Shopping cart online validation i.e. how can we configure the
paypals?
?
16. What is meant by nl2br()?
nl2br inserts a HTML line break tag <br/ > before each new line character "\n" in a string.
For example: echo nl2br("god bless\n you") will output "god bless \n you" to your browser.
17. Draw the architecture of Zend engine?
?
18. What are the current versions of apache, php, and mysql?
?
19. What are the reasons for selecting lamp (linux, apache, mysql, php)
instead of combination of other software programmes,
servers and operating systems?
?
20. How can we encrypt and decrypt a data present in a mysql table using
mysql?
AES_ENCRYPT() and AES_DECRYPT()
21. How can we encrypt the username and password using PHP?
You can encrypt a password with the following
Mysql>SET PASSWORD=PASSWORD("Password");
22. What are the features and advantages of OBJECT ORIENTED PROGRAMMING?
?
23. What are the differences between PROCEDURE ORIENTED LANGUAGES AND
OBJECT ORIENTED LANGUAGES?
?
24. What is the use of friend function?
?
25. What are the differences between public, private, protected, static,
transient, final and volatile?
?
26. What are the different types of errors in PHP?
Three are three types of errors:
1. Notices: These are trivial, non-critical errors that PHP
encounters while executing a script - for example, accessing a
variable that has not yet been defined. By default, such errors are not
displayed to the user at all - although, as you will
see, you can change this default behaviour.
2. Warnings: These are more serious errors - for example, attempting
to include() a file which does not exist. By default,
these errors are displayed to the user, but they do not result in script
termination.
3. Fatal errors: These are critical errors - for example,
instantiating an object of a non-existent class, or calling a
non-existent function. These errors cause the immediate termination of
the script, and PHP's default behaviour is to display
them to the user when they take place.
27. What is the functionality of the function strstr and stristr?
strstr() returns part of a given string from the first occurrence of a given
substring to the end of the string. For example: strstr("user@example.com","@")
will return "@example.com".
stristr() is idential to strstr() except that it is case insensitive.
28. What are the differences between PHP 3 and PHP 4 and PHP 5?
Go read the release notes at http://php.net.
29. How can we convert asp pages to PHP pages?
You can download asp2php front end application from the site
http://asp2php.naken.cc.
30. What is the functionality of the function htmlentities?
?
31. How can we get second of the current time using date function?
?
32. How can we convert the time zones using php?
?
33. What is meant by urlencode and urldecode?
urlencode() returns the URL encoded version of the given string. URL coding
converts special characters into % signs followed by two hex digits.
For example: urlencode("10.00%") will return "10%2E00%25".
URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.
34. What is the difference between the functions unlink and unset?
unlink() deletes the given file from the file system.
unset() makes a variable undefined.
35. How can we register the variables into a session?
We can use the session_register($ur_session_var) function.
36. How can we get the properties (size, type, width, height) of an
image using php image functions?
?
37. How can we get the browser properties using php?
?
38. What is the maximum size of a file that can be uploaded using php
and how can we change this?
?
39. How can we increase the execution time of a php script?
?
40. How can we take a backup of a mysql table and how can we restore it?
?
41. How can we optimize or increase the speed of a mysql select query?
?
42. How many ways can we get the value of current session id?
session_id() returns the session id for the current session.
43. How can we destroy the session, how can we unset the variable of a
session?
session_unregister() unregisters a global variable from the current
session
session_unset() frees all session variables
44. How can we destroy the cookie?
Set the cookie in past.
45. How many ways we can pass the variable through the navigation
between the pages?
At least 3 ways:
a) Register the variable into the session
b) Pass the variable as a cookie
c) Pass the variable as part of the URL
46. What is the difference between ereg_replace() and eregi_replace()?
eregi_replace() function is identical to ereg_replace() except that this
ignores case distinction when matching alphabetic
characters.
47. What are the different functions in sorting an array?
48. How can we know the count/number of elements of an array?
2 ways:
a) sizeof($urarray) This function is an alias of count()
b) count($urarray)
Interestingly if u just pass a simple var instead of a an array it will
return 1.
48. How can we know the count/number of elements of an array?
?
49. What is the php predefined variable that tells the What types of
images that php supports?
?
50. How can I know that a variable is a number or not using a
JavaScript?
51. List out some tools through which we can draw E-R diagrams for
mysql.
?
52. How can I retrieve values from one database server and store them in
other database server using php?
?
53. List out the predefined classes in PHP?
?
54. How can I make a script that can be bilanguage (supports English,
German)?
?
55. What are the difference between abstract class and interface?
?
57. How can we repair a mysql table?
?
58. What are the advantages of stored procedures, triggers, indexes?
?
59. What is the maximum length of a table name, database name, and
fieldname in mysql?
?
60. How many values can the SET function of mysql takes?
?
61. What are the other commands to know the structure of table using
mysql commands except explain command?
?
62. How many tables will create when we create table, what are they?
?
63. What is the purpose of the following files having extensions
1) frm, 2) MYD, and 3) MYI. What these files contain?
In MySql, the default table type is MyISAM.
Each MyISAM table is stored on disk in three files. The files have names
that begin with the table name and have an extension
to indicate the file type.
The `.frm' file stores the table definition.
The data file has a `.MYD' (MYData) extension.
The index file has a `.MYI' (MYIndex) extension,
63. What is the purpose of the following files having extensions
1) frm, 2) MYD, and 3) MYI. What these files contain?
?
64. What is maximum size of a database in mysql?
?
65. Give the syntax of Grant and Revoke commands?
?
66. Explain Normalization concept?
?
67. How can we find the number of rows in a table using mysql?
?
68. How can we find the number of rows in a result set using php?
?
69. How many ways we can we find the current date using mysql?
?
70. What are the advantages and disadvantages of CASCADE STYLE SHEETS?
?
71. What type of inheritance that php supports?
?
72. How can increase the performance of mysql select query?
The structure of table view buyers is as follows
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| user_pri_id | int(15) | | PRI | NULL | auto_increment |
| userid | varchar(10) | YES | | NULL | |
+----------------+-------------+------+-----+---------+----------------+
the value of user_pri_id the last row 2345 then What will happen in the
following conditions
Condition1: Delete all the rows and insert another row then What is the
starting value for this auto incremented field
user_pri_id ,
Condition2: Delete the last row(having the field value 2345) and insert
another row then What is the value for this auto
incremented field user_pri_id
73. What are the advantages/disadvantages of mysql and php?
?
74. What is the difference between GROUP BY and ORDER BY in Sql?
?
75. What is the difference between char and varchar data types?
?
76. What is the functionality of md5 function in php?
?
77. How can I load data from a text file into a table?
?
78. How can we know the number of days between two given dates using
mysql?
?
79. How can we know the number of days between two given dates using
php?
?
80. How can we change the name of a column of a table?
?
81. How can we change the name and data type of a column of a table?
?
82. What are the differences between drop a table and truncate a table?
?
83. When you want to show some part of a text displayed on an HTML page
in red font color, what different possibilities are
there to do this? What are the advantages/disadvantages of these
methods?
?
84. When viewing an HTML page in a Browser, the Browser often keeps this
page in its cache. What can be possible
advantages/disadvantages of page caching? How can you prevent caching of
a certain page (please give several alternate
solutions)?
?
85. What are the different methods of passing data or information
between two calls of a web page? What are the
advantages/disadvantages of these methods?
?
86. An Apache web server is running on a Linux system. Suddenly, the web
server delivers the pages very slow. How could you
find out possible reasons for that (when using system commands, please
specify their names)?
?
87. What are the different ways to login to a remote server? Explain the
means, advantages and disadvantages?
?
88. Please give a regular expression (preferably Perl/PREG style), which
can be used to identify the URL from within a HTML
link tag. Example: The regular expression should match the tag A
HREF="../../www.yoursite.com/default.htm">/a and give the URL
("http://www.yoursite.com /") as a return result. Tags should also be
matched if they contain other attributes than the HREF
attribute.
?
89. A select query over a large table runs very slow because of the
growing number of entries in that table. What different
measures could be taken to improve speed?
?
90. A company wants to store their invoices in a database. They already
have their customers and articles in that database.
Both customer and article are each identified by an unique integer
value. Please create the SQL statements for creating the
necessary table(s) for storing the invoices in a MySQL database. An
invoice should hold information like invoice number,
customer, date, article(s) and quantity etc.
?
91. For the database from the previous question, please give an SQL
query which returns the invoice number of all invoices
which contain the article with the number "1234". The query should be
able to run under a MySQL 4.0 database.
?
92. How would you backup and restore a big MySQL database? What are the
advantages of the approach which you have taken over
the others?
?
93. Create a PHP web script with the following attributes: on start,
three HTML form elements are shown: an string input
field, a checkbox field, a dropdown/pull down list with 5 elements and a
submit button. On submission, the form should be
redisplayed (while remaining all options/inputs as the user has
selected/entered them). Additionally, the selections/inputs
of the user should be displayed in text. Please solve this without the
use of any external libraries.
?
94. What is meant by MIME?
?
95. What is meant by PEAR in php?
PEAR is the next revolution in PHP. This repository is bringing higher
level programming to PHP. PEAR 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"
96. How can I use the COM components in php?
?
97. How can I load a DLL dynamically?
?
98. How many ways we can give the output to a browser?
?
99. How can we know that a session is started or not?
?
100. What is the default session time in php and how can I change it?
?
101. What changes I have to done in php.ini file for file uploading?
?
102. What are the differences between mysql_fetch_array(),
mysql_fetch_object(), mysql_fetch_row()?
?
103. How can I set a cron and how can i execute it in Unix, Linux, and
windows?
?
104. Steps for the payment gateway processing?
?
105. How many ways I can register the variables into session?
?
106. Explain different types of errors in php (i.e. arguments in
errorreporting function)?
?
107. How many ways I can redirect a php page?
?
108. List out different arguments in php header function?
?
109. What type of headers have to add in the mail function in which file
a attached?
?
110. What is the difference between >?php and >? And which can be
preferable
?
111. What are the differences between php3 and php4 versions?
?
112. What are the differences between include() and include_once()
functions?
?
113. Describe the importance of DABA BASE ABSTRACTION LAYERS in php and
database connection?
?
114. Explain mysql optimization?
?
115. What is the difference between using copy() and move() function in
php file uploading?
?
116. What is the difference between Reply-to and Return-path in the
headers of a mail function?
?
117. Explain about Type Juggling in php?
?
118. How can I get the only name of the current executing file?
?
119. How can I embed a java programme in php file and what changes have
to be done in php.ini file?
?
120. How can I find what type of images that the php version supports?
?
121. The table tbl_sites contains the following data:
-----------------------------------------------------
Userid sitename country
------------------------------------------------------
1 sureshbabu indian
2 phpprogrammer andhra
3 php.net usa
4 phptalk.com germany
5 mysql.com usa
6 sureshbabu canada
7 phpbuddy.com pakistan
8. phptalk.com austria
9. phpfreaks.com sourthafrica
10. phpsupport.net russia
11. sureshbabu australia
12. sureshbabu nepal
13. phptalk.com italy
How to get a list of sitenames that listed more than once in the table?
Use the following query:
select sitename, count(*) from tbl_sites group by sitename having count(*) > 1
122. How can we send mail using JavaScript?
No. You can't send mail using Javascript. But you can execute a client side
email client to send the email using mailto: code.
Using clientside email client
function myfunction(form)
{
tdata=document.myform.tbox1.value;
location="mailto:mailid@domain.com?subject="+tdata+"/MYFORM";
return true;
}
Sources :
DEVFYI - Developer Resource - FYI
TechGuider - techguider from 1asphost