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.

Who is the father of PHP?(a) Rasmus Lerdorf(b) Willam Makepiece(c) Drek Kolkevi(d) List BarelyI got this question by my school principal while I was bunking the class.The query is from Basics topic in chapter Basics of PHP of PHP

Answer» RIGHT choice is (a) Rasmus Lerdorf

To EXPLAIN: PHP was originally created by Rasmus Lerdorf in 1994.
2.

Which statement will output $x on the screen?(a) echo “\$x”;(b) echo “$$x”;(c) echo “/$x”;(d) echo “$x;”;The question was asked in an online interview.This intriguing question comes from Basics in division Basics of PHP of PHP

Answer»

Correct answer is (a) echo “\$x”;

The best I can explain: A backslash is used so that the dollar SIGN is treated as a NORMAL STRING character rather than PROMPT PHP to treat $x as a variable. The backslash used in this manner is KNOWN as escape character.

3.

Which of the below statements is equivalent to $add += $add?(a) $add = $add(b) $add = $add +$add(c) $add = $add + 1(d) $add = $add + $add + 1This question was addressed to me in an online interview.The doubt is from Basics topic in chapter Basics of PHP of PHP

Answer»

Right ANSWER is (B) $add = $add +$add

The explanation is: a += b is an addition assignment WHOSE outcome is a = a + b. Same can be done with subtraction, MULTIPLICATION, division ETC.

4.

Which version of PHP introduced Try/catch Exception?(a) PHP 4(b) PHP 5(c) PHP 6(d) PHP 5 and laterI had been asked this question at a job interview.Enquiry is from Basics topic in portion Basics of PHP of PHP

Answer»

Correct choice is (d) PHP 5 and LATER

To explain I would SAY: PHP 5 version and later versions added support for Exception HANDLING.

5.

What should be the correct syntax to write a PHP code?(a) < php>(b) < ? php?>(c) (d) This question was posed to me during an online exam.Question is from Basics in chapter Basics of PHP of PHP

Answer»

The correct option is (c) ?>

The explanation is: EVERY section of PHP code STARTS and ENDS by TURNING on and off PHP tags to let the SERVER know that it needs to execute the PHP in between them.

6.

PHP files have a default file extension of_______(a) .html(b) .xml(c) .php(d) .phI have been asked this question in unit test.My question comes from Basics in division Basics of PHP of PHP

Answer»

The correct ANSWER is (C) .php

Explanation: To run a php FILE on the server, it should be SAVED as AnyName.php