1. What is PHP?
a. PHP is an open-source programming language
b. PHP is used to develop dynamic and interactive websites
c. PHP is a server-side scripting language
d. All of the mentioned
2. PHP stands for
a. Hypertext Preprocessor
b. Pretext Hypertext Preprocessor
c. Personal Home processor
d. None of the above
3. Who is known as the father of PHP?
a. Drek Kolkevi
b. List Barely
c. Rasmus Lerdrof
d. None of the above
4. Which of the following is the correct syntax to write a PHP code?
a. <?php ?>
b. < php >
c. < ? php?>
d. <? ?>
5. Variable name in PHP starts with –
a. ! (Exclamation)
b. $ (dollar)
c. & (Ampersand)
d. # (hash)
6. In PHP, variable names must start with which of the following.
a. No numbers
b. Letters
c. Underscore
d. All of the above
7. Is PHP variable case sensitive?
a. True
b. False
c. Depends on variable
d. None
8. Which of the following is the default file extension of PHP?
a. .php
b. .hphp
c. .xml
d. .html
9. Which of the following is used to display the output in PHP?
a. Echo
b. Write
c. Print
d. Both (a) and (c)
10. Which of the following is used for concatenation in PHP?
a. + (plus)
b. * (asterisk)
c. . (dot)
d. append()
11. Which statement is commonly used for PHP output?
a. Write
b. php
c. .writelog
d. echo
12. Which of the following is correct to add a comment in php?
a. & …… &
b. // ……
c. /* …… */
d. Both (b) and (c)
13. Single line comments can be placed in PHP script by using which symbol?
a. //
b. #
c. $
d. Both A. and B.
14. String is placed within _____.
a. Double quotes (“”)
b. Single quotes (‘ ‘)
c. Both A. and B.
d. None of the above
15. In PHP, which of these do we use to end a statement?
a. ; (semicolon)
b. . (dot)
c. / (slash)
d. ! (exclamation)
16. What type of language is PHP?
a. Server-side scripting
b. Client-side scripting
c. User-side scripting
d. None
17. What does PEAR stands for?
a. PHP extension and application repository
b. PHP enhancement and application reduce
c. PHP event and application repository
d. None of the above
18. In PHP, which of these is the correct way in which we can define a variable?
a. $variable name as value;
b. $variable_name = value
c. $variable_name = value;
d. $variable name = value;
19. Which one of the following statements initiates the mysql class?
a. $conn=new.mysqli()
b. $conn=new mysqli()
c. $conn-> new.mysqli()
d. $conn->new.mysql()
20. CSS stands for
a. Cascade Style Sheets
b. Color and Style Sheets
c. Cascading Style Sheets
d. None of the above
21. Which of the following is the correct syntax for referring the external style sheet?
a. <style src=example.css>
b. <style src= “example.css”
c. <stylesheet>example.css</stylesheet>
d. <Link rel=”stylesheet” type= “text/css” href=”example.css”>
22. The property in CSS used to change the background color of an element is-
a. BGCOLOR
b. BACKGROUND-COLOR
c. COLOR
d. ALL OF THE ABOVE
23. The CSS property used to make the text bold is –
a. font-weight: bold
b. weight: bold
c. font: bold
d. style: bold
24. Name the syntax of declaring a CSS rule is:
a. property-name=value;
b. property-name: value
c. property-name=value
d. property-name: value;
25. Which of the following CSS property is used to add shadows to the text?
a. text-shadow
b. text-stroke
c. text-overflow
d. text-decoration
26. In PHP, what is the correct way in which we can print “Hello World”?
a. write(“Hello World”);
b. echo “Hello World”;
c. “Hello World”;
d. None of the above
27. What is the correct way to include the file “hello.php”?
a. < ?php include(“hello.php”); ? >
b. < !–include file=”hello.php”– >
c. < % include file=”hello.php” % >
d. < ?php include_file(“hello.php”); ? >
28. Which operator will check if two variables are the same?
a. =
b. ==
c. !=
d. .
29. The concatenation operator in PHP looks like this:
a. +
b. &
c. .
d. $
30. The assignment operator looks like this:
a. ==
b. =
c. +
d. ++
31. +, -, *, /, %, are all examples of what category of operators.
a. Assignment Operators
b. Arithmetic Operators
c. String Operators
d. Comparison Operators
32. What is the correct way to declare a variable in PHP?
a. int $varName
b. $varName
c. var $varName
d. declare $varName
33. If I wanted to concatenate a word to a string variable I would use which of these?
a. $dan .= “Dan”;
b. $dan += “Dan”;
c. $dan &= “Dan”;
d. $Dan == “Dan”;
34. What is the use of isset() function in PHP?
a. The isset() function is used to check whether variable is set or not
b. The isset() function is used to check whether the variable is free or not
c. The isset() function is used to check whether the variable is string or not
d. None of the above
35. Which command works the same as the include() command? (the only difference being include() creates a warning whereas this alternative creates an error() when they fail)
a. Input()
b. Add()
c. Aquire()
d. Require()
36. Which of these is the correct syntax for an if … else statement?
a. If (condition) code to be executed if condition is true;
b. If (condition) code to be executed if condition is true; else code to be executed if condition is false;
c. If (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;
d. If (condition) code to be executed if condition is true; elseif(condition) code to be executed if condition is false;
37. Which of the following is true about php variables?
a. All variables in PHP are denoted with a leading dollar sign ($).
b. The value of a variable is the value of its most recent assignment.
c. Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.
d. All of the above.
38. Which of the following type of variables have only two possible values either true or false?
a. Integers
b. Doubles
c. Booleans
d. Strings
39. How will you concatenate two strings?
a. Using . operator.
b. Using + operator.
c. Using add() function
d. Using append() function
40. Which of the following is/are the code editors in PHP?
a. Notepad++
b. Notepad
c. Adobe Dreamweaver
d. All of the above
41. Which of the following is used to end a statement in PHP?
a. . (dot)
b. ; (semicolon)
c. ! (exclamation)
d. / (slash)
42. String values in PHP must be enclosed within –
a. Double Quotes
b. Single Quotes
c. Both (a) and (b)
d. None of the above
43. Which of the following variable name is invalid?
a. $newVar
b. $new_Var
c. $new-var
d. All of the above
44. Which of the following is the correct way to create an array in PHP?
a. $season = array[“summer” , “winter” , “spring” , “autumn”];
b. $season = array(“summer” , “winter” , “spring” , “autumn”);
c. $season = “summer” , “winter” , “spring” , “autumn”;
d. All of the above
45. What will be the output of the following PHP code?
<?php
$num = 1;
$num1 = 2;
print $num . “+”. $num1;
?>
- 3
- 1+2
- 1.+.2
- Error
46. Total looping techniques supported by PHP are?
a. 1
b. 2
c. 3
d. 4
47. Choose whether true or false: while loop is an exit control loop.
a. False
b. True
c. Depends on the condition
d. None
48. Choose whether true or false: the do-while loop is an exit control loop.
a. False
b. True
c. Depends on the condition
d. None
49. Total types of the array in PHP is?
a. 2
b. 3
c. 4
d. 5
50. Index of an array by default starts with which of the following in PHP?
a. 0
b. -1
c. 1
d. 2
Mangaclash This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
FinTech ZoomUs This was beautiful Admin. Thank you for your reflections.