Chapter 1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Central Processing Unit (CPU)

A

The “brain” of the computer is a single component that does the actual computing. The job of the CPU is to
execute programs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

program

A

is simply a list of unambiguous instructions meant to be followed mechanically by a computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

machine language

A

A computer is built to carry out instructions that are written in a very simple type of language called machine language. Each type of computer has its own machine language, and the computer can directly execute a program only if the program is expressed in
that language. (It can execute programs written in other languages if they are first translated
into machine language.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

main memory (also called the RAM or random access memory)

A

When the CPU executes a program, that program is stored in the computer’s main memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Main memory consists of a

sequence of _____.

A

locations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

These locations are numbered, and the sequence number of a location
is called its ______.

A

address

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

address

A

provides a way of picking out one particular piece of information from among the millions stored in memory. When the CPU needs to access the program
instruction or data in a particular location, it sends the address of that information as a signal to the memory; the memory responds by sending back the value contained in the specified location.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does the CPU execute a program?

A

The CPU executes a program that is stored as a
sequence of machine language instructions in main memory. It does this by repeatedly reading, or fetching, an instruction from memory and then carrying out, or executing, that instruction. This process—fetch an instruction, execute it, fetch another instruction, execute it, and so on forever—is called the fetch-and-execute cycle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

fetching

A

reading an instruction from memory, via the CPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

executing

A

carrying out an instruction that was fetched (read) from memory, via the CPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Arithmetic Logic Unit (ALU)

A

which is the part of the processor

that carries out operations such as addition and subtraction. It contains a small # of registers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

registers

A

which are small memory units capable of holding a single number. A typical CPU might have 16 or 32 “general purpose” registers, which hold data values that are immediately accessible for processing, and many machine language instructions refer to these registers. For example, there might be an instruction that takes two numbers from two specified registers,
adds those numbers (using the ALU), and stores the result back into a register. And there might be instructions for copying a data value from main memory into a register, or from a register into main memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

program counter (PC)

A

The CPU uses the PC to keep track of where it is in the program it is executing. The PC is a special purpose register for the CPU. The PC simply stores the memory address of the next instruction that the CPU should execute. At the beginning of each fetch-and-execute cycle, the CPU checks the PC to see which instruction it should fetch. During the course of the fetch-and-execute cycle, the number in the PC is updated to indicate the instruction that is to be executed in the next cycle. Usually, but not always, this is just the instruction that sequentially follows the current
instruction in the program. Some machine language instructions modify the value that is stored in the PC. This makes it possible for the computer to “jump” from one point in the program to another point, which is essential for implementing the program features known as loops and branches that are discussed in Section 1.4.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Significance of transistors

A

A computer is built with millions of tiny switches called transistors that are linked together in such a way as a computer computes, these switches turn each other on or off in a pattern determined both by the way they are wired together and by the program that the computer is executing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

binary number

A

A binary number is made up of just two possible digits, zero and one. Each zero or one is called a bit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

byte

A

The data that the computer manipulates is also encoded as binary numbers. In modern computers, each memory location holds a byte, which is a sequence of 8 bits.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

hard disk or solid state drive

A

used for storing programs and data files. (Note that main memory holds only a comparatively small amount of information, and holds it only as long as the power is turned on. A hard disk or solid state drive is used for permanent storage of larger amounts of information, but programs have to be loaded from there into
main memory before they can actually be executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How does a CPU communicate to other control devices (keyboards, mouses, scanners, printers, network interfaces) when all it can do is execute machine language instructions?

A

Through a device driver, which consists of software that the CPU executes when it has to deal with a device.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

How do computer systems connect devices (keyboards, mouses, etc.)?

A

through busses, which are sets of wires that carry data, address, and control signals. An address directs the data to a particular device and perhaps to a particular register or location within that device. Control signals can be used, for example, by one device to alert another that data is available for it on the data bus.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

polling

A

An inefficient method of the CPU to keep checking for incoming data, over and over again. Why would we do this? The CPU doesn’t know if data is waiting for it to process from other devices, so this method is a way for the CPU to check to see if a task is pending for it to process data. Interrupts are typically used over polling because they avoid this inefficiency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

interrupts

A

An interrupt is a signal sent by another device to the CPU. The CPU responds to an interrupt signal by
putting aside whatever it is doing in order to respond to the interrupt. Once it has handled the interrupt, it returns to what it was doing before the interrupt occurred. For example, when you press a key on your computer keyboard, a keyboard interrupt is sent to the CPU. The CPU responds to this signal by interrupting what it is doing, reading the key that you pressed,
processing it, and then returning to the task it was performing before you pressed the key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

interrupt handler

A

The CPU is built so that when that wire is turned on,
the CPU saves enough information about what it is currently doing so that it can return to the same state later. This information consists of the contents of important internal registers such as the program counter. Then the CPU jumps to some predetermined memory location and begins executing the instructions stored there. Those instructions make up an interrupt
handler that does the processing necessary to respond to the interrupt. (This interrupt handler
is part of the device driver software for the device that signaled the interrupt.) At the end of
the interrupt handler is an instruction that tells the CPU to jump back to what it was doing;
it does that by restoring its previously saved state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

asynchronous events

A

Events that happen at unpredictable times. Interrupts make it possible for CPU’s to deal with asynchronous events. As another example of how interrupts are used, consider what happens when the CPU needs
to access data that is stored on a hard disk. The CPU can access data directly only if it is
in main memory. Data on the disk has to be copied into memory before it can be accessed.
Unfortunately, on the scale of speed at which the CPU operates, the disk drive is extremely
slow. When the CPU needs data from the disk, it sends a signal to the disk drive telling it
to locate the data and get it ready. (This signal is sent synchronously, under the control of
a regular program.) Then, instead of just waiting the long and unpredictable amount of time
that the disk drive will take to do this, the CPU goes on with some other task. When the disk
drive has the data ready, it sends an interrupt signal to the CPU. The interrupt handler can
then read the requested data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

multitasking

A

Modern computers use this to perform several tasks at once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

timesharing

A

A form of multi-tasking, that involves the CPU switching its attention from one user to another , devoting a fraction of a second to each user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

thread

A

Each of the individual tasks that the CPU is working on is called a thread. (Or a process; there are technical differences between threads and processes, but they are not important here, since it is threads that are used in Java.) Many CPUs can literally execute more than one thread simultaneously—such CPUs contain multiple “cores,” each of which can run a thread— but there is always a limit on the number of threads that can be executed at the same time. Since there are often more threads than can be executed simultaneously, the computer has to be able switch its attention from one thread to another, just as a timesharing computer switches its attention from one user to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

yield

A

Some threads might voluntarily “yield” control, or give other threads a chance to run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

blocked

A

threads that have to wait for a asynchronous event to occur, which allows any other threads that need to run to occur. For example, the
thread might request some data from the disk drive, or it might wait for the user to press
a key. While it is waiting, the thread is said to be blocked, and other threads, if any, have
a chance to run. When the event occurs, an interrupt will “wake up” the thread so that
it can continue running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

operating systems

A

the software that does all the interrupt handling, handles communication with the user and with hardware devices, and controls which thread is allowed to run is called the operating system. The operating system is the basic, essential software without which
a computer would not be able to function. Other programs, such as word processors and Web browsers, are dependent upon the operating system. Common desktop operating systems include Linux, various versions of Windows, and Mac OS. Operating systems for smartphones and tablets include Android and iOS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

high-level programming

languages

A

such as Java, Python, or C++. A program written in a high-level language cannot be run directly on any computer. First, it has to be translated into machine language. This translation can be done by a program called a compiler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

compiler

A

A compiler takes a high-level-language
program and translates it into an executable machine-language program. Once the translation
is done, the machine-language program can be run any number of times, but of course it can only
be run on one type of computer (since each type of computer has its own individual machine
language). If the program is to run on another type of computer it has to be re-translated,
using a different compiler, into the appropriate machine language.

32
Q

What is an alternative to compiling a high-level language program?

A

using an interpreter

33
Q

Interpreter

A

Instead of using a compiler, which translates the program all at once, you can use an interpreter, which translates it instruction-by-instruction, as necessary. An interpreter is a program that acts much like a
CPU, with a kind of fetch-and-execute cycle. In order to execute a program, the interpreter runs in a loop in which it repeatedly reads one instruction from the program, decides what is necessary to carry out that instruction, and then performs the appropriate machine-language commands to do so. However,
interpreters have another purpose: They can let you use a machine-language program meant
for one type of computer on a completely different type of computer. For example, one of the
original home computers was the Commodore 64 or “C64”. While you might not find an actual
C64, you can find programs that run on other computers—or even in a web browser—that
“emulate” one. Such an emulator can run C64 programs by acting as an interpreter for the
C64 machine language.

34
Q

Does Java compile or interpret programs?

A

The designers of Java chose to use a combination of compiling and interpreting. Programs
written in Java are compiled into machine language, but it is a machine language for a computer
that doesn’t really exist. This so-called “virtual” computer is known as the Java Virtual Machine, or JVM

35
Q

Java Virtual Machine

A

Its the “virtual” computer that Java creates its interpreted/compiled code into. This is the main selling point of Java as a language, because the language can be used on any computer. All that computer requires is an interpreter for Java bytecode.

36
Q

Java bytecode

A

The machine language of the Java Virtual Machine

37
Q

Why, use the intermediate Java bytecode at all? Why not just distribute the original Java program and let each person compile it into the machine language of whatever computer they want to run it on?

A

First of all, a compiler has to
understand Java, a complex high-level language. The compiler is itself a complex program.
A Java bytecode interpreter, on the other hand, is a relatively small, simple program. This
makes it easy to write a bytecode interpreter for a new type of computer; once that is done,
that computer can run any compiled Java program. It would be much harder to write a Java
compiler for the same computer. Furthermore, some Java programs are meant to be downloaded over a network. This leads
to obvious security concerns: you don’t want to download and run a program that will damage
your computer or your files. The bytecode interpreter acts as a buffer between you and the
program you download. You are really running the interpreter, which runs the downloaded
program indirectly. The interpreter can protect you from potentially dangerous actions on the
part of that program

38
Q

just-in-time compilers

A

Used to overcome the slow program run-time used when compiling a Java program when it was initially designed. A just-in-time compiler
translates Java bytecode into native machine language. It does this while it is executing the
program. Just as for a normal interpreter, the input to a just-in-time compiler is a Java bytecode
program, and its task is to execute that program. But as it is executing the program, it also
translates parts of it into machine language. The translated parts of the program can then be
executed much more quickly than they could be interpreted. Since a given part of a program is
often executed many times as the program runs, a just-in-time compiler can significantly speed
up the overall execution time.

39
Q

two basic aspects of programming:

A

Data & Instructions

40
Q

What is required to work with data in Java?

A

you need to understand variables and types;

41
Q

What is required to work with instructions?

A

you need to understand control structures and subroutines.

42
Q

variable

A

e is just a memory location (or several consecutive locations treated as a unit)
that has been given a name so that it can be easily referred to and used in a program. The
programmer only has to worry about the name; it is the compiler’s responsibility to keep track
of the memory location. As a programmer, you just need to keep in mind that the name refers
to a kind of “box” in memory that can hold data, even though you don’t have to know where
in memory that box is located.

43
Q

type

A

An aspect of a variable that indicates
what sort of data it can hold.One type of variable might hold integers—whole numbers such as
3, -7, and 0—while another holds floating point numbers—numbers with decimal points such as
3.14, -2.7, or 17.0. (Yes, the computer does make a distinction between the integer 17 and the
floating-point number 17.0; they actually look quite different inside the computer.) There could
also be types for individual characters (’A’, ’;’, etc.), strings (“Hello”, “A string can include
many characters”, etc.), and less common types such as dates, colors, sounds, or any other kind
of data that a program might need to store.

44
Q

program

A

is a sequence of instructions. In the ordinary “flow of control,” the computer
executes the instructions in the sequence in which they occur in the program, one after the other. However, this is obviously very limited: the computer would soon run out of instructions
to execute.

45
Q

control structures

A

are special instructions that can change the flow of control. There are two basic types of control structure: loops & branches

46
Q

loops

A

which allow a sequence of instructions to be repeated over and over. Loops are used when the same task has to be performed more than once.

47
Q

branches

A

which allow the computer to decide between two

or more different courses of action by testing conditions that occur as the program is running.

48
Q

subroutine

A

consists of the instructions for performing some task, grouped together as a unit and given a name. Subroutines are a way to break down tasks in a program so that its manageable to design.

49
Q

software engineering

A

is concerned with the construction of correct, working, well-written programs. The software engineer tries to use accepted and proven methods for analyzing the problem to be solved and for designing a program to solve that problem.

50
Q

structured programming / top-down approach programming

A

The structured programming approach to program design was based on the following advice: To solve a large problem, break the problem into several pieces
and work on each piece separately; to solve each piece, treat it as a new problem which can itself
be broken down into smaller problems; eventually, you will work your way down to problems that can be solved directly, without further decomposition. This approach is called top-down programming

51
Q

Problems with structured programming:

A

For one thing, it deals almost entirely with producing the instructions necessary to solve a problem. But as time went on, people realized that the design of the data structures for a program was at least as important as the design of subroutines and control structures. Top-down programming doesn’t give adequate consideration to the data that the program manipulates. 2) structured programming also is difficult to reuse.

52
Q

bottom-up design

A

In bottom-up design, the approach is to start “at the bottom,” with problems that you already know how to
solve (and for which you might already have a reusable software component at hand). From there, you can work upwards towards a solution to the overall problem.

53
Q

module

A

is a component of a larger system that interacts with the rest of the system in a simple, well-defined, straightforward manner.

54
Q

information hiding

A

is one of the most important principles of software engineers

55
Q

object-oriented

programming (OOP)

A
The central concept of object-oriented programming is the object, which is a kind of module containing data and subroutines. The point-of-view in OOP is that an object is a kind of self sufficient entity that has an internal state (the data it contains) and that can respond to messages (calls to its subroutines). A mailing list object, for example, has a state consisting
of a list of names and addresses. If you send it a message telling it to add a name, it will respond by modifying its state to reflect the change. If you send it a message telling it to print itself, it will respond by printing out its list of names and addresses.
56
Q

polymorphism

A

This property of objects—that different objects can respond to the same message in different ways

57
Q

class

A

Objects that contain the same type of data and that respond to the same messages in the same way
belong to the same class

58
Q

subclass

A

classes inside of a parent class. Subclasses inherit properties of the parent class.

59
Q

command-line interface

A

type of interaction between a user and a computer

60
Q

Graphical User Interface,

A

The computer draws interface components on the

screen. The components include things like windows, scroll bars, menus, buttons, and icons.

61
Q

There are four components in the window with which the user can interact:

A

a button, a checkbox, a text field, and a pop-up menu.

62
Q

3 GUI sets for Java:

A

1) AWT (Abstract Windowing Kit 2) Swing 3) JavaFX

63
Q

protocols

A

A protocol is simply a
detailed specification of how communication is to proceed. For two computers to communicate
at all, they must both be using the same protocols.

64
Q

Internet Protocol (IP)

A

which specifies how data is to be physically transmitted from one computer to another in the internet network

65
Q

Transmission Control Protocol (TCP)

A

which ensures that data sent using IP is received in its entirety and without error

66
Q

Which two protocols are referred to collectively, provide a foundation for communication?

A

TCP/IP

67
Q

What form is communication sent over the Internet?

A

packet

68
Q

packet

A

A packet consists of some
data being sent from one computer to another, along with addressing information that indicates
where on the Internet that data is supposed to go. Think of a packet as an envelope with an
address on the outside and a message on the inside. (The message is the data.) The packet
also includes a “return address,” that is, the address of the sender. A packet can hold only
a limited amount of data; longer messages must be divided among several packets, which are
then sent individually over the Net and reassembled at their destination.

69
Q

IP Address

A

a number that identifies it uniquely
among all the computers on the Net. (Actually, the claim about uniqueness is not quite true, but
the basic idea is valid, and the full truth is complicated.) The IP address is used for addressing
packets. A computer can only send data to another computer on the Internet if it knows that
computer’s IP address.

70
Q

domain names

A

Used by the human interaction instead of IP addresses because its easier for humans to remember names versus a series of numbers. They are used for convenience.

71
Q

SMTP

A

email service protocol, used to transfer email messages from one computer to another.

72
Q

POP & IMAP

A

are used to fetch messages from an email account so that the recipient can read them.

73
Q

HTTP

A

protocol used to send each page

request and to receive the response from the web server.

74
Q

applet

A

is a small program that is transmitted over the Internet and that runs on a web page

75
Q

Hadoop

A

a system for large scale data processing, is written in
Java. Hadoop is used by Yahoo, Facebook, and other Web sites to process the huge amounts
of data generated by their users.