PHP interview Question Part-2
|
1) What are the current versions
of apache, PHP, and mysql?
PHP -5.1.2 Mysql -5.1 Apache - 2 Wamp -1.7.3 2) What is the difference between the functions UNLINK and UNSET? Unset destroy the variable declared earlier. Unlink is used to delete a file. 3) How can we increase the execution time of a PHP script? Set_time_limit is used to increase the execution time of a PHP script. The programmer can specify the time limit. When the requird time reached it indicates fatal error. 4) How can we get the browser properties using PHP? $_SERVER['HTTP_USER_AGENT']; 5) How can we send mail using JavaScript? function myfunction(form) { tdata=document.myform.tbox1.value; location=?mailto:dep7abc@leeds.ac.uk? subject=?+tdata+?/MYFORM?; return true; } 6) What is PHP? It is server side scripting, which help to create dynamic pages. When a user opens the page, the PHP command is processed in the server side and the result displayed on the user window. 7) What is htaccess? Htaccess is a configuration file that allows to change the configuration on pre-directory basis. 8) What is the difference between developing website using jsp and PHP JSP is not an opensource whereas PHP is opensource. JSP is compiler based and PHP is interpretor based scripting language. PHP in developing web page while JSP is mainly used for distributed system 9) What are magic quotes in PHP? Special characters like single double quote( “”) quote( ' ) amperson ( & ) are called as magic quotes. 10) How to prevent from hijacking in PHP? By setting the register_global to off inorder to prevent from entering malicious data. Set the error_reporting to E_All which initialize the variable before making use of them. Practice using mysql_escape_string() 11) Explain about PHP cookies? Cookies are present in the desktop of the user. Everytime the user view the same page it is able to retrieve the data soon. PHP enable the programmer to create information and also to retrieve. This can be done using setcookie() function. 12) What is a session? A logical object developed by the PHP engine inorder to preserve the data for subsequent request is called session. The main purpose of the session is to store the temporary data allow multiple PHP pages to offer a complete functional transaction for the same visitor. 13) What is a persistent cookie? A cookie that is stored in a cookie file permanently is called persistent cookie. This is useful for long term information tracking. 14) What is the difference between copy of a file and Move_upload_file in file uploading? This function checks to check whether the designated file is a valid upload file. If it is a valid file then it could be moved to the specified designation. 15) How do you create subdomains using PHP? 1) Restart httpd 2) Edit httpd.conf 16) What is properties in PHP? Variables declared in the program is termed as properties. Variables are also referred as fields or arrribute. Variables are declared using the following keyword Private Protected Public 17) What is type hinting? Type hinting is the new function introduced in PHP 5.This function makes the parameter to be an object or array. 18) How to create a table? Tabel creation can be done using the following syntax include "tablecreation.php"; $ sql = "CREATE TABLE fyi_links (" " id INTEGER NOT NULL" ", url VARCHAR(80) NOT NULL" ", notes VARCHAR(1024)" ", counts INTEGER" ", time TIMESTAMP DEFAULT sysdate()" ")"; if (mysql_query($sql, $con)) { print("Table fyi_links created. "); } else { print("Table creation failed. "); } mysql_close($con); ?> 19) Explain about the data types in PHP? PHP has 6 scalar data types:- Integer Binary Float Boolean String Unicode 20) What about compound data types in PHP? PHP consist of two data types:- Array Object 21) Explain special data types in PHP? Data types that don’t fall into scalar and compound types is said to be special data types. Null Resource 22) How to change data types with casting? Casting is used to change the value type. It just changes the type of the value but the original value remains untouched. 23) What is loose typing in PHP? Languages such as java it is not possible to change the type of the variable they are said to be strongly typed whereas PHP are loosely typed meaning the type of the data can be changed in the later stage. 24) What is the difference between $message and $$message? $$message is reference variable whereas $message is just a fixed variable. 25) What are the different tables present in MySQL? Different tables that are present in MySQL are 1.ISAM 2.MyISAM 3.Merge 4.Heap 5.INNODB
---------------------------------------------------------------------------------
Posted By Sundeep aka SunTechie
Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on
|
PHP interview Question Part-2
Posted on:
18:11
tags:
job interview questions
,
php
,
PHP interview Question Part-1
,
php technical questions
,
tcs
,
Technical Question
PHP interview Question Part-1
Posted on:
18:09
tags:
job interview questions
,
php
,
PHP interview Question Part-1
,
php technical questions
,
tcs
,
Technical Question
PHP interview Question Part-1
|
1) What is the difference between
"echo" and "print" in PHP?
Print is not a constructor whereas echo is a constructor.
Print can take argument whereas with echo it is doesn’t support
to take arguments.
2) Which will execute faster POST or GET? Explain
POST is much secured when compared to the GET method.
Since it as secured method it require to pass more test then the normal GET
method.
3) what are the new features that are added in PHP5?
1) PHP5 introduces SPL that provide a range of classes and
interface.
2) Contains access modifier.
3) It offers built in interface in addition to built in
class.
4) It support OOPS concept.
4) What is the purpose of ob_start() ?
OB_start() turn on the output buffer. While the
buffer is on, no output is sent rather it is stored in the internal buffer.
Inorder to get content from output Ob_get_content function can be used.
5) How to call C function within PHP?
Not all C function can be called to PHP. Function
such as fputs() fgetc() fwrite() exit() printf().
6) what is the use of header function in PHP?
The main purpose of the header function is that it
redirect to the file that contains the information. More then this sometime
header file are also responsible for authentication.
7 ) What is difference between require_once(), require(), include().
Because above three function usually use to call a file in
another file.
require() produces a FATAL ERROR, if the file you want to
include is not found.
include() just send a warining msg.
8) While in case of download, How will you make a percentage bar showing
current status of total 100%?
Following procedure help to show the processing bar while
download
Percentage can be displayed using image
Changing the width will help to change depending on the
process completed.
9) Where does the session stored, either client side or server side?
PHP Session is used to maintain client's previous state
and the session is stored on the server side.
10) Can you submit a form without using submit button ? If Yes, How?
If you don't want to use the Submit button to submit a
form, you can use normal hyper links to submit a form. But you need to use
some JavaScript code in the URL of the link.
11) How do you upload videos using PHP & MySQL?
For uploading videos you need not store the video in
database. Just you store the video path in database. You store the videos in
a separate folder like video_uploads. After uploading you can call those
videos from the video_uploads folder via MySQL ie the path is already stored
in database. And one more thing if the file size is more than 2MB the file is
not successfully uploaded. For that you need to change the max_file size in
php.ini file.
12) How to access crystal reports through PHP code
1. If you run PHP on Windows, call Crystal Reports as a
COM object.
2. Regardless of your OS, you should still be able to use
Crystal Reports Web services and for this you may have to use NuSOAP to access
and utilized these service..
13) What is pear in PHP?
PEAR stands for PHP Extension And Repository. It is an
advancement of the script. This help to develop better code that accompany
more features.
14) How can I use the COM components in php?
$obj1Com = new COM(“AddNumber.math”);
$res = $obj1Com ->AddNum(2,2);
echo $res;
?>
15) How can I execute a PHP script using command line?
PHP script using command line can be executed using SAPI
(Server Application programming Interface). Using SAPI
Command Line Interface the PHP code can be passed to
execute
directly
Example:
Php –r ‘print_r(get_defined_constanrs());’
16) What are the different types of Errors in PHP?
17) What is meant by nl2br()?
Nl2br() stands for next line to break tag.
18) What is PHP?
PHP is a server side scripting language, is simple and
powerful to create a dynamic web page.
19) How can we convert the time zones using PHP?
Converting the tie zone can be done using the following
syntax. date_default_timezone_set function on PHP 5.1.0
20) What is meant by urlencode and urldocode?
urlencode(): encode url
urldecode(): decode encoded url to original form
21) How to get the session id in PHP?
Inorder to get the current session ID the following syntax
can be used
Session_id()
22) Name some of the functions in IMAP and LDAP?
IMAP function:- (Internet Message Access protocol)
imap_open
imap_list
LDAP function:- (Light weight Directory Access protocol)
ldap_search
ldap_connect
24) How can we encrypt the username and password using PHP?
It is possible to encrypt the username and
password using base64_encode().
25) What is the PHP predefined variable that tells the What types of
images that PHP supports?
PHP provides a large number of predefined
variables to all scripts. The variables represent everything from external
variables to built-in environment variables, last error messages to last
retrieved headers.
|
---------------------------------------------------------------------------------
Posted By Sundeep aka SunTechie
Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on
Showing posts with label job interview questions. Show all posts
Subscribe to:
Posts (Atom)

