High-level language

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

High-level language

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which describes a high-level language?
A Uses only binary 1s and 0s that the CPU runs directly
B Uses English-like words that are easy for people to read and write
2. Which of these is a high-level language?
A Machine code
B Python
3. Which statement about a high-level language is true?
A One statement can do the work of many machine instructions
B One statement always matches exactly one machine instruction
4. Can the CPU run high-level code directly?
A No, it must be translated into machine code first
B Yes, the CPU understands English-like keywords directly
5. Which line is written in a high-level language?
A print("Hello")
B 10110000 01100001

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1print("Hello") Aif mark >= 50: print("Pass")
2Python, Java, Visual Basic BHigh-level languages use English-like words, not binary, and they must be translated into machine code before the CPU can run them.
3A high-level language uses English-like keywords so people can read and write it easily CExamples of high-level languages that use English-like words and must be translated before the CPU can run them
4High-level code cannot be run directly by the CPU, so it must be translated into machine code first DOne English-like statement that makes the computer display text, which is far easier to read than the many machine instructions needed to do it
5A high-level language is written in binary so the CPU can run it directly with no translation Esource code -> compiler or interpreter -> machine code
6total = a + b is hard to read because one high-level statement is just one machine instruction FOne high-level statement usually becomes many machine instructions, and it is easy to read, not hard.

Definitions

high-level language

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
_____("Hello, world!")
2.
name = _____("Enter your name: ")
3.
__ score >= 50: print("Pass")
4.
for i in _____(5): print(i)
5.
total = ___([4, 7, 9])

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A name = input("Name: ")
B if name = "Ava":
C print("Hi Ava")
D else:
E print("Hello")
Question 2
A total = 0
B for n in range(1, 4):
C total = totl + n
D print(total)
Question 3
A score 72
B if score >= 50:
C print("Pass")
Question 4
A count = 0
B while count < 3:
C Print(count)
D count = count + 1
Question 5
A for i in range(3)
B print("Hello")
C print("Done")

Answer Key

High-level language
Section A: Quick Questions
Q1
B — Uses English-like words that are easy for people to read and write
Q2
B — Python
Q3
A — One statement can do the work of many machine instructions
Q4
A — No, it must be translated into machine code first
Q5
A — print("Hello")
Section B: Match the Pairs
Q1
print("Hello") → One English-like statement that makes the computer display text, which is far easier to read than the many machine instructions needed to do it
Q2
Python, Java, Visual Basic → Examples of high-level languages that use English-like words and must be translated before the CPU can run them
Q3
A high-level language uses English-like keywords so people can read and write it easily → if mark >= 50: print("Pass")
Q4
High-level code cannot be run directly by the CPU, so it must be translated into machine code first → source code -> compiler or interpreter -> machine code
Q5
A high-level language is written in binary so the CPU can run it directly with no translation → High-level languages use English-like words, not binary, and they must be translated into machine code before the CPU can run them.
Q6
total = a + b is hard to read because one high-level statement is just one machine instruction → One high-level statement usually becomes many machine instructions, and it is easy to read, not hard.
Section C: Definitions
Q1
high-level language — A programming language using English-like words that is easy for people to read and write, such as Python or Java. One statement does many jobs, and it must be translated before the CPU can run it.
Section D: Fill in the Blanks
Q1
print("Hello, world!")
Q2
name = input("Enter your name: ")
Q3
if score >= 50: print("Pass")
Q4
for i in range(5): print(i)
Q5
total = sum([4, 7, 9])
Section E: Spot the Error
Q1
B — A single = assigns a value. Python needs == to compare two values in an if statement. The line should be if name == "Ava":
Q2
C — The variable name is misspelt. Python does not know 'totl', so it gives an error. The line should be total = total + n
Q3
A — The assignment operator = is missing, so the statement is not valid. The line should be score = 72
Q4
C — Python is case-sensitive and its keyword for output is lowercase. The line should be print(count)
Q5
A — A for statement in Python must end with a colon. The line should be for i in range(3):