1. What is PHP ?
Ans: PHP hypertext preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases.
2. What is the basic use of the PHP ?
Ans: It is basically used for developing web based software applications.
3. PHP is a server side scripting language that is embedded in ___________.
Ans: HTML
4. PHP syntax is _____
Ans: C-like
5. PHP can _____ data.
Ans: encrypt
6. What are the five basic characteristics of PHP ?
Ans:
- Simplicity
- Efficiency
- Security
- Flexibility
- Familiarity
7. If you want to develop php web pages then what are the three components must be installed on your system ?
Ans:
- Web server
- Database
- PHP parser
8. What is the php.ini ?
Ans: The PHP configuration file, php.ini is the final and most immediate way to affect PHP’s functionality.
9. What are the two commenting formats in PHP ?
Ans:
- Single-line comments
- Multi-lines comments
10. PHP is a case sensitive language True or False
Ans: True
11. What is whitespace ?
Ans: Whitespace is the stuff you type that is typically invisible on the screen, including spaces, tabs and carriage returns.
12. PHP is whitespace insensitive True or False
Ans: True
13. How to run the php script on the command prompt ?
Ans: Command: php test.php
14. All variables in PHP are denoted with a _________
Ans: $
15. PHP are perl-like True or False
Ans: True
16. What are the different data types exist in PHP ?
Ans: There are eight data types in PHP :
- Integers
- Doubles
- Booleans
- NULL
- Strings
- Arrays
- Objects
- Resources
17. What is resources ?
Ans: Resources are special variables that hold references to resources external to php. Example: database connections
18. How many scopes types exist in php ?
Ans:
- Local variables
- Function parameters
- Global variables
- Static variables
19. A constant value cannot change during the execution of the script. True or False
Ans: True
20. A constant is case-senitive True or False
Ans: True
21. What are the five magic php constants ?
Ans:
- ____LINE___
- ____FILE___
- ____FUNCTION____
- ____CLASS___
- ____METHOD___
22. What are the five type of operators support by php ?
Ans:
- Arithmetic Operators
- Comparison Operators
- Logical (or Relational ) Operators
- Assignment Operators
- Conditional (or ternary ) Operators
23. What are the four loop types supports by php ?
Ans:
- for loop
- while loop
- do..while
- foreach
24. What is the difference between continue statement and break statement ?
Ans: Continue : is used to halt the current iteration of a loop but it does not terminate the loop.
Break : is used to terminate the execution of a loop prematurely.
25. What are the three different kind of arrays ?
Ans:
- Numeric array
- Associative array
- Multidimensional array
26. What is array ?
Ans: An array is a data structure that stores one or more similar type of values in a single value.
27. To concatenate two string variables together, use the _____ operator.
Ans: dot
28. The __________ function is used to find the length of a string.
Ans: strlen()
29. The __________ function is used to search for a string or character within a string.
Ans: strpos()
30. What is the name of environment variables set by php to identifies the user’s browser and operating system ?
Ans: HTTP_USER_AGENT
31. The PHP __________ is used to generate a random number.
Ans: rand() function
32. The PHP ____________ function supplies raw http headers to the browser and can be used to redirect it to another location.
Ans: header()
33. What are the two ways that browser client can send information to the web server ?
Ans:
- The GET method
- The POST method
34. How GET method and POST method send the information ?
Ans: GET method : sends the encoded user information appended to the page request. POST method: transfers information via http headers.
35. The PHP ____________ variable can be used to get the result from data sent with both the GET andPOST methods.
Ans: $_REQUEST
36. What are the two php functions which can be used to included one PHP file into another PHP file ?
Ans: 1. The include () function 2. The require () function
37. What are the four basic steps to read a file in php ?
Ans:
- Open a file using fopen() function
- Get the file length using filesize() function
- Read the file’s content using fread() function
- Close the file with fclose() function
38. A new file can be written or text can be appended to an existing file using the PHP ________
Ans: fwrite () function
39. What is a function ?
Ans: A function is a piece of code which takes one more input in the form of parameter and does some processing and returns a value.
40. ___________ keyword is used to return a value from a function
Ans: return
41. What is cookies ?
Ans: cookies are text files stored on the client computer and they are kept of use tracking purpose.
42. PHP provided __________ function to set a cookie.
Ans: setcookie()
43. __________ variables are used to access the cookies.
Ans: $_COOKIE or $HTTP_COOKIE_VARS
44. _________ function to check if a cookie is set or not.
Ans: isset()
45. What is session ?
Ans: A session creates a file in a temporary directory on the server where registered session variables and their values are stored.
46. The location of the temporary file is determined by a setting in the php.ini file called ___________.
Ans: session.save_path
47. A php session is easily started by making a call to the ____________ function.
Ans: session_start
48. A php session can be destroyed by _________________ function.
Ans: session_destroy
49. PHP use ______________ function to send an email.
Ans: mail()
50. What are the three mandatory arguments required to send an email ?
Ans:
a. receipient’s email address
b. subject of the message
c. actual message.
51. Information in the phpinfo.php page describes the temporary directory that is used for file uploads as _______________
Ans: upload_tmp_dir
52. In phpinfo.php page describe the maximum permitted size of files that can be uploaded is stated as __________.
Ans: upload_max_filesize
53. ____________ contains a reference to every variable which is currently available within the global scope of the script.
Ans: $GLOBALS
54. _____________ is an array containing information such as headers, paths and script locations.
Ans: $_SERVER
55. ___________ is an associative array of variables passed to the current script via the HTTP GET method.
Ans: $_GET
56. ____________ is an associative array of variables passed to the current script via the HTTP POST method.
Ans: $_POST
57. ___________ is an associative array of items uploaded to the current script via the http POST method.
Ans: $_FILES
58. _____________ is a variable containing the text of the last error message generated by php.
Ans: $php_errormsg
59. What are the two types of regular expression function exist in php ?
Ans:
- POSIX regular expression
- PERL style regular expression
60. ___________ are used to find a range of characters.
Ans: Brackets ([])
61. In PHP , how many types of functions exist for searching strings using POSIX-style regular expressions.
Ans: There are seven functions exist for searching strings using POSIX-style regular expressions.
- ereg()
- ereg_replace()
- eregi()
- eregi_replace()
- split()
- spliti()
- sql_regcase()
62. In PHP, how many types of functions exist for searching strings using perl-compatible regular expressions.
Ans: There are six functions exist for searching strings using perl-compatible regular expressions.
- preg_match()
- preg_match_all()
- preg_replace()
- preg_split()
- preg_grep()
- preg_quote()
63. ________________ is the process of catching errors raised by your program and then taking appropriate action.
Ans: Error handling
64. In PHP, how to send errors to the web server error log ?
Ans: set log_errors to On
65. What is the function name which gives you all the information that you need about the current date and time ?
Ans: time() function
66. The __________ function returns a formatted string representing a date.
Ans: date()
67. ___________ module turns an XML document into an object that provides structured access to the xml.
Ans: simplexml
68. PHP provides a special function called _________________ to define a constructor.
Ans: __construct()
69. We can release all the resources with-in a destructor using ____________.
Ans: _destruct()
70. PHP 5 introduces the __________ keyword which prevent child classes from overriding a method by prefixing the definition with final.
Ans: final
71.What are the four things are similar between c and PHP ?
Ans:
- Syntax
- Operators
- Control Structures
- Function names
72. What are the two types of validation exist in PHP ?
Ans: 1. Client-side validation 2. Server-side validation
73. ____________ is used to provide the authentication for our web pages.
Ans: php login script
74. ___________ will erase the session data
Ans: logout.php
75. __________ is having information about php script and HTML script to do login.
Ans: login.php
76. ____________ is having information about how to logout from login session.
Ans: logout page
77. __________ will verify the session.
Ans: session.php
78. ______________ contained array of course names and it returns the value to web browser.
Ans: php_ajax.php
79. The _____________ provides the suggestions when you enter data into the field.
Ans: auto complete search box
80. _________ is used to call the data from xml file and send the result to web browsers.
Ans: livesearch.php
81. ____________ contained auto complete data and accessed by livesearch.php based on title field and url field.
Ans: autocomplete.xml
82. _____________ has contained syntax about how to get access to rss feeds and return rss feeds to web pages.
Ans: rss.php
83. A HTML Dom parser written in _____________ versions.
Ans: PHP5.X
84. What is framework ?
Ans: It is collection of software or program that trigger off easy coding and implementing the code.
85. _________ works based on model view control and having innovative plugins.
Ans: Fuel PHP
86. _____________ is a great source to build up simple and great web application in an easy way.
Ans: Cake PHP
87. ____________ is very helpful to make Restful web services and it is under MIT licence.
Ans: FlightPHP
88. ____________ is a special type that only has one value
Ans: NULL
89. ____________ containing one or more arrays and values are accessed using multiple indices.
Ans: Multidimensional arrays
90. The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. This process is known as ________.
Ans: escaping to php
91. ______________ checks the DNS record of corresponding the host or ip address.
Ans: checkdnsrr function
92. _____________ closing the connection of system logger.
Ans: closelog function
93. ____________ is used to open internet or unix domain socket connections.
Ans: fsockopen function
94. _____________ returns the error code from the last connection.
Ans: gethostbyaddr function
95. ___________ is used to get the host name
Ans: gethostname function
96. ____________ is used to get the MX records to host.
Ans: getmxrr function
97. __________ is used to get protocol number which has associated with protocol name.
Ans: getprotobyname function
98. ____________ is used to send the row of http headers.
Ans: header function
99. _________ used to convert internet package to human readable format.
Ans: inet_ntop function
100. __________ is used to open internet or unix domain socket.
Ans: pfsockopen function