Quiz 2 Answer Key

Programming Languages • High Level vs Low Level • Compiled vs Interpreted

Use this to check your understanding and fix mistakes after the quiz.

Question 1

A low level programming language:

  1. is slower to execute than a high level language
  2. can be run on any platform without changes
  3. requires less execution time than a high level language
  4. is friendlier to humans than a high level language
Correct Answer: C
requires less execution time than a high level language

Why: Low level languages are closer to the computer.

Because: They usually run faster and give more direct control over hardware.

Question 2

True or False: Most of the widely used computer programs of today are high level languages.

  1. Both are equally common
  2. It depends on the computer’s speed
  3. False
  4. True
Correct Answer: D
True

Why: Most popular modern languages are high level.

Because: They are easier for people to read, write, debug, and use for many kinds of programs.

Question 3

Which of the following is a difference between a compiled and an interpreted language?

  1. Programs written in a compiled language are run directly by the computer while interpreted languages need additional software to run.
  2. A compiled language is considered low level while an interpreted language is considered high level.
  3. Programs written in an interpreted language can be partially run before an error is found, while a compiled language won’t run if any errors exist.
  4. Compiled programs can run on any computer without changes.
Correct Answer: C
Programs written in an interpreted language can be partially run before an error is found, while a compiled language won’t run if any errors exist.

Why: An interpreted language runs line by line.

Because: Python can run the first part of a program, then stop exactly where the mistake happens. A compiled program usually has to pass the full check before it runs.

Question 4

You need to choose a language for two different projects: programming a robot’s movements and building a website for users. Which statement shows the best match?

  1. Use low level interpreted languages for both, so the same code works everywhere.
  2. Use a low level compiled language for the robot and a high level interpreted language for the website.
  3. Use high level compiled languages for both, since they run fastest on all machines.
  4. Use a high level interpreted language for the robot and a low level compiled language for the website.
Correct Answer: B
Use a low level compiled language for the robot and a high level interpreted language for the website.

Why: Different jobs need different strengths.

Because: A robot needs speed and hardware control, while a website is usually easier to build with a more human friendly language.

Question 5

Why does Python stop at line 8 when there is an error?

  1. Python runs your code one line at a time, stopping when it finds an error.
  2. Python turns your code into machine language before running it.
  3. Python waits until the very end to check for errors.
  4. Python compiles the whole program before running it.
Correct Answer: A
Python runs your code one line at a time, stopping when it finds an error.

Why: Python is interpreted.

Because: It reads and runs the program step by step, so it can tell you the exact line where the problem appears.