1. String.format(Locale.US, "%02d:%02d", m, s) produces for m = 3, s = 7:
- 3:7
- 03:07
- 0307
- 3:07
Answer: B) 03:07
Explanation: %02d pads numbers to two digits.
MCQs / Computer Science / Lab: Countdown Timer
11 multiple-choice questions on Lab: Countdown Timer from Computer Science, each with the correct answer and, where available, a teacher's explanation. Read through them to revise the chapter, then practise the same questions one by one to test yourself.
Answer: B) 03:07
Explanation: %02d pads numbers to two digits.
Answer: C) The remaining time can be recomputed accurately after recreation
Explanation: endTime − currentTime gives the true remaining time.
Answer: B) To stop the old timer so it does not keep updating a destroyed activity (memory leak)
Explanation: Cancelling prevents leaks and duplicate timers after rotation.
Answer: A) Recreate the activity and lose the timer's progress
Explanation: Rotation destroys the activity and its variables.
Answer: D) Main (UI) thread, so views can be updated directly
Explanation: It posts callbacks to the main thread looper.
Answer: D) ViewModel exposing StateFlow/LiveData
Explanation: ViewModels survive configuration changes.
Answer: B) onFinish()
Explanation: onFinish runs when the time is over.
Answer: B) millisInFuture and countDownInterval
Explanation: It takes the total duration and the tick interval in milliseconds.
Answer: C) VIBRATE
Explanation: VIBRATE is a normal permission granted at install.
Answer: D) onTick(millisUntilFinished)
Explanation: onTick receives the remaining milliseconds.
Answer: B) Call cancel() and store the remaining time; create a new timer with it to resume
Explanation: CountDownTimer has no pause method.
Practise Lab: Countdown Timer MCQs