Vidyalelo
PHP · all questions

Basic PHP
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

54

Questions

1/3

Page

Pick an option on a question to see the right answer and solution.

What does PHP stand for?
1. Personal Home Page
2. Hypertext Preprocessor
3. Pretext Hypertext Processor
4. Preprocessor Home Page

Select an option to see the answer and solution.

PHP files have a default file extension of_______.

Select an option to see the answer and solution.

Which of the following is/are a PHP code editor?
1. Notepad
2. Notepad++
3. Adobe Dreamweaver
4. PDT

Select an option to see the answer and solution.

Which of the following must be installed on your computer so as to run PHP script?
1. Adobe Dreamweaver
2. PHP
3. Apache
4. IIS

Select an option to see the answer and solution.

Which version of PHP introduced Try/catch Exception?

Select an option to see the answer and solution.

We can use _________ to comment a single line?
1. /?
2. //
3. #
4. /* */

Select an option to see the answer and solution.

Which of the following php statement/statements will store 111 in variable num?
1. int $num = 111;
2. int mum = 111;
3. $num = 111;
4. 111 = $num;

Select an option to see the answer and solution.

What will be the output of the following php code?
<?php
$num  = 1;
$num1 = 2;
print num1;
?>

Select an option to see the answer and solution.

What will be the output of the following php code?
<?php
$num  = "1";
$num1 = "2";
print num1;
?>

Select an option to see the answer and solution.

Which of following variables can be assigned a value to it?
1. $3hello
2. $_hello
3. $this
4. $This

Select an option to see the answer and solution.

What will be the output of the following code?
<?php 
$foo = 'Bob';
bar <span class="p-blue">= &</span>foo;        
bar";
echo $bar;
echo $foo;
?>

Select an option to see the answer and solution.

Which of the following PHP statements will output Hello World on the screen?
1. echo (“Hello World”);
2. print (“Hello World”);
3. printf (“Hello World”);
4. sprintf (“Hello World”);

Select an option to see the answer and solution.

What will be the output of the following PHP code?
<?php
$color = "maroon";
color[2];
echo "$var";
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code?
<?php
$score = 1234;
score;
echo $scoreboard[0];
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code?
<?php
$total = "25 students";
$more = 10;
total + $more;
echo "$total";
?>

Select an option to see the answer and solution.

Which of the below statements is equivalent to add ?

Select an option to see the answer and solution.

Which statement will output $x on the screen?

Select an option to see the answer and solution.

What will be the output of the following code?
<?php
function track() 
{
	static $count = 0;
	$count++;
	echo $count;
}
track();
track();
track();
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code?
<?php
$a = "clue";
$a .= "get";
echo "$a";
?>

Select an option to see the answer and solution.

What will be the output of the following PHP code?
<?php
$a = 5;
$b = 5;
span class="sys-fun">echo (b);
?>

Select an option to see the answer and solution.