MCQ

PHP MCQ – Multiple Choice Questions and Answers – Basics – Part 1

This collection of PHP Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “PHP basic”.
 

1. In PHP, variables start with _____?

A &

B $

C #

D %

B
In PHP, variables start with the symbol $, Example:

$myVar = 5;
How to Define a Variable in PHPHow to Define a Variable in PHPVariables are “containers” that can store specified or determined values, similar to variables in mathematics. These values can be of different types, so-called data types.…Read More
 

2. What does PHP stand for?

A Hypertext Preprocessor

B Pretext Hypertext Processor

C Preprocessor Home Page

D Personal Home Page

A, D
PHP, before represent Personal Home Page now represent Hypertext Preprocessor.
Hello World in PHPHello World in PHPThe echo function can be used to output strings in PHP. If a variable is passed to this function, it outputs this variable. If a…Read More
 

3. PHP is an example of ___________ scripting language.

A Browser-side

B Client-side

C In-side

D Server-side

D
PHP is an example of Server-side scripting language.

 

 

4. Who is known as the father of PHP?

A List Barely

B Drek Kolkevi

C Rasmus Lerdorf

D Willam Makepiece

C
Rasmus Lerdorf is known as the creator of PHP

 

 

5. PHP scripts are enclosed within _______

A <php> . . . </php>

B <?php . . . ?>

C ?php . . . ?php

D <p> . . . </p>

B
PHP scripts are enclosed within <?php . . . ?>

 

 

6. The file extension of PHP script is_______.

A .ph

B .html

C .xml

D .php

D
.php is the default file extension of PHP files.

 

 

7. Which version of PHP introduced Try/catch Exception?

A PHP 5

B PHP 5 and later

C PHP 6

D PHP 7

B
PHP v5 and next versions added support for Exception Handling.

 

 

8. Which of the following statements is not true about PHP?

A PHP makes a website dynamic

B PHP can not be embedded into html.

C PHP applications can not be compile

D PHP can be used to create web applications.

B
We can embedd PHP into html.
How to combine HTML and PHPHow to combine HTML and PHP?PHP can be “embedded” in HTML code. In this way, a page can primarily be written in HTML and at the same time supplemented by…Read More
 

9. Which of the following should be installed on your laptop in order to run PHP script?

A XAMPP

B Apache and PHP

C IIS

D Adobe Dreamweaver

A, B, C
In order to run PHP code you need to have PHP and a web server, both IIS and Apache are web servers. You can choose one or other according to your platform.

 

 

10. We can use _________ to comment a single line?

A /?

B //

C #

D /* */

B, C, D
// and # are used only for single line comment, and /* */ used to comment a paragraph, and also single line.
Comments in PHPComments in PHPComments are lines of text that only appear in the code and are not executed by the PHP interpreter. They are used to improve the…Read More
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *