Chapter 1, Introduction to Computers and Python 1
Introduction to Computers and
Python
1.1 Introduction
1.1 Q1: Which of the following statements is false?
a. Software (that is, the Python instructions you write, which are also called code)
controls hardware (that is, computers and related devices).
b. Programmers use the Python Standard Library and various other libraries to
“reinvent the wheel.”
c. Programmers use libraries to create software objects that they interact with to
perform significant tasks with modest numbers of instructions.
d. IPython executes Python instructions interactively and immediately shows
their results.
1.1 Q2: Which of the following statements a), b) or c) is false?
a. Decades ago, most computer applications ran on networked computers.
b. Today’s applications can be written with the aim of communicating among the
world’s computers via the Internet.
c. A key intersection between computer science and data science is artificial in-
telligence.
d. All of the above statements are true.
1.2 Hardware and Software
1.2 Q1: Which of the following statements is false?
a. Computers can perform calculations and make logical decisions phenomenally
faster than human beings can.
b. Computers process data under the control of sequences of instructions called
computer programs (or simply programs).
c. A computer consists of various physical devices referred to as hardware (such
as the keyboard, screen, mouse, solid-state disks, hard disks, memory,
d. Computing costs are rising dramatically, due to the increasing complexity of
hardware and software technologies.
2 Chapter 1, Introduction to Computers and Python
© Copyright 2020 by Pearson Education, Inc. All Rights Reserved.
Answer: d. Actually, computing costs are dropping dramatically, due to
rapid developments in hardware and software technologies.
1.2.1 Moore’s Law
1.2 Q2: Every year or two, the capacities of computers have approximately dou-
bled inexpensively. This remarkable trend often is called ________.
a. the law of large numbers
b. the principal of least privilege
c. Moore’s law
d. Wirth’s law
1.2.2 Computer Organization
1.2 Q3: Which logical unit of the computer is the receiving section?
a. input unit
b. output unit
c. memory unit
d. central processing unit.
1.2 Q4: Information in the memory unit is ________. It’s typically lost when the
computer’s power is turned off.
a. persistent
b. constant
c. sticky
d. volatile
1.2 Q5: A gigabyte is approximately one ________ bytes.
a. thousand
b. million
c. billion
d. trillion.
1.2 Q6: Information on secondary storage devices is ________ — it’s preserved
even when the computer’s power is turned off.
a. volatile
Chapter 1, Introduction to Computers and Python 3
b. unstable
c. transient
d. persistent
1.2 Q7: Secondary storage information takes much ________ to access than infor-
mation in primary memory, but its cost per unit is much ________.
a. less time, less
b. more time, less
c. less time, more
d. more time, more
1.3 Data Hierarchy
1.3 Q1: A(n) ________ is the smallest data item in a computer. It can have the value
0 or 1.
a. bit
b. byte
c. field
d. record
1.3 Q2: The most popular database model is the ________ database, in which data
is stored in simple tables.
a. network
b. graph
c. relational
d. hierarchical
1.3 Q3: Which one of the following statements is true?
a. a terabyte is larger than a petabyte.
b. a kilobyte is exactly 1000 bytes.
c. a gigabyte is 1024 megabytes.
d. an exabyte is 1024 zettabytes.
4 Chapter 1, Introduction to Computers and Python
1.4 Machine Languages, Assembly Languages and High–
Level Languages
1.4 Q1: Which of the following statements is false?
a. Any computer can directly understand only its own machine language, defined
by its hardware design.
b. The most widely used Python implementation—CPython (which is written in
the C programming language for performance)—uses a clever mixture of compi-
lation and interpretation to run programs.
c. Translator programs called assemblers convert assembly-language programs
to machine language at computer speeds.
d. Interpreter programs, developed to execute high-level language programs di-
rectly, avoid the delay of compilation, and run faster than compiled programs.
1.4 Q2: Which of the following statements is false?
a. With the advent of assembly languages, computer usage increased rapidly, but
programmers still had to use numerous instructions to accomplish even the sim-
plest tasks.
b. To speed the programming process, high-level languages were developed in
which single statements could be written to accomplish substantial tasks.
c. Translator programs called assemblers convert high-level-language source
code into machine language.
d. High-level languages instructions look almost like every-day English and con-
tain commonly used mathematical notations.
1.5 Introduction to Object Technology
1.5 Q1: Which of the following statements a), b) or c) is false?
a. The classes that objects come from are essentially reusable software compo-
nents.
b. Almost any verb can be reasonably represented as a software object in terms
of attributes (e.g., name, color and size) and behaviors (e.g., calculating, moving
and communicating).
c. A class that represents a bank account might contain one method to deposit
money to an account, another to withdraw money from an account and a third to
inquire what the account’s balance is.
d. All of the above statements are true.
Chapter 1, Introduction to Computers and Python 5
© Copyright 2020 by Pearson Education, Inc. All Rights Reserved.
Answer: b. Actually, almost any noun can be reasonably represented as a
software object in terms of attributes (e.g., name, color and size) and behav-
iors (e.g., calculating, moving and communicating).
1.5 Q2: A program might call a bank–account object’s deposit ________ to increase
the account’s balance.
a. attribute
b. method
c. class
d. function
1.5 Q3: A new class of objects can be created conveniently by inheritance—the
new class (called the ________) starts with the characteristics of an existing class
(called the ________), possibly customizing them and adding unique characteristics
of its own.
a. superclass, subclass
b. hyperclass, subclass
c. target, superclass
d. subclass, superclass
1.6 Operating Systems
1.6 Q1: Windows is a(n) ________ operating system—it’s controlled by Microsoft
exclusively.
a. proprietary
b. private
c. open source
d. None of the above.
1.6 Q2: ________ is by far the world’s most widely used desktop operating system.
a. Linux
b. MacOS
c. Windows
d. none of the above
Chapter 1, Introduction to Computers and Python 7
a. Using existing libraries helps you avoid “reinventing the wheel,” thus leverag-
ing your program-development efforts.
b. Rather than developing lots of original code—a costly and time-consuming pro-
cess—you can simply create an object of a pre-existing library class, which takes
only three Python statements.
c. Libraries help you perform significant tasks with modest amounts of code.
d. All of the above statements are false.
1.8.1 Python Standard Library
1.8 Q2: Which of the following Python Standard Library modules offers addi-
tional data structures beyond lists, tuples, dictionaries and sets?
a. sys and statistics
b. collections
c. queue
d. (b) and (c)
1.8 Q3: Which Python Standard Library module do we use for performance anal-
ysis?
a. datetime
b. time
c. timeit
d. sys
1.8.2 Data-Science Libraries
1.8 Q4: Which of the following popular Python data science libraries are central
to machine learning, deep learning and/or reinforcement learning:
a. scikit-learn
b. keras and tensorflow
c. OpenAIGym
d. All of the above
1.9 Other Popular Programming Languages
1.9 Q1: The popular programming languages Python and ________ are the two most
widely used data-science languages.
8 Chapter 1, Introduction to Computers and Python
a. C
b. Java
c. JavaScript
d. R
1.10 Test-Drive: Using IPython and Jupyter Notebooks
1.10 Q1: In which IPython interpreter mode do you enter small bits of Python
code called snippets and immediately see their results?
a. interactive mode
b. script mode
c. program mode
d. None of the above
1.10.1 Using IPython Interactive Mode as a Calculator
1.10 Q2: What value is produced when Python evaluates the following expres-
sion?
5 * (12.7 – 4) / 2
a. 21
b. 21.75
c. 29.5
d. None of the above.
1.10.2 Executing a Python Program Using the IPython Interpreter
No questions.
1.10.3 Writing and Executing Code in a Jupyter Notebook
1.10 Q4: Which of the following statements a), b) or c) is false?
a. The Anaconda Python Distribution comes with the Jupyter Notebook—an in-
teractive, browser-based environment in which you can write and execute code
and intermix the code with text, images and video.
b. The JupyterLab interface enables you to manage your notebook files and other
files that your notebooks use (like images and videos).
c. Jupyter Notebooks use IPython by default.
Chapter 1, Introduction to Computers and Python 9
d. All of the above statements are true.
1.10 Q5: Which of the following statements a), b) or c) about the Jupyter Note-
book is false?
a. The unit of work in a notebook is a cell in which you can enter code snippets.
b. By default, a new notebook contains one cell, but you can add more.
c. To execute the current cell’s code, type Ctrl + Enter (or control + Enter).
JupyterLab executes the code in IPython, then displays the results below the cell.
d. All of the above statements are true.
1.11 Internet and World Wide Web
1.11 Q1: Which of the following statements about the ARPANET and the Internet
is false?
a. The ARPANET was the precursor to today’s Internet.
b. Today’s fastest Internet speeds are on the order of millions of bits per second
with billion-bits-per-second (gigabit) speeds already being tested.
c. Although the ARPANET enabled researchers to network their computers, its
main benefit proved to be the capability for quick and easy communication via
what came to be known as electronic mail (e-mail).
d. The protocol (set of rules) for communicating over the ARPANET became
known as the Transmission Control Protocol (TCP). TCP ensured that messages,
consisting of sequentially numbered pieces called packets, were properly deliv-
ered from sender to receiver, arrived intact and were assembled in the correct
order.
1.11.1 Internet: A Network of Networks
1.11 Q2: Which of the following statements about the Internet is false?
a. One challenge was to enable different networks to communicate with each
other. ARPA accomplished this by developing the Internet Protocol (IP), which
created a true “network of networks,” the current architecture of the Internet.
b. The combined set of Internet protocols is now called TCP/IP.
c. Each Internet-connected device has a TCP address—a unique numerical iden–
tifier used by devices communicating via TCP/IP to locate one another on the In–
ternet.
10 Chapter 1, Introduction to Computers and Python
d. Bandwidth—the information-carrying capacity of communications lines—on
the Internet has increased tremendously, while hardware costs have plummeted.
1.11.2 World Wide Web: Making the Internet User-Friendly
1.11 Q3: Which of the following statements is false?
a. The World Wide Web is a collection of hardware and software associated with
the Internet that allows computer users to locate and view documents (with var-
ious combinations of text, graphics, animations, audios and videos) on almost any
subject.
b. In 1989, Tim Berners-Lee of CERN (the European Organization for Nuclear Re-
search) began developing HyperText Markup Language (HTML)—the technology
for sharing information via “hyperlinked” text documents.
c. Berners-Lee also wrote communication protocols such as JavaScript Object No-
tation (JSON) to form the backbone of his new hypertext information system,
which he referred to as the World Wide Web.
d. In 1994, Berners-Lee founded the World Wide Web Consortium (W3C), de-
voted to developing web technologies.
1.11.3 The Cloud
1.11 Q4: Which of the following statements about the cloud is false?
a. A service that provides access to itself over the Internet is known as a web ser-
vice.
b. Using cloud-based services in Python often is as simple as creating a software
object and interacting with it. That object then uses web services that connect to
the cloud on your behalf.
c. We’ll use Twitter’s web services via the Python library Tweepy to get infor-
mation about specific Twitter users, search for recent tweets and receive streams
of tweets as they occur—that is, in real time.
d. Azure is Google’s set of cloud-based services.
12 Chapter 1, Introduction to Computers and Python
a. For computer scientists and data scientists, data is now as important as writing
programs.
b. One megabyte is exactly one million (1,000,000) bytes.
c. According to a March 2016 AnalyticsWeek article, within five years there will
be over 50 billion devices connected to the Internet (most of them through the
Internet of Things, ) and by 2020 we’ll be producing 1.7 megabytes of new data
every second for every person on the planet.
d. The speed at which quantum computers now under development could oper-
ate at is so extraordinary that in one second, a quantum computer theoretically
could do staggeringly more calculations than the total that have been done by all
computers since the world’s first computer appeared.
1.13 Q2: Which of the following statements about energy consumption is false?
a. According to a recent article, energy use for processing data in 2015 was grow-
ing at 20% per year and consuming approximately three to five percent of the
world’s power.
b. Another enormous electricity consumer is the blockchain-based cryptocur-
rency Bitcoin—processing just one Bitcoin transaction uses approximately the
same amount of energy as powering the average American home for a year.
c. The energy use comes from the process Bitcoin “miners” use to prove that
transaction data is valid.
d. Together, Bitcoin and Ethereum (another popular blockchain-based platform
and cryptocurrency) consume more energy per year than Israel and almost as
much as Greece.
1.13.1 Big Data Analytics
1.13 Q3: Which of the following “V’s of big data” is described by “the validity of
the data—is it complete and accurate? Can we trust that data when making cru-
cial decisions? Is it real?”
a. Volume
b. Velocity
c. Variety
d. Veracity
14 Chapter 1, Introduction to Computers and Python
a. For many decades, AI has been a field with solutions and no problems.
b. Google’s AlphaZero is a game-playing AI that teaches itself to play games.
c. In a 1997 match between IBM’s DeepBlue computer system and chess
Grandmaster Gary Kasparov, DeepBlue became the first computer to beat a reign-
ing world chess champion under tournament conditions.
d. After training itself in Go for just eight hours, AlphaZero was able to play Go vs.
its AlphaGo predecessor, winning 60 of 100 games.