Skip to main content

Date And Timestamp MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Date And Timestamp with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
30
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
36 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
30

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/30 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 30
★ FPSC ★ PPSC

What will be the output of the following PHP code? <?php echo (checkdate( 4,31,2010 ) ? 'Valid' : 'Invalid' ) ; ?>

Question 2 of 30
★ FPSC ★ PPSC

The date() function returns ___ representation of the current date and/or time.

Question 3 of 30
★ FPSC ★ PPSC

Which one of the following format parameter can be used to identify timezone?

Question 4 of 30
★ FPSC ★ PPSC

If the format is F then which one of the following will be returned?

Question 5 of 30
★ FPSC ★ PPSC

What will be the output of the following code? If say date is 22/06/2013. <?php echo "Today is " .date( "F d, Y" ) ?>

Question 6 of 30
★ FPSC ★ PPSC

Which function displays the web page’s most recent modification date?

Question 7 of 30
★ FPSC ★ PPSC

What will be the output of the following PHP code? If say date is 22/06/2013. <?php printf( date( "t" ) ) ?>

Question 8 of 30
★ FPSC ★ PPSC

Say you want to calculate the date 45 days from the present date which one of the following statement will you use?

Question 9 of 30
★ FPSC ★ PPSC

To create an object and set the date to JUNE 22, 2013, which one of the following statement should be executed?

Question 10 of 30
★ FPSC ★ PPSC

How many methods does the DateTime class have?

Question 11 of 30
★ FPSC ★ PPSC

How many constants does the DateTime class have?

Question 12 of 30
★ FPSC ★ PPSC

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

Question 13 of 30
★ FPSC ★ PPSC

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

Question 14 of 30
★ FPSC ★ PPSC

What will be the output of the following PHP code if date is 24/02/2008? <?php $date = new DateTime () ; echo $date- > format( 'l,F,js,Y' ) ?>

Question 15 of 30
★ FPSC ★ PPSC

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

Question 16 of 30
★ FPSC ★ PPSC

Among the four PHP DateTimeZone classes given below how many are static? 1. listAbbreviations() 2. getName() 3. getOffset() 4. listIdentifiers()

Question 17 of 30
★ FPSC ★ PPSC

Among the four PHP DateTimeZone classes given below how many are nonstatic? 1. _construct() 2. getName() 3. getOffset() 4. getTransitions()

Question 18 of 30
★ FPSC ★ PPSC

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

Question 19 of 30
★ FPSC ★ PPSC

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

Question 20 of 30
★ FPSC ★ PPSC

Which one of the following function is useful for producing a timestamp based on a given date and time.

Question 21 of 30
★ FPSC ★ PPSC

Which of the following functions do not return a timestamp? 1. time() 2. date() 3. strtotime() 4. localtime() 5. gmmktime()

Question 22 of 30
★ FPSC ★ PPSC

The getdate() function returns

Question 23 of 30
★ FPSC ★ PPSC

.......... Returns the time of sunrise for a given day / location.

Question 24 of 30
★ FPSC ★ PPSC

What will the following script output? <?php $time = strtotime ( '2004/01/01' ) ; echo date ( 'H:i:s', $time ) ; ?>

Question 25 of 30
★ FPSC ★ PPSC

................Checks a date for numeric validity.

Question 26 of 30
★ FPSC ★ PPSC

What is the difference, in seconds, between the current timestamp in the GMT time zone and the current timestamp in your local time zone?

Question 27 of 30
★ FPSC ★ PPSC

You must make a call to ................... to specify what time zone you want calculations to take place in before calling any date functions.

Question 28 of 30
★ FPSC ★ PPSC

What would happen if the following script were run on a Windows server set to Moscow, Russia’s time zone? <?php echo gmmktime ( 0, 0, 0, 1, 1, 1970 ) ; ?>

Question 29 of 30
★ FPSC ★ PPSC

The ......... function parses an English textual date or time into a Unix timestamp.

Question 30 of 30
★ FPSC ★ PPSC

................ Formats a local time or date according to locale settings.

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 Examiner's Advisory for Programming & Software Development

In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →