Priti's Technical Corner

December 8, 2009

PHP Interview Questions

Filed under: PHP — Tags: , , , , — pritisolanki @ 8:25 am

Question 1 : Which of the following functions send a cookie without encoding the cookie value
a. setCookie()
b. header()
c. setRawCookie()
d. headers_list()
Answer: c

Question 2 : Which of the following filtering tech prevents cross site scripting vulnerabilities
Answer 2:
a. Strip all occurrences of the string “script”
b. Strip all occurrences of the string “javascript”
c. Enable magic_quotes_gpc()
d. None of the above

Answer: d

Question 3: why must you call session_start() pripor to any output?
Answer 3:
a. Becasue it is easy to forget if not placed at the top
b. Because you can no longer access the session data store after there has been output
c. because session_start() set some http headers
d. because  calling session_start() casues the http headers to be sent

Answer : c

Question 4: Which of the following functions require an open file resource?
a. fgets()
b. fopen()
c. filemtime()
d. rewind()
e. reset()

Answer : a & d

Question 5: internally PHP handle date and time as
a. A “date aray” consisting of the year,month,day,hour,min and sec.
b. A unix timestamp representing the number of sec since the unix epoch
c. A ISO-8601 date entity
d. A unix timestamp consisting of the number of microseconds since the unix epoch

Answer : b


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: