HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /In a model with made-up times, a program takes 3 s each time it is run with an interpreter…
HardComputer ScienceHigh School (9–10)Computer Science › Software, Languages and TranslatorsNumericalIGCSE

In a model with made-up times, a program takes 3 s each time it is run with an interpreter…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

In a model with made-up times, a program takes 333 s each time it is run with an interpreter. Compiling it once takes 202020 s, and then the executable file takes 111 s for each run. The program is run 505050 times.

  1. What is the total time with the interpreter?
  1. What is the total time with the compiler, including the compiling?
  1. After how many runs do the two ways take the same total time?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

A compiler translates the whole code at once, before executing it, produces an executable file, and gives an error report for the whole code. An interpreter translates and executes the code line by line and stops when it finds an error. An interpreter is mostly used when developing a program; a compiler translates the final program.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. The interpreter. 50×3=15050 \times 3 = 15050×3=150 s.

Step 2. The compiler. 20+50×1=7020 + 50 \times 1 = 7020+50×1=70 s.

Step 3. The same total. After nnn runs, 3n=20+n3n = 20 + n3n=20+n. So 2n=202n = 202n=20 and n=10n = 10n=10 runs.

Answer: (a) 150150150 s. (b) 707070 s. (c) 101010 runs.

Check. At 101010 runs: interpreter 303030 s, compiler 20+10=3020 + 10 = 3020+10=30 s. The same.

What if? While the program is being written, it is changed and run a few times between changes. Each change needs a new compile, so the interpreter is often quicker then. That is why it is used during development.

Log in to save this for later
← All Problems
← A programmer uses an interpreter while she writes a game…Name the function of an IDE in each case… →
More onComputer Science › Software, Languages and Translators

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. A programmer uses the identifier TotalPrice, which has 10 letters, 25 times in a program…Medium
  2. Name the function of an IDE in each case…Easy
  3. A programmer uses an interpreter while she writes a game…Medium
  4. A program has eight lines. Line 5 has a missing comma and line 7 has a missing bracket, so neither…Medium
  5. Say whether each statement is about a compiler or an interpreter…Easy
All problems on this topic →