wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

1 History of Python

Total questions: 69

Worksheet time: 12mins

Name
Class
Date
1.

Which motivation best explains why Guido van Rossum began creating Python in 1989?

a)

To make a language that was easier to learn and use than languages like C or Java

b)

To build a faster replacement for machine code

c)

To create a domain-specific language only for web pages

d)

To replicate the exact syntax of C++

2.

Python’s name was inspired by which source?

a)

A species of snake native to Africa

b)

A Dutch research institute

c)

A British comedy series titled “Monty Python’s Flying Circus”

d)

An operating system called Monty

3.

What is the correct pairing of creator and early workplace associated with Python’s origin?

a)

Dennis Ritchie at Bell Labs

b)

Guido van Rossum at CWI (Centrum Wiskunde & Informatica)

c)

James Gosling at Sun Microsystems

d)

Bjarne Stroustrup at AT&T

4.

In which year was the first official version, Python 1.0, released?

a)

1989

b)

1991

c)

1995

d)

2000

5.

Which feature was already present in Python 1.0?

a)

Structural pattern matching

b)

List comprehensions

c)

Functions and exception handling

d)

Walrus operator (:=)

6.

Which set lists features introduced with Python 2.0 in 2000?

a)

Unicode handling, list comprehensions, and garbage collection

b)

F-strings, walrus operator, and pattern matching

c)

Bytecode compilation only

d)

Static typing and generics

7.

Why might a program written for Python 2 not run directly in Python 3?

a)

Python 3 removed Unicode support

b)

Python 3 is not cross-platform

c)

Python 3 was not backwards-compatible with Python 2

d)

Python 3 eliminated the standard library

8.

Which change is correctly associated with Python 3 compared with Python 2?

a)

Removal of Unicode support to simplify text

b)

New print() function syntax replacing the print statement

c)

Introduction of garbage collection

d)

Addition of GOTO statements

9.

Match each Python 3.x version to its notable addition: Which pairing is correct?

a)

Python 3.6 — structural pattern matching

b)

Python 3.8 — f-strings

c)

Python 3.10 — walrus operator (:=)

d)

Python 3.11 — performance and speed improvements

10.

Which combination best captures major reasons for Python’s popularity according to the text?

a)

Difficult syntax, single-platform, small community

b)

Simple, readable syntax; versatility across domains; strong community; cross-platform

c)

Only for AI; weak library support; Linux-only

d)

Complex like C++; niche use cases; closed-source tools

11.

Support for Python 2 officially ended in which month and year?

a)

January 2008

b)

January 2020

c)

December 2015

d)

June 2019

12.

Which sequence correctly orders key historical milestones?

a)

Start in 1989 → Python 1.0 in 1991 → Python 2.0 in 2000 → Python 3.0 in 2008

b)

Python 1.0 in 1991 → Start in 1989 → Python 3.0 in 2008 → Python 2.0 in 2000

c)

Start in 1989 → Python 3.0 in 2008 → Python 2.0 in 2000 → Python 1.0 in 1991

d)

Python 2.0 in 2000 → Start in 1989 → Python 1.0 in 1991 → Python 3.0 in 2018

13.

Which step is essential during Python installation to ensure you can run python from any terminal without specifying its full path?

a)

Selecting custom install location

b)

Checking the box Add Python to PATH

c)

Choosing the latest Long-Term Support (LTS) release

d)

Creating a virtual environment first

14.

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?

a)

python -v

b)

python --version

c)

python3 --version

d)

pip --version

15.

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?

a)

VS Code

b)

Jupyter Notebook

c)

PyCharm

d)

IDLE

16.

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?

a)

IDLE

b)

PyCharm

c)

Jupyter Notebook

d)

nano

17.

Which statement best distinguishes VS Code from the other IDEs mentioned in the material?

a)

It comes pre-installed with Python and needs no setup.

b)

It is free, lightweight, widely used, and requires a Python extension.

c)

It is designed primarily for data science with notebook-style execution.

d)

It is a commercial IDE only available on Windows.

18.

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?

a)

pip install jupyter; jupyter run

b)

conda install notebook; start notebook

c)

pip install notebook; jupyter notebook

d)

pip install jupyterlab; jupyterlab start

19.

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?

a)

run analyze.py

b)

python analyze.py

c)

exec analyze.py

d)

python3 run analyze.py

20.

Which statement best defines a Python script based on the material?

a)

A compiled executable generated by Python

b)

A file that contains Python code and is saved with a .py extension

c)

A folder that stores multiple Python projects

d)

A cloud service for running Jupyter notebooks

21.

You saved a file as hello.py that contains print("Hello, Python!"). Which terminal command, as shown in the material, will execute it?

a)

run hello.py

b)

python hello.py

c)

execute hello.py

d)

py run hello

22.

When using an IDE/IDLE to run a Python script, which action aligns with the described process?

a)

Open the terminal and type compile hello.py

b)

Open the script and click Run (or press F5)

c)

Rename the file to .exe and double-click

d)

Right-click the file and choose Convert

23.

In the sample script labeled My first Python script, what output is produced when executed?

a)

Hello, World!

b)

Hello, Python!

c)

Welcome User

d)

The sum is: 30

24.

Consider the example that adds two numbers where a = 10 and b = 20. What value is printed for sum?

a)

10

b)

20

c)

30

d)

40

25.

According to the greeting example, if a user types Aman at the prompt, which line will the program print next?

a)

Welcome, user

b)

Welcome Aman

c)

Hello Aman!

d)

User: Aman

26.

Which step is NOT part of the basic process for writing a Python script as outlined?

a)

Open an editor or IDE

b)

Write Python code

c)

Save the file with a .py extension

d)

Compile to bytecode manually before running

27.

Which statement captures the purpose of Python syntax as introduced?

a)

It determines only how variables are stored in memory

b)

It is the set of rules we must follow when writing Python code, like grammar in English

c)

It is a special library for printing text

d)

It is an operating system feature for running scripts

28.

Which statement best describes Python keywords?

a)

They are user-defined names for data storage.

b)

They are special reserved words with a fixed meaning.

c)

They are optional labels used only for comments.

d)

They are symbols used only in arithmetic operations.

29.

Which of the following CANNOT be used as a variable name in Python?

a)

data1

b)

_result

c)

for

d)

totalSum

30.

Given the example using if and else, what output is produced when x = 10?

a)

x is smaller

b)

x is greater than 5

c)

10

d)

True

31.

In the variables example, which data type best matches the value assigned to pi?

a)

Integer

b)

String

c)

Float

d)

Boolean

32.

Which rule about variable names is explicitly stated?

a)

They must include at least one number.

b)

They must start with a letter or underscore.

c)

They must be written in uppercase.

d)

They must end with a digit.

33.

Which pair shows valid variable names according to the rules provided?

a)

1name and age1

b)

valid_name and _name

c)

for and else

d)

Name and name (treated as the same)

34.

A student writes Name = "Aman" and later prints name. Based on case sensitivity, what will most likely happen?

a)

It will print Aman because Python ignores case in variable names.

b)

It will raise an error because Name and name are different identifiers.

c)

It will print an empty line.

d)

It will automatically convert Name to name.

35.

You want to store a person's age without declaring a type first. According to the material, what is the correct approach in Python?

a)

Declare the type int age; before assigning.

b)

Use age = 17; Python decides the type automatically.

c)

Use var age = 17 to signal dynamic typing.

d)

You cannot store numbers without manual type declaration.

36.

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?

a)

Positive number on one line, then This line is outside the if on the next line

b)

Only Positive number prints

c)

Only This line is outside the if prints

d)

A syntax error occurs due to indentation

37.

In Python, what will the following code print? name = "Aman"; if name == "Aman": (indent) print("Hello Aman"); else: (indent) print("Who are you?")

a)

Hello Aman

b)

Who are you?

c)

A NameError for variable name

d)

Nothing prints

38.

Given Age = 15 and age = 20 followed by print(Age) and print(age), what is printed?

a)

15 then 20

b)

20 then 15

c)

35 on one line

d)

A SyntaxError due to variable case

39.

Why is the identifier 1st_number invalid in Python?

a)

It contains an underscore

b)

It starts with a digit

c)

It is too long

d)

It uses a reserved keyword

40.

Given x = 10, y = 3.14, z = "Hello"; what is the printed output of print(x, y, z)?

a)

10 3.14 Hello

b)

"10" "3.14" "Hello"

c)

10, 3.14, Hello on separate lines

d)

A TypeError when printing mixed types

41.

Consider marks = 50; marks = marks + 10; print("Updated marks:", marks). What is the result?

a)

Updated marks: 60

b)

Updated marks: 50

c)

Updated marks: 10

d)

A SyntaxError due to reassignment

42.

Which assignment correctly stores three different values into a, b, c in one statement?

a)

a, b, c = 10, 20, 30

b)

a = b = c = 10, 20, 30

c)

a, b, c == 10, 20, 30

d)

(a, b, c) <- 10 20 30

43.

What will print(x, y, z) output after executing x = y = z = 100?

a)

100 100 100

b)

100 200 300

c)

0 0 0

d)

It raises an assignment error

44.

Given is_student = True and is_teacher = False, what is printed by print(is_student); print(is_teacher)?

a)

True then False

b)

False then True

c)

1 then 0

d)

It prints nothing

45.

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?

a)

for = 20

b)

count1 = 0

c)

1st_value = 0

d)

If = 1

46.

In Python, what is the correct way to print the contents of a variable named name?

a)

print(name)

b)

print('name')

c)

echo(name)

d)

printf(name)

47.

You have two variables age and city. Which statement correctly prints them together separated by a space?

a)

print(age + city)

b)

print(age, city)

c)

print('age', 'city')

d)

print(age city)

48.

Which statement assigns the value 100 to variables a, b, and c in a single line?

a)

a, b, c = 100

b)

a = b = c = 100

c)

a = 100; b, c = 100

d)

a == b == c == 100

49.

Given marks is an integer, which code correctly prints Pass if marks is greater than 40, otherwise prints Fail?

a)

if marks > 40: print('Pass') else print('Fail')

b)

if marks > 40: print('Pass') else: print('Fail')

c)

print('Pass') if marks > 40 else print('Fail')

d)

if (marks > 40) then print('Pass') else print('Fail')

50.

Which example best demonstrates that Python variable names are case-sensitive?

a)

Age = 20; age = 25; print(Age, age)

b)

age = 20; AGE = age; print(AGE)

c)

age = Age = 30; print(age)

d)

age == Age

51.

What happens if you try to create a variable named class in Python 3?

a)

It works like any normal variable.

b)

It creates a new class automatically.

c)

It raises a SyntaxError because class is a keyword.

d)

It shadows the built-in type and gives a warning only.

52.

Which assignment stores your height as a floating-point number in variable height?

a)

height = '1.75'

b)

height = 1.75

c)

float height = 1.75

d)

height := float(1.75)

53.

Variable score currently equals 20. Which statement updates it by adding 15 and then prints the new value?

a)

score =+ 15; print(score)

b)

score += 15; print(score)

c)

score = score + '15'; print(score)

d)

print(score + 15); score = score

54.

Which line correctly assigns values 10, 20, and 30 to variables a, b, and c respectively and then prints them?

a)

a = 10, b = 20, c = 30; print(a b c)

b)

a, b, c = 10, 20, 30; print(a, b, c)

c)

a b c = 10 20 30; print(a, b, c)

d)

(a, b, c) == (10, 20, 30); print(a, b, c)

55.

Which code prints Even if number is divisible by 2; otherwise prints Odd?

a)

if number % 2 = 0: print('Even') else: print('Odd')

b)

if number % 2 == 0: print('Even') else: print('Odd')

c)

print('Even') if number % 2 == 0 else print('Odd')

d)

if (number / 2): print('Even') else: print('Odd')

56.

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?

a)

8

b)

15

c)

53

d)

30

57.

Given radius = 7 and pi = 3.14, a program calculates area = pi * radius * radius. Which output is correct?

a)

21.98

b)

43.96

c)

153.86

d)

314.00

58.

A cube volume is computed with side = 4 using volume = side ** 3. What is the printed volume?

a)

12

b)

16

c)

32

d)

64

59.

A program uses radius = 3, height = 10, pi = 3.14 and computes volume = pi * radius * radius * height. Which value matches the output?

a)

94.2

b)

282.6

c)

565.2

d)

188.4

60.

Consider the snippet: num = -5; if num > 0: print("Positive") elif num < 0: print("Negative") else: print("Zero"). What is printed?

a)

Positive

b)

Negative

c)

Zero

d)

Error

61.

In a voting check, age = 16; if age >= 18: print("Eligible to vote") else: print("Not eligible"). What is the output?

a)

Eligible to vote

b)

Not eligible

c)

Error due to comparison

d)

Eligible with consent

62.

Given a = 25 and b = 40, the code if a > b: print("Largest:", a) else: print("Largest:", b) executes. What is printed?

a)

Largest: 25

b)

Largest: 40

c)

Largest: 65

d)

No output

63.

A pass/fail program checks marks = 35 with if marks >= 40: print("Pass") else: print("Fail"). What will be printed?

a)

Pass

b)

Fail

c)

Error

d)

Retest

64.

The code checks num = 11 with if num % 2 == 0: print("Even") else: print("Odd"). Which result appears?

a)

Even

b)

Odd

c)

Zero

d)

Undefined

65.

Given the code: name = "Aman"; age = 20; print("Hello", name, ", you are", age, "years old."). What is printed?

a)

Hello Aman , you are 20 years old.

b)

Hello Aman you are 20 years old

c)

Hello, Aman you are 20 years old.

d)

Hello Aman, you are 20

66.

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?

a)

Greater than 20

b)

Less than 20

c)

Equal to 20

d)

TypeError

67.

For r = "10" converted using radius = float(r), with pi = 3.14 and area = pi * radius * radius, which value is printed for the area?

a)

31.4

b)

62.8

c)

314.0

d)

100.0

68.

Given a = 20 and b = 5, which expression and result pair is correct according to the sample arithmetic operations?

a)

a + b -> 15

b)

a - b -> 25

c)

a * b -> 100

d)

a / b -> 2.0

69.

Marks are m1 = 60, m2 = 70, m3 = 50. Using avg = (m1 + m2 + m3) / 3, what is avg?

a)

60.0

b)

56.0

c)

58.0

d)

70.0