Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views3 pages

PHP

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

TEST STEMLab

php

Name and Surname: ________________________________

1. What will the following code display?


echo "Hello" . " World!";
a) Hello World!
b) Hello
c) Error
2. Which of the following variables is valid in PHP?
a) $1name
b) $_name
c) name$
3. What does the isset() function do?
a) Checks if a variable exists and is not null
b) Deletes a variable
c) Declares a variable

4. What is the symbol used to reference variables in PHP?


a) @
b) $
c) #
5. What is the HTTP method for sending data to a file (“task.php”)?
a) GET
b) POST
c) DELETE
6. What is the HTTP method for sending data outside files (“task.html” and “task.php”)?
a) GET
b) POST
c) DELETE
7. What does the . symbol do in PHP?
a) Konkatenon dy stringje
b) Shumëzon numrat
c) Ndryshon një variabël në null
8. What will happen with the following code?
echo 5 + "10 apples";

a) 15
b) Error
c) 510
9. What is the difference between == and === in PHP?
a) There is no difference
b) == compares values, === compares both values and types
c) === is faster than ==

10. How can you create a single-line comment in PHP?


echo 5 * 2;

a) 52
b) 10
c) Error
11. How can you create a single-line comment in PHP?
a) # This is a comment
b) // This is a comment
c) Both

12. How can you define a function in PHP?


a) function myFunction() {}
b) define myFunction() {}
c) create myFunction() {}
13. What will the following code display?
$x = "PHP";
echo "I am $x!";
a) I am PHP!
b) I am $x!
c) Error
14. What is the result of this code?
echo 2 ** 3;
a) 6
b) 8
c) Error
15. Which of the following is written correctly?
a) $a=$a
b) $a=$_POST[‘name’]
c) $a=$POST[‘name’]
16. What will happen with this code?
$x = 0;
if ($x>0) {
echo " Greater than 0";
}
else {
echo " Less than 0";
}
a) Displays "Greater than 0"
b) Displays "Less than 0"
c) Displays an error

17. Write a PHP program that checks if a number given by the user is greater than 5 or less than 5.

You might also like