SlideShare a Scribd company logo
1 of 16
PHP QUESTIONS AND ANSWERS
1)<?php
$x=array("aaa","ttt","www","ttt","yyy","tttt");
$y=array_count_values($x);
echo $y[ttt];
?>
a)2 Ans
b)3
c)1
d)4
Show Answer
2) How do you get information from a form that is submitted using the "get" method?
a)$_GET[]; Ans
b)Request.Form;
c)Request.QueryString;
d)$_POST[];
Show Answer
3)What's the best way to copy a file from within a piece of PHP?
a) Print out a message asking your user to "telnet" in to the server and copy the file for you
b) Open the input and output files, and use read() and write() to copy the data block by block until read
c) Use the built in copy() function (Answer)
d) Use "exec" to run an operating system command such as cp (Unix, Linux) or copy (Windows)
Show Answer
4) PHP code is embedded directly into XHTML document?
a) False
b) True Ans
Show Answer
5) Is it possible to submit a form with out a submit button?
a) Yes Ans
b) No
Show Answer
6) Full form of PHP
a) PreHypertextProcessor
b) HypertextPreprocessor Ans
c) Hypertext Postprocessor
d) PostHypertextProcessor
Show Answer
7) What is the expansion of LAMP?
a) Linux And Mysql Php
b) Linux Apache Mysql Php ans
Show Answer
8) In php Which method is used to getting browser properties?
a) $_SERVER['HTTP_USER_AGENT']; ans
b) $_SERVER['PHP_SELF']
c) $_SERVER['SERVER_NAME']
d) $_SERVER['HTTP_VARIENT']
Show Answer
9) Which of the following function is used to pick one or more random values from PHP Array?
a) array_rand() ans
b) array_random()
c) Random_array()
d) Rand_array()
Show Answer
10) <?php
$x=array(1,3,2,3,7,8,9,7,3);
$y=array_count_values($x);
echo $y[8];
?>
a) 43
b) 1 ans
c) 8
d) 6
Show Answer
11) Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you
used $_SERVER['PHP_SELF'] function in your page, then what is the return value of this function ?
a) phptutor/index.php
b) /phptutor/index.php ans
c) c:/apache/htdocs/phptutor/index.php
d) index.php
Show Answer
12) Which operator is used to concatenate two strings in php?
a) dot operator (.) ans
b) plus operator (+)
Show Answer
13)Are there regular expressions in PHP?
a) Yes - regular expressions use Perl-like conventions
b) Yes - PHP supports two different types of regular expressions: POSIX-extended and Perl-Compatib
(PCRE). ans
c) Yes - regular expressions use the POSIX standard
d) No - PHP uses "glob" style matching only
Show Answer
14) In PHP, which of the following function is used to insert content of one php file into another php file
a) include[]
b) #include()
c) include()
d) #include{}
Show Answer
15) what will be the ouput of below code ? Assume that today is 2009-5-19:2:45:32 pm
<?php
$today = date("F j, Y, g:i a");
?>
a) may 19,09,2:45:32 PM
b) May 19, 2009, 2:45 pm
c) May 19,2009,14:45:32 pm
d) May 19,2009,14:45:32 PM
Show Answer
16) Which of the following function is used for terminate the script execution in PHP?
a) break()
b) quit()
c) die()
Show Answer
17) What function used to print statement in PHP?
a) echo();
b) printf
c) ""
Show Answer
18) <?php
define("x","5");
$x=x+10;
echo x;
?>
a) Error
b) 15
c) 10
d) 5
Show Answer
19) what will be the output of below code ?
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
unset($arr);
echo var_dump($arr);
?>
a) 42
b) 56
c) Null
d) x=42
Show Answer
20) PHP variables are
a) Multitype variables
b) Double type variables
c) Single type variable
d) Trible type variables
Show Answer
21) Which of these statements is true?
a) PHP interfaces to the MySQL database,and you should transfer any data in Oracle or Sybase to My
PHP on the data.
b) PHP interfaces to a number of relational databases such as MySQL, Oracle and Sybase. A wrapper
code written for one database can easily be transferred to another if you later switch your database en
c) PHP interfaces to a number of relational databases such as MySQL, Oracle and Sybase but the inte
d) There's little code in PHP to help you interface to databases, but there's no reason why you can't wr
to.
Show Answer
22) Is php can support multiple inheritance?
a) NO
b) YES
Show Answer
23) How would you add 1 to the variable $count?
a) incr count;
b) $count++;
c) $count =+1
d) incr $count;
Show Answer
24) Which of the following is used to check if a function has already been defined?
a) bool function_exists(functionname)
b) bool f_exists(functionname)
c) bool func_exist(functioname)
Show Answer
25) what is the return value of this substr function?
<?php
$rest = substr("abcdef", -1);
$rest = substr("abcdef", 0, -1);
?>
a) f,abcde
b) a,fedcb
c) b,abcdef
d) a,abcde
Show Answer
26) Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you
used basename($_SERVER['PHP_SELF']) function in your page, then what is the return value of this f
a) phptutor
b) phptutor/index.php
c) index.php
d) /index.php
Show Answer
27) $x="display";
${$x.'_result'} ();
?>
Above program will call the function display_result()
a) False
b) True
c) Parser Error
d) None of the above
Show Answer
28) All variables in PHP start with which symbol?
a) !
b) $
c) &
d) %
Show Answer
29) Father of PHP?
a) Larry Wall
b) Rasmus Lerdorf
c) James Gosling
d) Guido Van Rossum
Show Answer
30) In PHP the error control operator is _______
a) .
b) *
c) @
d) &
Show Answer
31) $str="3dollars";
$a=20;
$a+=$str;
print($a);
?>
Output ?
a) 23dollars
b) 203dollars
c) 320dollars
d) 23
Show Answer
32) <?php
function zz(& $x)
{
$x=$x+5;
}
?>
$x=10;
zz($x);
echo $x;
a) 5
b) 0
c) 15
d) 10
Show Answer
33) <?php
echo $_SERVER['REMOTE_ADDR'];
?>
a) shows the IP address of the local system
b) shows the IP address of the visitor
c) shows the IP address of the webserver
d) None of the above
Show Answer
34) <?php
$x=dir(".");
while($y=$x->read())
{
echo $y."
"
}
$y->close();
?>
What is the following output?
a) display all folder names
b) display a folder content
c) display content of the all drives
d) Parse error
Show Answer
35) <?php
$qpt = 'QualityPointTechnologies';
echo preg_match("/^Quality/", $qpt);
?>
a) 1
b) 0
c) Quality
d) Null
Show Answer
36) <?php
$test="3.5seconds";
settype($test,"double");
settype($test,"integer");
settype($test,"string");
print($test);
?>
What is the following output?
a) 3.5
b) 3.5seconds
c) 3
d) 3seconds
Show Answer
37) <?php
$x=array(2=>"mouse",7=>"keyboard");
$y=array_keys($x);
echo $y[1];
?>
a) keyboard
b) mouse
c) 7
d) 2
Show Answer
38) $data="98.8degrees";
(double)$data;
(int)$data;
(string)$string;
echo $data;
?>
a) 98
b) 98.8
c) 98.8degrees
d) degrees
Show Answer
39) PHP is
a) Partially cross-platform
b) Truly cross-platform
c) None of above
Show Answer
40) <?php
$x="101.5degrees";
(double)$x;
(int)$x;
echo (string)$x;
?>
a) 101.5
b) degrees
c) 101
d) 101.5degrees
Show Answer
41) Whether One-line comment begin with pound sing(#) in php?
a) True
b) False
c) None of above
Show Answer
42) In PHP, during error handling include() generates......................
a) a fatal error, and the script will stop
b) a warning, but the script will continue execution
c) None of the above
Show Answer
43) <?php
$qpt = 'Eat to live, but not live to eat';
echo preg_match("/^to/", $qpt);
?>
a) 0
b) 1
c) to
d) Null
Show Answer
44) <?php
$x=array("aaa","","ccc","ddd","");
$y=array_unique($x);
echo count($x) . "," . count($y);
?>
a) 3,1
b) 3,3
c) 5,5
d) 5,4
Show Answer
45) PHP is a _____ . It means you do not have to tell PHP which data type the variable is.PHP automa
variable to the correct data type, depending on its value.
a) client side language
b) local language
c) global language
d) loosely typed language
Show Answer
46) Which of the following is not a valid variable name?
a) $number-in-class
b) $nic
c) $NumberInClass
d) $number_in_class
Show Answer
47) Which of the following function is used to change the root directory in PHP?
a) choot()
b) change_root()
c) cd_root()
d) cd_r()
Show Answer
48) PHP is
a) client side script language
b) server side script language
c) event-driven language
Show Answer
49) $father="mother";
$mother="son";
echo $$father;
?>
a) son
b) mother
c) motherson
d) error
Show Answer
50) <?php
$x=array(4,2,5,1,4,5,3,4);
$y=array_count_values($x);
echo count($y);
?>
a) 8
b) 5
c) 7
d) 28
Show Answer
51) The PHP syntax is most similar to:
a) PERL and C
b) Java script
c) VB Script
d) Visual Basic
Show Answer
52) what will be the output of below code ?
<?php
$arr = array(5 => 1, 12 => 2);
$arr[] = 56;
$arr["x"] = 42;
echo var_dump($arr);
?>
a) 42
b) array(3) { [12]=> int(2) [13]=> int(56) ["x"]=> int(42) }
c) array(4) { [5]=>int(1) [12]=> int(2) [13]=> int(56) ["x"]=> int(42) }
d) 1,2,56,42
Show Answer
53) what will the ouptut of below date() function ?
<?php
$date="2009-5-19";
$time="14:31:38";
$datetime=$date.$time;
echo date("Y-m-d:H:i:s",strtotime($datetime));
?>
a) 2009-5-19:14:31:38
b) 2009-5-19:2:31:38
c) 19-5-2009:2:31:38
d) 19/5/2009:14:31:38
Show Answer
54) <?php
$color=array("red","yellow","white");
$x=in_array("black",$color);
if($x==0)
echo "good bye";
if($x==1) echo "Hello";
?>
a)Hello
b) Error
c) good bye
d) None of the above
Show Answer
PHP QUESTIONS AND ANSWERS: TOP PHP INTERVIEW QUESTIONS

More Related Content

What's hot

TDD in C - Recently Used List Kata
TDD in C - Recently Used List KataTDD in C - Recently Used List Kata
TDD in C - Recently Used List KataOlve Maudal
 
Quize on scripting shell
Quize on scripting shellQuize on scripting shell
Quize on scripting shelllebse123
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation TutorialLorna Mitchell
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationAbdul Rahman Sherzad
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTKFrancesco Bruni
 
Generating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonGenerating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonTristan Penman
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and CEleanor McHugh
 
Boost.Python - domesticating the snake
Boost.Python - domesticating the snakeBoost.Python - domesticating the snake
Boost.Python - domesticating the snakeSławomir Zborowski
 
Let's build a parser!
Let's build a parser!Let's build a parser!
Let's build a parser!Boy Baukema
 
Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Nikita Popov
 
實戰 Hhvm extension php conf 2014
實戰 Hhvm extension   php conf 2014實戰 Hhvm extension   php conf 2014
實戰 Hhvm extension php conf 2014Ricky Su
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manualPrabhu D
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semesterDOSONKA Group
 
Pydiomatic
PydiomaticPydiomatic
Pydiomaticrik0
 
The best unix shell scripting interview questions 2018 learn now!
The best unix shell scripting interview questions 2018   learn now!The best unix shell scripting interview questions 2018   learn now!
The best unix shell scripting interview questions 2018 learn now!mia avery
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная оберткаVsevolod Dyomkin
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and GoEleanor McHugh
 

What's hot (20)

TDD in C - Recently Used List Kata
TDD in C - Recently Used List KataTDD in C - Recently Used List Kata
TDD in C - Recently Used List Kata
 
Quize on scripting shell
Quize on scripting shellQuize on scripting shell
Quize on scripting shell
 
Zend Certification Preparation Tutorial
Zend Certification Preparation TutorialZend Certification Preparation Tutorial
Zend Certification Preparation Tutorial
 
RAII and ScopeGuard
RAII and ScopeGuardRAII and ScopeGuard
RAII and ScopeGuard
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTK
 
Generating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonGenerating parsers using Ragel and Lemon
Generating parsers using Ragel and Lemon
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Boost.Python - domesticating the snake
Boost.Python - domesticating the snakeBoost.Python - domesticating the snake
Boost.Python - domesticating the snake
 
Let's build a parser!
Let's build a parser!Let's build a parser!
Let's build a parser!
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
 
Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)
 
實戰 Hhvm extension php conf 2014
實戰 Hhvm extension   php conf 2014實戰 Hhvm extension   php conf 2014
實戰 Hhvm extension php conf 2014
 
Network lab manual
Network lab manualNetwork lab manual
Network lab manual
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semester
 
Pydiomatic
PydiomaticPydiomatic
Pydiomatic
 
The best unix shell scripting interview questions 2018 learn now!
The best unix shell scripting interview questions 2018   learn now!The best unix shell scripting interview questions 2018   learn now!
The best unix shell scripting interview questions 2018 learn now!
 
Summary of C++17 features
Summary of C++17 featuresSummary of C++17 features
Summary of C++17 features
 
Lisp как универсальная обертка
Lisp как универсальная оберткаLisp как универсальная обертка
Lisp как универсальная обертка
 
Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 

Similar to PHP QUESTIONS AND ANSWERS: TOP PHP INTERVIEW QUESTIONS

PHP Technical Questions
PHP Technical QuestionsPHP Technical Questions
PHP Technical QuestionsPankaj Jha
 
PHP Session - Mcq ppt
PHP Session - Mcq ppt PHP Session - Mcq ppt
PHP Session - Mcq ppt Shaheen Shaikh
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technologyfntsofttech
 
501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdfAkashGohil10
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questionsShubham Sunny
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2Knowledge Center Computer
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbaivibrantuser
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answerSoba Arjun
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Tekblink Jeeten
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersVineet Kumar Saini
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationOXUS 20
 
100 PHP question and answer
100 PHP  question and answer100 PHP  question and answer
100 PHP question and answerSandip Murari
 

Similar to PHP QUESTIONS AND ANSWERS: TOP PHP INTERVIEW QUESTIONS (20)

PHP Technical Questions
PHP Technical QuestionsPHP Technical Questions
PHP Technical Questions
 
PHP Session - Mcq ppt
PHP Session - Mcq ppt PHP Session - Mcq ppt
PHP Session - Mcq ppt
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
 
501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf501 - PHP MYSQL.pdf
501 - PHP MYSQL.pdf
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questions
 
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
 
PHP Quiz
PHP QuizPHP Quiz
PHP Quiz
 
Mcq ppt Php- array
Mcq ppt Php- array Mcq ppt Php- array
Mcq ppt Php- array
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
 
Php interview questions with answer
Php interview questions with answerPhp interview questions with answer
Php interview questions with answer
 
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
 
C MCQ
C MCQC MCQ
C MCQ
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Sa
SaSa
Sa
 
Part - 2 Cpp programming Solved MCQ
Part - 2  Cpp programming Solved MCQ Part - 2  Cpp programming Solved MCQ
Part - 2 Cpp programming Solved MCQ
 
web design and development.docx
web design and development.docxweb design and development.docx
web design and development.docx
 
lab4_php
lab4_phplab4_php
lab4_php
 
lab4_php
lab4_phplab4_php
lab4_php
 
100 PHP question and answer
100 PHP  question and answer100 PHP  question and answer
100 PHP question and answer
 

Recently uploaded

定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一lvtagr7
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证obuhobo
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Suhani Kapoor
 
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一2s3dgmej
 
Ioannis Tzachristas Self-Presentation for MBA.pdf
Ioannis Tzachristas Self-Presentation for MBA.pdfIoannis Tzachristas Self-Presentation for MBA.pdf
Ioannis Tzachristas Self-Presentation for MBA.pdfjtzach
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterHector Del Castillo, CPM, CPMM
 
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Service
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Service
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
Gray Gold Clean CV Resume2024tod (1).pdf
Gray Gold Clean CV Resume2024tod (1).pdfGray Gold Clean CV Resume2024tod (1).pdf
Gray Gold Clean CV Resume2024tod (1).pdfpadillaangelina0023
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...shivangimorya083
 
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)obuhobo
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxGry Tina Tinde
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipSoham Mondal
 
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一A SSS
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...Suhani Kapoor
 
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一A SSS
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testspriyanshukumar97908
 
do's and don'ts in Telephone Interview of Job
do's and don'ts in Telephone Interview of Jobdo's and don'ts in Telephone Interview of Job
do's and don'ts in Telephone Interview of JobRemote DBA Services
 

Recently uploaded (20)

Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort ServiceYoung Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
 
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
定制(UQ毕业证书)澳洲昆士兰大学毕业证成绩单原版一比一
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
 
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一
定制(NYIT毕业证书)美国纽约理工学院毕业证成绩单原版一比一
 
Ioannis Tzachristas Self-Presentation for MBA.pdf
Ioannis Tzachristas Self-Presentation for MBA.pdfIoannis Tzachristas Self-Presentation for MBA.pdf
Ioannis Tzachristas Self-Presentation for MBA.pdf
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring Chapter
 
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Service
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Service
Call Girls In Bhikaji Cama Place 24/7✡️9711147426✡️ Escorts Service
 
Gray Gold Clean CV Resume2024tod (1).pdf
Gray Gold Clean CV Resume2024tod (1).pdfGray Gold Clean CV Resume2024tod (1).pdf
Gray Gold Clean CV Resume2024tod (1).pdf
 
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
Delhi Call Girls Preet Vihar 9711199171 ☎✔👌✔ Whatsapp Body to body massage wi...
 
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)
阿德莱德大学本科毕业证成绩单咨询(书英文硕士学位证)
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
 
Preventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptxPreventing and ending sexual harassment in the workplace.pptx
Preventing and ending sexual harassment in the workplace.pptx
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management Internship
 
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
办理学位证(Massey证书)新西兰梅西大学毕业证成绩单原版一比一
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
 
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
办理学位证(UoM证书)北安普顿大学毕业证成绩单原版一比一
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
Notes of bca Question paper for exams and tests
Notes of bca Question paper for exams and testsNotes of bca Question paper for exams and tests
Notes of bca Question paper for exams and tests
 
do's and don'ts in Telephone Interview of Job
do's and don'ts in Telephone Interview of Jobdo's and don'ts in Telephone Interview of Job
do's and don'ts in Telephone Interview of Job
 

PHP QUESTIONS AND ANSWERS: TOP PHP INTERVIEW QUESTIONS

  • 1. PHP QUESTIONS AND ANSWERS 1)<?php $x=array("aaa","ttt","www","ttt","yyy","tttt"); $y=array_count_values($x); echo $y[ttt]; ?> a)2 Ans b)3 c)1 d)4 Show Answer 2) How do you get information from a form that is submitted using the "get" method? a)$_GET[]; Ans b)Request.Form; c)Request.QueryString; d)$_POST[]; Show Answer 3)What's the best way to copy a file from within a piece of PHP? a) Print out a message asking your user to "telnet" in to the server and copy the file for you b) Open the input and output files, and use read() and write() to copy the data block by block until read c) Use the built in copy() function (Answer) d) Use "exec" to run an operating system command such as cp (Unix, Linux) or copy (Windows) Show Answer 4) PHP code is embedded directly into XHTML document? a) False b) True Ans Show Answer 5) Is it possible to submit a form with out a submit button?
  • 2. a) Yes Ans b) No Show Answer 6) Full form of PHP a) PreHypertextProcessor b) HypertextPreprocessor Ans c) Hypertext Postprocessor d) PostHypertextProcessor Show Answer 7) What is the expansion of LAMP? a) Linux And Mysql Php b) Linux Apache Mysql Php ans Show Answer 8) In php Which method is used to getting browser properties? a) $_SERVER['HTTP_USER_AGENT']; ans b) $_SERVER['PHP_SELF'] c) $_SERVER['SERVER_NAME'] d) $_SERVER['HTTP_VARIENT'] Show Answer 9) Which of the following function is used to pick one or more random values from PHP Array? a) array_rand() ans b) array_random() c) Random_array() d) Rand_array() Show Answer
  • 3. 10) <?php $x=array(1,3,2,3,7,8,9,7,3); $y=array_count_values($x); echo $y[8]; ?> a) 43 b) 1 ans c) 8 d) 6 Show Answer 11) Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you used $_SERVER['PHP_SELF'] function in your page, then what is the return value of this function ? a) phptutor/index.php b) /phptutor/index.php ans c) c:/apache/htdocs/phptutor/index.php d) index.php Show Answer 12) Which operator is used to concatenate two strings in php? a) dot operator (.) ans b) plus operator (+) Show Answer 13)Are there regular expressions in PHP? a) Yes - regular expressions use Perl-like conventions b) Yes - PHP supports two different types of regular expressions: POSIX-extended and Perl-Compatib (PCRE). ans c) Yes - regular expressions use the POSIX standard d) No - PHP uses "glob" style matching only Show Answer 14) In PHP, which of the following function is used to insert content of one php file into another php file a) include[]
  • 4. b) #include() c) include() d) #include{} Show Answer 15) what will be the ouput of below code ? Assume that today is 2009-5-19:2:45:32 pm <?php $today = date("F j, Y, g:i a"); ?> a) may 19,09,2:45:32 PM b) May 19, 2009, 2:45 pm c) May 19,2009,14:45:32 pm d) May 19,2009,14:45:32 PM Show Answer 16) Which of the following function is used for terminate the script execution in PHP? a) break() b) quit() c) die() Show Answer 17) What function used to print statement in PHP? a) echo(); b) printf c) "" Show Answer 18) <?php define("x","5"); $x=x+10; echo x; ?>
  • 5. a) Error b) 15 c) 10 d) 5 Show Answer 19) what will be the output of below code ? <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56; $arr["x"] = 42; unset($arr); echo var_dump($arr); ?> a) 42 b) 56 c) Null d) x=42 Show Answer 20) PHP variables are a) Multitype variables b) Double type variables c) Single type variable d) Trible type variables Show Answer 21) Which of these statements is true? a) PHP interfaces to the MySQL database,and you should transfer any data in Oracle or Sybase to My PHP on the data. b) PHP interfaces to a number of relational databases such as MySQL, Oracle and Sybase. A wrapper code written for one database can easily be transferred to another if you later switch your database en c) PHP interfaces to a number of relational databases such as MySQL, Oracle and Sybase but the inte
  • 6. d) There's little code in PHP to help you interface to databases, but there's no reason why you can't wr to. Show Answer 22) Is php can support multiple inheritance? a) NO b) YES Show Answer 23) How would you add 1 to the variable $count? a) incr count; b) $count++; c) $count =+1 d) incr $count; Show Answer 24) Which of the following is used to check if a function has already been defined? a) bool function_exists(functionname) b) bool f_exists(functionname) c) bool func_exist(functioname) Show Answer 25) what is the return value of this substr function? <?php $rest = substr("abcdef", -1); $rest = substr("abcdef", 0, -1); ?> a) f,abcde b) a,fedcb c) b,abcdef d) a,abcde
  • 7. Show Answer 26) Assume that your php file 'index.php' in location c:/apache/htdocs/phptutor/index.php. If you used basename($_SERVER['PHP_SELF']) function in your page, then what is the return value of this f a) phptutor b) phptutor/index.php c) index.php d) /index.php Show Answer 27) $x="display"; ${$x.'_result'} (); ?> Above program will call the function display_result() a) False b) True c) Parser Error d) None of the above Show Answer 28) All variables in PHP start with which symbol? a) ! b) $ c) & d) % Show Answer 29) Father of PHP? a) Larry Wall b) Rasmus Lerdorf c) James Gosling d) Guido Van Rossum Show Answer
  • 8. 30) In PHP the error control operator is _______ a) . b) * c) @ d) & Show Answer 31) $str="3dollars"; $a=20; $a+=$str; print($a); ?> Output ? a) 23dollars b) 203dollars c) 320dollars d) 23 Show Answer 32) <?php function zz(& $x) { $x=$x+5; } ?> $x=10; zz($x); echo $x; a) 5 b) 0 c) 15 d) 10 Show Answer 33) <?php echo $_SERVER['REMOTE_ADDR'];
  • 9. ?> a) shows the IP address of the local system b) shows the IP address of the visitor c) shows the IP address of the webserver d) None of the above Show Answer 34) <?php $x=dir("."); while($y=$x->read()) { echo $y." " } $y->close(); ?> What is the following output? a) display all folder names b) display a folder content c) display content of the all drives d) Parse error Show Answer 35) <?php $qpt = 'QualityPointTechnologies'; echo preg_match("/^Quality/", $qpt); ?> a) 1 b) 0 c) Quality d) Null Show Answer
  • 10. 36) <?php $test="3.5seconds"; settype($test,"double"); settype($test,"integer"); settype($test,"string"); print($test); ?> What is the following output? a) 3.5 b) 3.5seconds c) 3 d) 3seconds Show Answer 37) <?php $x=array(2=>"mouse",7=>"keyboard"); $y=array_keys($x); echo $y[1]; ?> a) keyboard b) mouse c) 7 d) 2 Show Answer 38) $data="98.8degrees"; (double)$data; (int)$data; (string)$string; echo $data; ?> a) 98 b) 98.8 c) 98.8degrees d) degrees
  • 11. Show Answer 39) PHP is a) Partially cross-platform b) Truly cross-platform c) None of above Show Answer 40) <?php $x="101.5degrees"; (double)$x; (int)$x; echo (string)$x; ?> a) 101.5 b) degrees c) 101 d) 101.5degrees Show Answer 41) Whether One-line comment begin with pound sing(#) in php? a) True b) False c) None of above Show Answer 42) In PHP, during error handling include() generates...................... a) a fatal error, and the script will stop b) a warning, but the script will continue execution c) None of the above Show Answer
  • 12. 43) <?php $qpt = 'Eat to live, but not live to eat'; echo preg_match("/^to/", $qpt); ?> a) 0 b) 1 c) to d) Null Show Answer 44) <?php $x=array("aaa","","ccc","ddd",""); $y=array_unique($x); echo count($x) . "," . count($y); ?> a) 3,1 b) 3,3 c) 5,5 d) 5,4 Show Answer 45) PHP is a _____ . It means you do not have to tell PHP which data type the variable is.PHP automa variable to the correct data type, depending on its value. a) client side language b) local language c) global language d) loosely typed language Show Answer 46) Which of the following is not a valid variable name? a) $number-in-class b) $nic c) $NumberInClass d) $number_in_class
  • 13. Show Answer 47) Which of the following function is used to change the root directory in PHP? a) choot() b) change_root() c) cd_root() d) cd_r() Show Answer 48) PHP is a) client side script language b) server side script language c) event-driven language Show Answer 49) $father="mother"; $mother="son"; echo $$father; ?> a) son b) mother c) motherson d) error Show Answer 50) <?php $x=array(4,2,5,1,4,5,3,4); $y=array_count_values($x); echo count($y); ?> a) 8 b) 5 c) 7 d) 28
  • 14. Show Answer 51) The PHP syntax is most similar to: a) PERL and C b) Java script c) VB Script d) Visual Basic Show Answer 52) what will be the output of below code ? <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56; $arr["x"] = 42; echo var_dump($arr); ?> a) 42 b) array(3) { [12]=> int(2) [13]=> int(56) ["x"]=> int(42) } c) array(4) { [5]=>int(1) [12]=> int(2) [13]=> int(56) ["x"]=> int(42) } d) 1,2,56,42 Show Answer 53) what will the ouptut of below date() function ? <?php $date="2009-5-19"; $time="14:31:38"; $datetime=$date.$time; echo date("Y-m-d:H:i:s",strtotime($datetime)); ?> a) 2009-5-19:14:31:38
  • 15. b) 2009-5-19:2:31:38 c) 19-5-2009:2:31:38 d) 19/5/2009:14:31:38 Show Answer 54) <?php $color=array("red","yellow","white"); $x=in_array("black",$color); if($x==0) echo "good bye"; if($x==1) echo "Hello"; ?> a)Hello b) Error c) good bye d) None of the above Show Answer