Font size
WorksheetsPython Test 2
Total questions: 150
Worksheet time: 5hrs 0mins
(a) created the Python programming language.
Guido van Rossum
James Gosling
Dennis Ritchie
Bjarne Stroustrup
In which year was Python first released?
1989
1991
1995
2000
Explain why Python is considered a high-level programming language.
It is written in machine code.
It allows for easy readability and abstraction from machine language.
It is used for low-level hardware programming.
It is only used for web development.
Identify a key feature of Python that contributes to its popularity.
Complex syntax
Strong typing
Dynamic typing
Lack of libraries
Discuss the impact of Python's open-source nature on its development and community.
It limits the number of contributors.
It allows for a large community and rapid development.
It restricts the use of libraries.
It makes Python expensive to use.
Which of the following is a major version of Python that introduced significant changes?
Python 1.0
Python 2.0
Python 3.0
Python 4.0
Match the following descriptions with their significance in Python.
They are used to write Python code.
Python syntax and structure.
They are guidelines and standards for Python's development.
Python Enhancement Proposals (PEPs).
They are Python's error messages.
Python exceptions and tracebacks.
They are Python's built-in functions.
Python standard library utilities.
Analyze how Python's design philosophy emphasizes code readability.
By using complex syntax
By enforcing indentation and clear syntax
By allowing multiple ways to do the same thing
By using verbose error messages
Which of the following is a Python web framework?
Django
React
Angular
Laravel
What is the purpose of Python's Global Interpreter Lock (GIL)?
To speed up Python code execution
To allow multiple threads to execute simultaneously
To prevent multiple native threads from executing Python bytecodes at once
To enhance Python's memory management
Evaluate the role of Python in data science and machine learning.
It is rarely used due to its slow execution speed.
It is a primary language due to its extensive libraries and ease of use.
It is only used for web development.
It is not suitable for data analysis.
Which of the following is a popular Python library for data analysis?
NumPy
jQuery
Bootstrap
Flask
How does Python's interpreted nature affect its performance compared to compiled languages?
It makes Python faster than compiled languages.
It allows Python to run without a compiler, but generally slower.
It requires Python code to be compiled before execution.
It has no effect on performance.
Discuss the advantages and disadvantages of Python's dynamic typing.
It makes code execution faster but harder to read.
It allows flexibility but can lead to runtime errors.
It enforces strict type checking at compile time.
It makes Python unsuitable for web development.
Match the following package managers with their respective programming languages.
npm
JavaScript
pip
Python
gem
Ruby
composer
PHP
Around 3000 BC, the most primitive form of computation was done on a(n):
abacus
adding machine
mechanical computer
none of the above
How many generations of computer history are there?
3
4
5
6
This machine was built as a partnership between IBM and Harvard.
Harvard Mark 1
Zuse Z3
Babbage's Analytic Engine
TRADIC
Many early computers were big enough to fill a whole room and weighed thousands of pounds.
TRUE
FALSE
Who was known for building the first programmable mechanical computer in the year 1820?
Charles Darwin
Charles Babbage
Blaise Pascal
Herman Hollerith
Grace Hopper gave this name to fixing errors in computer code?
Stooking
Blogging
Fixometrics
Debugging
Most early computers where used
for social media
for online shopping
for military and scientific calculations
for video streaming
This machine was the first mechanical calculator. It was made with a series of gears and wheels
Abacus
Pascaline
ENIAC
Analytical Engine
This device improved on Pascal's invention by using fluted drums instead of gears
Leibniz's Stepped Reckoner
Babbage's Analytical Engine
Hollerith's Tabulating Machine
Turing's Bombe
The First Generation computers used
Transistors
Integrated Circuits
Vacuum Tubes
Microprocessors
First Generation computers were
slow, huge, and expensive
slow, small, inexpensive
Based on Integrated Circuits
Based on Microprocessors
What were used in Second Generation computers?
Vacuum Tubes
Transistors
Integrated Circuits
Microprocessors
In Second Generation computers, which programming language were used?
Java
Python
Assembly Language (COBOL and FORTRAN)
C++
What were used in Third Generation computers?
Vacuum Tubes
Transistors
Integrated Circuits
Mechanical parts
Due to the increase of power and reduction of size, Third Generation computers
became less expensive
were slower than First Generation
were more expensive
never worked
Fourth Generation computers used
Vacuum Tubes
Transistors
Abacus
VLSI (Very Large Scale Integrated) circuits
Fourth Generation computers used what type of programming languages?
Assembly language
Machine language
C and C++
Punch cards
Fifth Generation computers use
Vacuum Tubes
Transistors
Punch cards
ULSI (Ultra Large Scale Integration)
Fifth Generation computers also use
Artificial Intelligence software
Vacuum Tubes
Transistors
Integrated Circuits
Why was Alan Turing important to computer science?
He invented the internet
He was a famous video game designer
He was a pioneer in artificial intelligence
He is considered the father of modern computing and artificial intelligence, and during World War II, he developed a machine that helped break the German Enigma code
Who is often regarded as the "Father of the Computer" for his work on the concept of a programmable machine in the early 19th century?
Thomas Edison
Charles Babbage
Steve Jobs
Alan Turing
In which decade did the first electronic digital computer, known as the ENIAC, become operational?
1920s
1930s
1940s
1950s
What is the name of the programming language developed in the 1950s and considered one of the earliest high-level languages used for scientific and engineering applications?
FORTRAN
COBOL
BASIC
Pascal
Which company introduced the Apple I, one of the first successful personal computers, in the mid-1970s?
IBM
Apple Inc.
Microsoft
Commodore
What significant development in the 1980s revolutionized personal computing by providing a user-friendly interface?
The Internet
The graphical user interface (GUI)
The microprocessor
Artificial intelligence
Which event came first?
First cell phones available for sale
World Wide Web invented
Google is formed
Which event came first?
First e-mail is sent
Apple is founded
Mobile phone invented
Which event came first?
Personal computer created
Microsoft is founded
Mobile phone invented
Which event came first?
PayPal is created
YouTube is created
Virtual Reality available to public
Which event happened first?
Charles Babbage plans a calculating machine
Alexander Graham Bell invents the telephone
Samuel Morse invents the telegraph
Which event happened first?
First cell phones are available for sale
The personal computer is created
Marty Cooper invents the mobile phone
Which event happened first?
Google is formed
Microsoft is founded
Tim Berners-Lee invents the World Wide Web
Apple creates the first computer with a GUI
Which event happened first?
The first web browser program is created
First e-mail messages are sent
PayPal is created
IBM releases the IBM personal computer
The first computer was the
abacus.
Macintosh.
IBM.
Difference Engine.
The abacus was made of
beads.
bones.
sticks.
(a) is known as the father of modern computers.
Herman Hollerith invented the _____.
punched card system
integrated circuit
transistor
vacuum tube
Match the following computers with their generation.
2nd
IBM 7090
3rd
IBM System/360
1st
ENIAC
4th
Apple Macintosh
Pascal's computer concept is still used today in _____ (Choose 3)
odometers
water meters
speedometers
integrated circuits
transistors
Match the major development with its corresponding generation.
1st generation
vacuum tubes
2nd generation
transistors
3rd generation
integrated circuit
4th generation
microchip
5th generation
AI
True of False? Gottfried Leibniz's computer could only add.
true
false
What is finding and fixing errors in programs?
Debugging
Program
Bug
Code
What is an error in a program that prevents the program from running as expected?
Algorithm
Program
Bug
Code
Match the following descriptions with their definitions.
Rules of conduct.
Code of ethics.
A pack between friends.
Friendship agreement.
One or more commands designed to be carried out by a computer.
Computer programming instructions.
Edoc spelled backwards.
Reverse of 'code'.
What do we call the person who writes the instructions for the computer to complete a task?
architect
programmer
Bob
composer
What is the primary purpose of a for loop in Python as described in the text?
To execute a block of code a limited number of times based on a condition
To generate random numbers
To define functions
To import libraries
Which Python function is used to generate a sequence of numbers in the provided example?
list()
dict()
range()
set()
According to the example, what does the expression 'num ** 2' in the for loop calculate?
The square root of num
The cube of num
The square of num
The logarithm of num
What is the purpose of using the ** operator in the provided Python code snippet?
To perform addition
To perform subtraction
To calculate the square of a number
To divide one number by another
What will be the output of the code when num is 5?
The square of 5 is 25
The square of 5 is 5
The square of 5 is 10
The square of 5 is 30
Which Python function is used to generate a sequence of numbers in the code?
list()
dict()
range()
str()
What is the primary benefit of using loops in programming, as described in the text?
To make the code shorter and more readable
To perform calculations faster
To automate repetitive tasks and process collections of data
To reduce the number of variables needed
What will the program print if the player's choice is "Rock" and the computer's choice is "Scissors"?
It's a tie!
You win! Rock beats Scissors
Computer wins!
You win! Paper beats Rock
What is the correct way to generate a random choice for the computer in this Python program?
computer_choice = random.choice([0,1,2])
computer_choice = random.select("Rock", "Paper", "Scissors")
computer_choice = choose(["Rock", "Paper", "Scissors"])
computer_choice = random.randint(0, 2)
If both the player and the computer choose "Paper", what will the output of the program be?
You win! Paper beats Rock
Computer wins!
It's a tie!
You win! Rock beats Scissors
Loop that runs till the condition is true
list
while
for
if
The (a) function assigns a random (b) to a (c) . You can pick the (d) of numbers which the program can (e) from.
What will be the output of the following Python code snippet?
print(8 ** 2)
64
16
8
None of the above
What does the expression 'num ** 3' calculate in Python?
The square of num
The cube of num
The square root of num
The triple of num
If the player chooses 'Scissors' and the computer chooses 'Paper', what will the output of the game be?
It's a tie!
You win! Scissors beat Paper
Computer wins!
You win! Paper beats Rock
The transistor replaced the __________?
Analytical Engine
Microchip
Vacuum Tube
Solid State Memory
What is flow control?
Reacting to the results of a computation
Method for getting rid of bad input data
Used to make vacuum tubes
Guidance system for the Apollo program
What was the earliest programming language?
Python
BASIC
Assembly
Machine Code
An algorithm is:
One packet of data sent from one part of the computer to another
A series of fixed steps used to complete a specific process
The way punch cards were punched
The core processor for the first personal computer
Who was the first computer programmer?
Charles Babbage
Herman Hollerith
Balise Pascal
Ada Lovelace
Newer generations of programming language tend to be:
More readable by humans
Less readable by humans
Easier for computers to run
More expensive
WYSIWYG changed text documents by:
Making the display view the same as the printed version
Making the person writing the document insert markup tags.
Requiring the MLA format
Making different font sizes available
The 4 steps of computing are:
science, technology, engineering, math
input, process, output, store
state hypothesis, collect data, test, and conclude
prophase, metaphase, anaphase, telophase
Identify this computer component:
Transistor
Integrated Circuit (IC)
Microprocessor
Vacuum Tube
What replaced transistors in the 1960's
UNIVAC
Cobol
Integrated Circuts
ENIAC
What was the idea that computing power would double every two years?
Maxwell's Law
Planck's Constant
Rule of Two
Moore's Law
What was the biggest difference between Arpanet and the World Wide Web?
HTML
HTTPS
FTP
TCP/IP
This addition to computers allowed users to click on pictures to execute commands
ALU
CPU
GUI
PCI
What are some advantages of digital signals over analog signals. (Select all that apply)
More likely to be affected by small disturbances
Less likely to be affected by small disturbances
Easier to design circuits when using only two states
Harder to design circuits when using only two states
"Black-boxed" is a term for
Anytime the decision making process is hidden
Rush shipping from Amazon
Putting carbon fibers around electronics to prevent data loss
The power source for a computer
What were the three components in John von Neumann's architecture?
Input/Output
CPU
Graphics
Memory
Around 3000 BC, the most primitive form of computation was done on a(n):
abacus
adding machine
mechanical computer
none of the above
How many generations of computer history are there?
3
4
5
6
This machine was built as a partnership between IBM and Harvard.
Harvard Mark 1
Zuse Z3
Babbage's Analytic Engine
TRADIC
Many early computers were big enough to fill a whole room and weighed thousands of pounds.
TRUE
FALSE
Who was known for building the first programmable mechanical computer in the year 1820?
Charles Darwin
Charles Babbage
Blaise Pascal
Herman Hollerith
Grace Hopper gave this name to fixing errors in computer code?
Stooking
Blogging
Fixometrics
Debugging
Most early computers where used
This machine was the first mechanical calculator. It was made with a series of gears and wheels
Pascaline
This device improved on Pascal's invention by using fluted drums instead of gears
The First Generation computers used
First Generation computers were
slow, huge, and expensive
slow, small, inexpensive
What were used in Second Generation computers?
In Second Generation computers, which programming language were used?
Assembly Language (COBOL and FORTRAN)
What were used in Third Generation computers?
Quiz: What is a string?
A variable that stores multiple values.
A variable that stores 1 value.
A function that outputs words/numbers.
A function that asks user input.
How do you create words in Python?
Using the if then function
Using a variable
Using the import function
Using the print function
Quiz: What is a variable?
A function that inputs a module.
A variable that stores 1 value.
A function that outputs words/numbers.
A function that asks user input.
Why was Python (TM) developed?
To go back to the old way of programming
To create a programming language for students in grade school
To make it easier to learn Java
Python was developed by accident
Python (TM) is owned and managed by
Microsoft (c)
Sun Microsystems (c)
Python (TM) is open source and free to use
Google (c)
Python is ___________ level programming language and is ___________.
High, compiled
High, interpreted
Low, compiled
Low, interpreted
Generally speaking, a low level programming language is easier to read, write and maintain over a high level programming language
True
False
The syntax in Python (TM) is one of the main advantages over other high level programming languages.
True
False
A statement in programming
Expresses an action to be carried out
Always returns results like expressions
Rules controlling how components in a program are combined
An instruction to perform a task, usually one word
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
A block is
a statement including elements of a command
the structure and form of the code
source code that is grouped together
meaning assigned to symbols, characters and words
What symbol comes before a comment?
$
>>
#
!
An exception is
the structure of form of the code
the meaning of the characters and words in the code
the statement that is missing from the instructions
an event occurring during execution of a program which disrupts the flow of the program's instructions
Debugging is
how characters are arranged in a statement
detecting or removing errors from a program
removing viruses from a computer
the meaning of each of the characters and symbols in the program
A disadvantage of Python is it is harder to debug than other higher level programming languages.
True
False
In programming, a (n) _______________ is a value that can change, depending on conditions or on information passed to the program
string
block
instruction
variable
Generally speaking Python (TM) would run _____________ than C++ and take ____________ time to create
faster, less
faster, more
slower, less
slower, more
Why was Python (TM) developed?
To go back to the old way of programming
To create a programming language for students in grade school
To make it easier to learn Java
Python was developed by accident
Python (TM) is owned and managed by
Microsoft (c)
Sun Microsystems (c)
Python (TM) is open source and free to use
Google (c)
Python is ___________ level programming language and is ___________.
High, compiled
High, interpreted
Low, compiled
Low, interpreted
Generally speaking, a low level programming language is easier to read, write and maintain over a high level programming language
True
False
The syntax in Python (TM) is one of the main advantages over other high level programming languages.
True
False
A statement in programming
Expresses an action to be carried out
Always returns results like expressions
Rules controlling how components in a program are combined
An instruction to perform a task, usually one word
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
A block is
a statement including elements of a command
the structure and form of the code
source code that is grouped together
meaning assigned to symbols, characters and words
What symbol comes before a comment?
$
>>
#
!
An exception is
the structure of form of the code
the meaning of the characters and words in the code
the statement that is missing from the instructions
an event occurring during execution of a program which disrupts the flow of the program's instructions
Debugging is
how characters are arranged in a statement
detecting or removing errors from a program
removing viruses from a computer
the meaning of each of the characters and symbols in the program
A disadvantage of Python is it is harder to debug than other higher level programming languages.
True
False
In programming, a (n) _______________ is a value that can change, depending on conditions or on information passed to the program
string
block
instruction
variable
Generally speaking Python (TM) would run _____________ than C++ and take ____________ time to create
faster, less
faster, more
slower, less
slower, more
Since Python (TM) is open source,
Support for using Python (TM) is easy to find
It is free
There is a large catalog of supporting documents
it is a less powerful programming languange
How would you call a function named “my_function”?
Call my_function()
my_function
my_function))
my_function()
You are not able to call the same function twice in a row.
True
False
The parentheses at the end of a function call are optional.
True
False
A programming language that is widely used in web development, game development, and scientific research. It is known for being highly readable and uncluttered, using whitespace indentation instead of curly braces or keywords.
(a)
The set of rules that govern how a language is structured.
(a)
An instruction that you give the computer.
(a)
Match the following
Turtle Graphics:
uses a "turtle"
Turtle Screen:
window where you will draw
Turtle Object:
object that will do all of the drawing
Coordinate System:
turtle screen coordinate system
Creating A Turtle Object
You can create a new turtle using the (a) . In the code below, we (b) , then define its shape to be a "square".
When you run this code, you'll see a square appear in the middle of the screen.
Now the turtle is ready to receive (c)
The turtle Screen
We want to (a) on which to draw, something like a blank sheet of paper. The turtle's screen is the (b) where you'll be able to draw using turtles. You can draw on it, display images, and change its color. But in order to use the screen, you must first define it using the (c) function.
