Sail E0 Webinar

MCQs

Total Questions : 28 | Page 2 of 3 pages
Question 11. Which of the following is the right way to use the DateTime class?
  1.    $date = get_Class(DateTime);
  2.    $date = class DateTime;
  3.    $date = new DateTime();
  4.    $date = new class DateTime();
 Discuss Question
Answer: Option C. -> $date = new DateTime();
Question 12. Which method is simply an object-oriented version of date()?
  1.    DateTime::format()
  2.    DateTime::modify()
  3.    DateTime::setTime()
  4.    DateTime::setDate()
 Discuss Question
Answer: Option A. -> DateTime::format()
Question 13. What will be the output of the following PHP code if date is 24/02/2008?
  1.    Sunday, February 24th 2008
  2.    Sunday, 02 24 2008
  3.    Sunday, 24 02 2008
  4.    Sunday, 24th February 2008
 Discuss Question
Answer: Option A. -> Sunday, February 24th 2008
Question 14. Which of the following statements can be used to set the time zone in individual scripts?
  1.    date_set_timezone(‘Europe/London’);
  2.    date_default_timezone_set(‘Europe/London’);
  3.    date_set_default_timezone(‘Europe/London’);
  4.    date_default_timezone(‘Europe/London’);
 Discuss Question
Answer: Option B. -> date_default_timezone_set(‘Europe/London’);
Question 15. Among the four PHP DateTimeZone classes given below how many are static?
1. listAbbreviations()
2. getName()
3. getOffset()
4. listIdentifiers()
  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option B. -> 2
Question 16. Among the four PHP DateTimeZone classes given below how many are nonstatic?
1. _construct()
2. getName()
3. getOffset()
4. getTransitions()
  1.    1
  2.    2
  3.    3
  4.    4
 Discuss Question
Answer: Option D. -> 4
Question 17. Which of the following statements can be used to add two months to the existing date?
  1.    $date->modify(‘+2 months’);
  2.    $date = modify(‘+2 months’);
  3.    $date = modify(‘2+ months’);
  4.    $date->modify(‘2+ months’);
 Discuss Question
Answer: Option A. -> $date->modify(‘+2 months’);
Question 18. Which method enables you to calculate whether daylight saving time is in force at a specific date and time?
  1.    getOffset()
  2.    getTranitions()
  3.    ISODate()
  4.    savingTime()
 Discuss Question
Answer: Option B. -> getTranitions()
Question 19. Which of the following functions do not return a timestamp?
1. time()
2. date()
3. strtotime()
4. localtime()
5. gmmktime()
  1.    Option 1 and 5
  2.    Option 2 and 4
  3.    Option 1 and 4
  4.    Option 2 and 4
 Discuss Question
Answer: Option D. -> Option 2 and 4
Question 20. The getdate() function returns
  1.    An integer
  2.    A floating-point number
  3.    An array
  4.    A string
  5.    A Boolean
 Discuss Question
Answer: Option C. -> An array

Latest Videos

Latest Test Papers