wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PHP MCQ 1 (kahoot)

Total questions: 25

Worksheet time: 26mins

Name
Class
Date
1.
Which of the following is the default file extension of PHP?
a)
.php
b)
.hphp
c)
.xml
d)
.html
2.
Operator ? Means?
a)
Assignment Operators
b)
Modulus AND assignment operator
c)
Conditional Operator
d)
Divide AND assignment operator
3.
Variables are ________ for storing information.
a)
decimal
b)
numbers
c)
storage
d)
containers
4.
PHP variables are case-sensitive?
a)
True
b)
False
5.
Logical AND operator : If both the operands are true then condition becomes true.
a)
True
b)
False
6.
What will be the output of the following PHP code? echo x-- != ++x;
a)
1
b)
0
c)
error
d)
no output
7.
Which in-built function will add a value to the end of an array?
a)
array_unshift()
b)
into_array()
c)
inend_array()
d)
array_push()
8.
What is the use of array_unshift() function?
a)
Function is used to print the array in readable format.
b)
Adds elements to the beginning of the array and returns the size of array.
c)
Function can be used to verify if a variable is an array.
d)
Adds elements to the end of the array and returns the size of array.
9.
Which of the following function is used to get the value of the previous element in an array?
a)
last()
b)
before()
c)
prev()
d)
previous()
10.
Which of the following is the use of strlen() function in PHP?
a)
The strlen() function returns the type of string
b)
The strlen() function returns the length of string
c)
The strlen() function returns the value of string
d)
The strlen() function returns both value and type of string
11.
Which of the following is the use of strpos() function in PHP?
a)
The strpos() function is used to search for the spaces in a string
b)
The strpos() function is used to search for a number in a string
c)
The strpos() function is used to search for a character/text in a string
d)
strpos() function is used to search for a capitalize character in a string
12.
Which of the following is the correct way of defining a variable in PHP?
a)
$variable name = value;
b)
$variable_name = value;
c)
$variable_name = val
d)
$variable name as value;
13.
What will be the output of the following PHP program?
a)
Correct Answer
b)
is The
c)
I Wonder
d)
Which One
14.
Which of the looping statements is/are supported by PHP? i) for loop ii) while loop iii) do-while loop iv)foreach loop
a)
Only iv)
b)
i), ii) and iii)
c)
i) and ii)
d)
i), ii), iii) and iv)
15.
Which of the following is correct to add a comment in php?
a)
& …… &
b)
# ……
c)
/* …… */
d)
<!-- -->
16.
By default, the index of array in php starts from ______?
a)
0
b)
1
c)
-1
d)
2
17.
Predict the output of the following code snippet : <?php $str="chess was played"; echo strlen(substr($str,3,2))." " ?>
a)
1
b)
2
c)
3
d)
Array
18.
How many types of functions are available in php?
a)
5
b)
4
c)
3
d)
2
19.
Why should we use functions?
a)
Reusability
b)
Easier error detection
c)
Easily maintained
d)
All of the mentions
20.
What will be the output of the following PHP code ? <?php$a = 10;$b = $a>2?"Hi":"Bye";echo "$b";?>
a)
HiBye
b)
Bye
c)
Hi
d)
Error
21.
A function name cannot start with a ____
a)
alphabet
b)
underscore
c)
number
d)
All of the mentions
22.
A function in PHP which starts with double underscore is known as __________.
a)
Magic Function
b)
Inbuilt Function
c)
Default Function
d)
User Defined Function
23.
A function name is not case-sensitive?
a)
True
b)
False
24.
What will be the output of the following PHP code ?
a)
-3-4-5
b)
-3-4
c)
No Output
d)
infinite loop
25.
What will be the output of the following PHP code ?
a)
prints "Hi" 3 times
b)
prints "Hi" 4 times
c)
prints "Hi" 5 times
d)
prints "Hi" 6 times