PHP Quiz | Set-1

  • Last Updated : 08 Oct, 2021

Question 1
Full form of PHP is______
A
Hypertext Preprocessor
B
Pretext Hypertext Preprocessor
C
Processor Hypertext Processor
D
None of the above
PHP Quiz | Set-1    
Discuss it


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 ____

A

.php

B

.css

C

.js

D

.html

PHP Quiz | Set-1    
Discuss it


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?
A
const
B
define
C
var
D
let
PHP Quiz | Set-1    
Discuss it


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?
A
Sign !
B
Sign $
C
Sign &
D
Sign #
PHP Quiz | Set-1    
Discuss it


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?

A

/* */

B

#

C

//

D

All of the above

PHP Quiz | Set-1    
Discuss it


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?

A

Notepad++

B

Sublime

C

Visual code

D

All of the above

PHP Quiz | Set-1    
Discuss it


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?

A

unique()

B

id()

C

mid()

D

None of the above

PHP Quiz | Set-1    
Discuss it


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?
A
.
B
+
C
Append
D
All of the above
PHP Quiz | Set-1    
Discuss it


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"
A

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

B

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

C

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

D

fopen("geeky.txt");

PHP Quiz | Set-1    
Discuss it


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?
A
php_display()
B
phpinfo()
C
info_config()
D
None of the above
PHP Quiz | Set-1    
Discuss it


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.
My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.