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. /A program has eight lines. Line 5 has a missing comma and line 7 has a missing bracket, so neither…
MediumComputer ScienceHigh School (9–10)Computer Science › Software, Languages and TranslatorsNumericalConceptualIGCSE

A program has eight lines. Line 5 has a missing comma and line 7 has a missing bracket, so neither…

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.

A program has eight lines. Line 5 has a missing comma and line 7 has a missing bracket, so neither can be translated. Every other line is correct, and line 4 outputs a number.

listing
1  score = 7
2  bonus = 3
3  total = score + bonus
4  print(total)
5  print('Well done' total)
6  half = total / 2
7  print(half
8  print('End')
  1. The program is run with an interpreter. How many lines are translated and run? What is output?
  1. The program is given to a compiler. How many errors are reported? How many lines are run?

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. It translates and runs lines 1 to 4. Line 4 outputs 101010, because 7+3=107 + 3 = 107+3=10. At line 5 it finds the missing comma and stops. So 444 lines are run, and it never reaches line 7.

Step 2. The compiler. It translates the whole code before running any of it. It reports 222 errors, on lines 5 and 7. No executable file is made, so 000 lines are run.

Answer: (a) 444 lines, output 101010. (b) 222 errors, 000 lines run.

Watch out. The interpreter reports one error at a time. After the programmer fixes line 5 and runs it again, it will stop at line 7. The compiler shows both at once.

Log in to save this for later
← All Problems
← Say whether each statement is about a compiler or an interpreter…A programmer uses an interpreter while she writes a game… →
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. In a model with made-up times, a program takes 3 s each time it is run with an interpreter…Hard
  4. A programmer uses an interpreter while she writes a game…Medium
  5. Say whether each statement is about a compiler or an interpreter…Easy
All problems on this topic →