PHP Quiz | Set-1

Question 1
Full form of PHP is______
Tick
Hypertext Preprocessor
Cross
Pretext Hypertext Preprocessor
Cross
Processor Hypertext Processor
Cross
None of the above


Question 1-Explanation: 
The full form of PHP is Hypertext Preprocessor, earlier it was called Personal Home Page, So the answer is Option A. PHP is called Hypertext Preprocessor because it is well documented and Open source means anyone can download it without any paying cost.
Question 2

The default file extension in PHP are ____

Tick

.php

Cross

.css

Cross

.js

Cross

.html



Question 2-Explanation: 

php is default extension of PHP.

Question 3
Which of the following is the correct way to declare the constant in PHP?
Cross
const
Tick
define
Cross
var
Cross
let


Question 3-Explanation: 
The define is a function in PHP that is used to declare the constant define take 3 parameters like name, value, and check the case_sensative. So the correct way to declare the constant in PHP is to define.
Question 4
How does the name of the variable in PHP starts?
Cross
Sign !
Tick
Sign $
Cross
Sign &
Cross
Sign #


Question 4-Explanation: 
The name of the variable in PHP starts with the Sign $ example: the syntax for initializing variable $a=20; Here a is variable followed by $ sign.
Question 5

Which of the following is the syntax of comment in PHP?

Cross

/* */

Cross

#

Cross

//

Tick

All of the above



Question 5-Explanation: 

There are 3 ways to write comments in PHP. /* */ is a multiline comment you can comment as: /* This is a multiple line comment /*, # This is a single-line comment in PHP and this is also // a single line comment you can write as // This is a single-line comment.

Question 6

If you want to add write the PHP code which of the below code editor is used?

Cross

Notepad++

Cross

Sublime

Cross

Visual code

Tick

All of the above



Question 6-Explanation: 

Notepad ++, Sublime Text, and Visual code. These three are most used for writing the PHP script. These all are code editors 

Question 7

Which of the below method is used to generate the unique id in Php?

Tick

unique()

Cross

id()

Cross

mid()

Cross

None of the above



Question 7-Explanation: 

The unique id is a function in PHP that is responsible for the generation of a unique id at some millisecond time. It doesn't guarantee the return value .unique id takes 2 parameter prefixes and more_entropy. And it supports in PHP 4+ version.

Question 8
Which of the following is the correct way to concrete() the two strings in PHP?
Tick
.
Cross
+
Cross
Append
Cross
All of the above


Question 8-Explanation: 
Concatenation is used for adding the two strings with the help of. (dot symbol) in PHP. Example: Input : Geeks: Hello string2: For Output: GeeksFor.
Question 9

Which of the below is the correct syntax for opening the given file in PHP?

"geeky.txt"
Tick

fopen("geeky.txt", "r");

Cross

fopen("geeky.txt", "w");

Cross

fopen("geeky.txt", "read");

Cross

fopen("geeky.txt");



Question 9-Explanation: 

The correct syntax for opening the file in PHP is open("geeky.txt", "r"); where r represents the reading mode of the file and "geeky.txt" is the name of the file. 

Question 10
Which of the below function display the configuration in PHP?
Cross
php_display()
Tick
phpinfo()
Cross
info_config()
Cross
None of the above


Question 10-Explanation: 
The phpinfo() function is used to display the configuration in PHP. It also returns the compiled information about PHP.
There are 15 questions to complete.

  • Last Updated : 27 Sep, 2023

Similar Reads