NEW
Font size
Worksheets1 History of Python
Total questions: 69
Worksheet time: 12mins
Which motivation best explains why Guido van Rossum began creating Python in 1989?
To make a language that was easier to learn and use than languages like C or Java
To build a faster replacement for machine code
To create a domain-specific language only for web pages
To replicate the exact syntax of C++
Python’s name was inspired by which source?
A species of snake native to Africa
A Dutch research institute
A British comedy series titled “Monty Python’s Flying Circus”
An operating system called Monty
What is the correct pairing of creator and early workplace associated with Python’s origin?
Dennis Ritchie at Bell Labs
Guido van Rossum at CWI (Centrum Wiskunde & Informatica)
James Gosling at Sun Microsystems
Bjarne Stroustrup at AT&T
In which year was the first official version, Python 1.0, released?
1989
1991
1995
2000
Which feature was already present in Python 1.0?
Structural pattern matching
List comprehensions
Functions and exception handling
Walrus operator (:=)
Which set lists features introduced with Python 2.0 in 2000?
Unicode handling, list comprehensions, and garbage collection
F-strings, walrus operator, and pattern matching
Bytecode compilation only
Static typing and generics
Why might a program written for Python 2 not run directly in Python 3?
Python 3 removed Unicode support
Python 3 is not cross-platform
Python 3 was not backwards-compatible with Python 2
Python 3 eliminated the standard library
Which change is correctly associated with Python 3 compared with Python 2?
Removal of Unicode support to simplify text
New print() function syntax replacing the print statement
Introduction of garbage collection
Addition of GOTO statements
Match each Python 3.x version to its notable addition: Which pairing is correct?
Python 3.6 — structural pattern matching
Python 3.8 — f-strings
Python 3.10 — walrus operator (:=)
Python 3.11 — performance and speed improvements
Which combination best captures major reasons for Python’s popularity according to the text?
Difficult syntax, single-platform, small community
Simple, readable syntax; versatility across domains; strong community; cross-platform
Only for AI; weak library support; Linux-only
Complex like C++; niche use cases; closed-source tools
Support for Python 2 officially ended in which month and year?
January 2008
January 2020
December 2015
June 2019
Which sequence correctly orders key historical milestones?
Start in 1989 → Python 1.0 in 1991 → Python 2.0 in 2000 → Python 3.0 in 2008
Python 1.0 in 1991 → Start in 1989 → Python 3.0 in 2008 → Python 2.0 in 2000
Start in 1989 → Python 3.0 in 2008 → Python 2.0 in 2000 → Python 1.0 in 1991
Python 2.0 in 2000 → Start in 1989 → Python 1.0 in 1991 → Python 3.0 in 2018
Which step is essential during Python installation to ensure you can run python from any terminal without specifying its full path?
Selecting custom install location
Checking the box Add Python to PATH
Choosing the latest Long-Term Support (LTS) release
Creating a virtual environment first
You want to verify that Python was installed correctly on macOS or Linux where python may refer to Python 2. Which command from the material is the safer choice to check the Python 3 version?
python -v
python --version
python3 --version
pip --version
A beginner wants a simple environment that already ships with Python for writing small scripts. Which IDE best fits this scenario according to the material?
VS Code
Jupyter Notebook
PyCharm
IDLE
You are planning a large, complex Python project that benefits from powerful refactoring and project management features. Based on the material, which IDE is most appropriate?
IDLE
PyCharm
Jupyter Notebook
nano
Which statement best distinguishes VS Code from the other IDEs mentioned in the material?
It comes pre-installed with Python and needs no setup.
It is free, lightweight, widely used, and requires a Python extension.
It is designed primarily for data science with notebook-style execution.
It is a commercial IDE only available on Windows.
You need an interactive, notebook-style environment popular in Data Science and Machine Learning. According to the steps provided, which sequence of commands starts it after installation?
pip install jupyter; jupyter run
conda install notebook; start notebook
pip install notebook; jupyter notebook
pip install jupyterlab; jupyterlab start
A script named analyze.py is saved in a folder. According to the material, which is the correct terminal command to run it after navigating to its folder?
run analyze.py
python analyze.py
exec analyze.py
python3 run analyze.py
Which statement best defines a Python script based on the material?
A compiled executable generated by Python
A file that contains Python code and is saved with a .py extension
A folder that stores multiple Python projects
A cloud service for running Jupyter notebooks
You saved a file as hello.py that contains print("Hello, Python!"). Which terminal command, as shown in the material, will execute it?
run hello.py
python hello.py
execute hello.py
py run hello
When using an IDE/IDLE to run a Python script, which action aligns with the described process?
Open the terminal and type compile hello.py
Open the script and click Run (or press F5)
Rename the file to .exe and double-click
Right-click the file and choose Convert
In the sample script labeled My first Python script, what output is produced when executed?
Hello, World!
Hello, Python!
Welcome User
The sum is: 30
Consider the example that adds two numbers where a = 10 and b = 20. What value is printed for sum?
10
20
30
40
According to the greeting example, if a user types Aman at the prompt, which line will the program print next?
Welcome, user
Welcome Aman
Hello Aman!
User: Aman
Which step is NOT part of the basic process for writing a Python script as outlined?
Open an editor or IDE
Write Python code
Save the file with a .py extension
Compile to bytecode manually before running
Which statement captures the purpose of Python syntax as introduced?
It determines only how variables are stored in memory
It is the set of rules we must follow when writing Python code, like grammar in English
It is a special library for printing text
It is an operating system feature for running scripts
Which statement best describes Python keywords?
They are user-defined names for data storage.
They are special reserved words with a fixed meaning.
They are optional labels used only for comments.
They are symbols used only in arithmetic operations.
Which of the following CANNOT be used as a variable name in Python?
data1
_result
for
totalSum
Given the example using if and else, what output is produced when x = 10?
x is smaller
x is greater than 5
10
True
In the variables example, which data type best matches the value assigned to pi?
Integer
String
Float
Boolean
Which rule about variable names is explicitly stated?
They must include at least one number.
They must start with a letter or underscore.
They must be written in uppercase.
They must end with a digit.
Which pair shows valid variable names according to the rules provided?
1name and age1
valid_name and _name
for and else
Name and name (treated as the same)
A student writes Name = "Aman" and later prints name. Based on case sensitivity, what will most likely happen?
It will print Aman because Python ignores case in variable names.
It will raise an error because Name and name are different identifiers.
It will print an empty line.
It will automatically convert Name to name.
You want to store a person's age without declaring a type first. According to the material, what is the correct approach in Python?
Declare the type int age; before assigning.
Use age = 17; Python decides the type automatically.
Use var age = 17 to signal dynamic typing.
You cannot store numbers without manual type declaration.
Given the code: x = 5; if x > 0: (indent) print("Positive number"); print("This line is outside the if"). Which output best matches correct indentation where only the first print is inside the if block?
Positive number on one line, then This line is outside the if on the next line
Only Positive number prints
Only This line is outside the if prints
A syntax error occurs due to indentation
In Python, what will the following code print? name = "Aman"; if name == "Aman": (indent) print("Hello Aman"); else: (indent) print("Who are you?")
Hello Aman
Who are you?
A NameError for variable name
Nothing prints
Given Age = 15 and age = 20 followed by print(Age) and print(age), what is printed?
15 then 20
20 then 15
35 on one line
A SyntaxError due to variable case
Why is the identifier 1st_number invalid in Python?
It contains an underscore
It starts with a digit
It is too long
It uses a reserved keyword
Given x = 10, y = 3.14, z = "Hello"; what is the printed output of print(x, y, z)?
10 3.14 Hello
"10" "3.14" "Hello"
10, 3.14, Hello on separate lines
A TypeError when printing mixed types
Consider marks = 50; marks = marks + 10; print("Updated marks:", marks). What is the result?
Updated marks: 60
Updated marks: 50
Updated marks: 10
A SyntaxError due to reassignment
Which assignment correctly stores three different values into a, b, c in one statement?
a, b, c = 10, 20, 30
a = b = c = 10, 20, 30
a, b, c == 10, 20, 30
(a, b, c) <- 10 20 30
What will print(x, y, z) output after executing x = y = z = 100?
100 100 100
100 200 300
0 0 0
It raises an assignment error
Given is_student = True and is_teacher = False, what is printed by print(is_student); print(is_teacher)?
True then False
False then True
1 then 0
It prints nothing
Strategic reasoning: You need a variable for loop counting that does not clash with keywords. Which of the following is valid and safest to use in Python?
for = 20
count1 = 0
1st_value = 0
If = 1
In Python, what is the correct way to print the contents of a variable named name?
print(name)
print('name')
echo(name)
printf(name)
You have two variables age and city. Which statement correctly prints them together separated by a space?
print(age + city)
print(age, city)
print('age', 'city')
print(age city)
Which statement assigns the value 100 to variables a, b, and c in a single line?
a, b, c = 100
a = b = c = 100
a = 100; b, c = 100
a == b == c == 100
Given marks is an integer, which code correctly prints Pass if marks is greater than 40, otherwise prints Fail?
if marks > 40: print('Pass') else print('Fail')
if marks > 40: print('Pass') else: print('Fail')
print('Pass') if marks > 40 else print('Fail')
if (marks > 40) then print('Pass') else print('Fail')
Which example best demonstrates that Python variable names are case-sensitive?
Age = 20; age = 25; print(Age, age)
age = 20; AGE = age; print(AGE)
age = Age = 30; print(age)
age == Age
What happens if you try to create a variable named class in Python 3?
It works like any normal variable.
It creates a new class automatically.
It raises a SyntaxError because class is a keyword.
It shadows the built-in type and gives a warning only.
Which assignment stores your height as a floating-point number in variable height?
height = '1.75'
height = 1.75
float height = 1.75
height := float(1.75)
Variable score currently equals 20. Which statement updates it by adding 15 and then prints the new value?
score =+ 15; print(score)
score += 15; print(score)
score = score + '15'; print(score)
print(score + 15); score = score
Which line correctly assigns values 10, 20, and 30 to variables a, b, and c respectively and then prints them?
a = 10, b = 20, c = 30; print(a b c)
a, b, c = 10, 20, 30; print(a, b, c)
a b c = 10 20 30; print(a, b, c)
(a, b, c) == (10, 20, 30); print(a, b, c)
Which code prints Even if number is divisible by 2; otherwise prints Odd?
if number % 2 = 0: print('Even') else: print('Odd')
if number % 2 == 0: print('Even') else: print('Odd')
print('Even') if number % 2 == 0 else print('Odd')
if (number / 2): print('Even') else: print('Odd')
A Python script sets length = 5 and width = 3, then computes area = length * width. What value will be printed for the area of the rectangle?
8
15
53
30
Given radius = 7 and pi = 3.14, a program calculates area = pi * radius * radius. Which output is correct?
21.98
43.96
153.86
314.00
A cube volume is computed with side = 4 using volume = side ** 3. What is the printed volume?
12
16
32
64
A program uses radius = 3, height = 10, pi = 3.14 and computes volume = pi * radius * radius * height. Which value matches the output?
94.2
282.6
565.2
188.4
Consider the snippet: num = -5; if num > 0: print("Positive") elif num < 0: print("Negative") else: print("Zero"). What is printed?
Positive
Negative
Zero
Error
In a voting check, age = 16; if age >= 18: print("Eligible to vote") else: print("Not eligible"). What is the output?
Eligible to vote
Not eligible
Error due to comparison
Eligible with consent
Given a = 25 and b = 40, the code if a > b: print("Largest:", a) else: print("Largest:", b) executes. What is printed?
Largest: 25
Largest: 40
Largest: 65
No output
A pass/fail program checks marks = 35 with if marks >= 40: print("Pass") else: print("Fail"). What will be printed?
Pass
Fail
Error
Retest
The code checks num = 11 with if num % 2 == 0: print("Even") else: print("Odd"). Which result appears?
Even
Odd
Zero
Undefined
Given the code: name = "Aman"; age = 20; print("Hello", name, ", you are", age, "years old."). What is printed?
Hello Aman , you are 20 years old.
Hello Aman you are 20 years old
Hello, Aman you are 20 years old.
Hello Aman, you are 20
A variable x holds the string "25". After y = int(x), an if statement checks if y > 20 and prints a message accordingly. Which output matches this logic?
Greater than 20
Less than 20
Equal to 20
TypeError
For r = "10" converted using radius = float(r), with pi = 3.14 and area = pi * radius * radius, which value is printed for the area?
31.4
62.8
314.0
100.0
Given a = 20 and b = 5, which expression and result pair is correct according to the sample arithmetic operations?
a + b -> 15
a - b -> 25
a * b -> 100
a / b -> 2.0
Marks are m1 = 60, m2 = 70, m3 = 50. Using avg = (m1 + m2 + m3) / 3, what is avg?
60.0
56.0
58.0
70.0
