
PHP Basics Quiz lec 1 to 3
Authored by IIT22027 K.G.D.S.
Other
2nd Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the concatenation operator (.) in PHP?
To add two numbers together.
To join two or more strings.
To perform a comparison.
To divide two numbers.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an example of a valid PHP variable name?
$1variable
$-variable
$_variable
$variable-name
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct way to end a PHP statement?
A colon (:)
A comma (,)
A semicolon (;)
A period (.)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you print data to the browser in PHP?
print() or echo
write() or output()
display() or show()
return()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary difference between var_dump() and echo?
echo displays a value, while var_dump() displays value and data type.
echo is used for debugging, while var_dump() is for outputting to the browser.
echo can only display strings, while var_dump() can display all data types.
There is no difference.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an example of an associative array in PHP?
$age = ["Peter" => 35, "Ben" => 37];
$age = array("Peter", "Ben");
$age = new Array("Peter", "Ben");
$age = ("Peter", "Ben");
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of echo $x; if $x is assigned the value (int) "100.5"?
100.5
100
"100"
An error will occur.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?