PHP 8

COEP
Lets Crack Online Exam

IT Interview Exam Paper: PHP 8

Subject: PHP 8

Part 8: List for questions and answers of PHP

 

Q1. How many methods does the DateTime class have?

a) 8

b) 9

c) 10

d) 11

 

Q2. How many constants does the DateTime class have?

a) 8

b) 9

c) 10

d) 11

 

Q3. Which method is simply an object-oriented version of date()?

a) DateTime::format()

b) DateTime::modify()

c) DateTime::setTime()

d) DateTime::setDate()

 

Q4. Which of the following is the right way to use the DateTime class?

a) $date = get_Class(DateTime);

b) $date = class DateTime;

c) $date = new DateTime();

d) $date = new class DateTime();

 

Q5. Which of the following statements can be used to set the time zone in individual scripts?

a) date_set_timezone(‘Europe/London’);

b) date_default_timezone_set(‘Europe/London’);

c) date_set_default_timezone(‘Europe/London’);

d) date_default_timezone(‘Europe/London’);

 

Q6. Which of the following statements can be used to add two months to the existing date?

a) $date->modify(‘+2 months’);

b) $date = modify(‘+2 months’);

c) $date = modify(‘2+ months’);

d) $date->modify(‘2+ months’); 

 

Q7. Which method enables you to calculate whether daylight saving time is in force at a specific date and time?

a) getOffset()

b) getTranitions()

c) ISODate()

d) savingTime()

 

Q8. Which two predefined variables are used to retrieve information from forms?

a) $GET and $SET

b) $_GET and $_SET

c) $__GET and $__SET

d) GET and SET

 

Q9. The attack which involves the insertion of malicious code into a page frequented by other users is known as..

a) basic sql injection

b) advanced sql injection

c) cross-site scripting

d) scripting

 

Q10. When you use the $_GET variable to collect data, the data is visible to..

a) none

b) only you

c) everyone

d) selected few

 

Q11. When you use the $_POST variable to collect data, the data is visible to..

a) none

b) only you

c) everyone

d) selected few

 

Q12. Which variable is used to collect form data sent with both the GET and POST methods?

a) $BOTH

b) $_BOTH

c) $REQUEST

d) $_REQUEST 

 

Q13. Which one of the following should not be used while sending passwords or other sensitive information?

a) GET

b) POST

c) REQUEST

d) NEXT

 

Q14. Which function is used to remove all HTML tags from a string passed to a form?

a) remove_tags()

b) strip_tags()

c) tags_strip()

d) tags_remove()

 

Q15. To validate an e-mail address, which flag is to be passed to the function filter_var()?

a) FILTER_VALIDATE_EMAIL

b) FILTER_VALIDATE_MAIL

c) VALIDATE_EMAIL

d) VALIDATE_MAIL

 

Q16. Which parameter determines whether the old session file will also be deleted when the session ID is regenerated?

a) delete_old_file

b) delete_old_session

c) delete_old_session_file

d) delete_session_file

 

Q17. Which function effectively deletes all sessions that have expired?

a) session_delete()

b) session_destroy()

c) session_garbage_collect()

d) session_expired_delete()

 

Q18. Which function is used to transform PHP’s session-handler behavior into that defined by your custom handler?

a) session_set_save()

b) session_set_save_handler()

c) Session_handler()

d) session_save_handler() 

 

Q19. The session_start() function must appear..

a) after the html tag

b) after the body tag

c) before the body tag

d) before the html tag

 

Q20. How many validation filters like FILTER_VALIDATE_EMAIL are currently available?

a) 5

b) 6

c) 7

d) 8 

 

Part 8: List for questions and answers of PHP

 

Q1. Answer: b

 

Q2. Answer: d

 

Q3. Answer: a

 

Q4. Answer: c

 

Q5. Answer: b

 

Q6. Answer: a

 

Q7. Answer:

 

Q8. Answer: b

 

Q9. Answer: c

 

Q10. Answer: c

 

Q11. Answer: b

 

Q12. Answer: d

 

Q13. Answer: a

 

Q14. Answer: b

 

Q15. Answer: a

 

Q16. Answer: c

 

Q17. Answer: c

 

Q18. Answer: b

 

Q19. Answer: d

 

Q20. Answer: c