CS 1111 · Computing Fundamentals and Ethics

Midterm Study Guide

Chapters 1 to 5, from your slides. Read a chapter, then try the quick check at the end. Tap a question to see the answer.

Chapter 1What is Computing

The big idea

A computing system has three parts:

Abstraction means hiding the complicated details. You drive a car without knowing how the engine works.

Layers of a computer, inside to outside

  1. Information
  2. Hardware
  3. Programming
  4. Operating system
  5. Applications
  6. Communications

Famous people

PersonRemember them for
PascalMechanical calculator
JacquardLoom with punched cards
BabbageAnalytical Engine
Ada LovelaceFirst programmer, invented the loop
Alan TuringTuring machine

Generations

GenHardwareSoftware
1stVacuum tubesMachine language and assembly
2ndTransistorsHigh-level languages (Fortran, COBOL, Lisp)
3rdIntegrated circuitsOperating systems
4thPCs and laptopsStructured programming, spreadsheets, word processors
5thWindows, Java, the Web

Two kinds of programmers

Four skills of computing

Algorithmic thinking, representation, programming, and design.

Quick check

Answer in your head first, then tap.

What are the three parts of a computing system?

Hardware, software and data.

Who is called the first programmer?

Ada Lovelace.She is credited with the idea of the loop.

What replaced vacuum tubes, and in which generation?

Transistors, in the 2nd generation.

Who builds tools like assemblers: systems or application programmers?

Systems programmers.Application programmers use those tools.

What is abstraction?

Hiding complicated details behind a simple view.Like driving a car without knowing how the engine works.

Chapter 2Data Representation

Which digits each base uses

BaseDigits allowed
2 (binary)0 and 1
8 (octal)0 to 7
10 (decimal)0 to 9
16 (hex)0 to 9, then A=10, B=11, C=12, D=13, E=14, F=15

A number can't use a digit as big as its base. So 178 is not base 8, because it has an 8.

Binary to decimal

Write these place values over the bits, right to left. Add up the places that have a 1.

1286432168421
10010

Example: 10010 has 1s in the 16 place and the 2 place. 16 + 2 = 18.

Decimal to binary

  1. Divide the number by 2.
  2. Write down the remainder (0 or 1).
  3. Divide the answer by 2 again. Keep going until you reach 0.
  4. Read the remainders from bottom to top.
Number÷ 2 =Remainder
41201
20100
1050
521
210
101

Bottom to top: 41 = 101001.

Binary to hex, and hex to decimal

How many things bits can show

Analog and digital

Text

Character setBitsCharacters
ASCII7128
Extended ASCII8256
Unicode1665,536

Compression

Compression ratio = new size ÷ old size. Smaller is better.

Sound, pictures and video

Quick check

Grab paper for the conversions.

Convert 10110101 (binary) to decimal.

181128 + 32 + 16 + 4 + 1 = 181.

Convert 57 to binary.

111001Remainders 1, 0, 0, 1, 1, 1 read bottom to top.

Convert 11011100 (binary) to hex.

DC1101 = D, 1100 = C.

How many bits do you need for 100 different things?

72⁶ = 64 is too few, 2⁷ = 128 is enough.

Encode aaaaaaabbbcccccc with run-length encoding. What is the ratio?

*a7bbb*c6, ratio 9/16 = 0.5625bbb stays as is because 3 repeats aren't worth encoding.

Is 178 a valid base-8 number?

No.Base 8 only uses digits 0 to 7.

Temporal or spatial: comparing one frame to the next?

Temporal.

Chapter 3Computer Components

Gates are built from transistors

A logic gate is made of a few transistors.

How it stacks up:

  1. A few transistors make one logic gate.
  2. Millions of gates make one integrated circuit (chip), with billions of transistors.
  3. Tens or hundreds of chips sit on the motherboard.

From the textbook: a NOT gate uses 1 transistor, NAND and NOR use 2, AND and OR use 3.

A gate does one basic job on electrical signals. A circuit is several gates joined together. The most important chip is the CPU.

The gates

ABANDORXORNANDNOR
0000011
0101110
1001110
1111000

OR and XOR only differ on the last row, when both inputs are 1. You can describe a gate three ways: a Boolean expression, a logic diagram, or a truth table.

Parts of the computer (von Neumann)

PartWhat it does
MemoryHolds both the program and the data
ALUDoes math (+, −) and logic (AND, OR, NOT)
Control unitRuns the show
Input / outputKeyboard and mouse in, screen and printer out
BusCarries data between the parts

Fetch-execute cycle

  1. Fetch the next instruction.
  2. Decode it.
  3. Get data if needed.
  4. Execute it.

Then it starts again, which is why it's called a cycle.

Memory

Fastest to slowest: registers → cache → RAM → secondary storage → tape and discs. The faster it is, the smaller and more expensive it is.

Embedded systems

A small computer built into something bigger to do one job. Examples: computers in cars, phones and medical equipment.

Quick check

Use the truth table if you get stuck.

What is a logic gate made of?

A few transistors.Transistors act like switches with no moving parts.

What does a NAND gate output when A = 1 and B = 1?

0AND would give 1, and NAND is the opposite.

Which gate gives 1 only when the inputs are different?

XOR.

Which register holds the address of the next instruction?

The program counter (PC).

Put the fetch-execute steps in order.

Fetch, decode, get data, execute.

Which memory is volatile: RAM or ROM?

RAM.

What is the fastest level of the memory hierarchy?

Registers.

Chapter 4Operating Systems

What an OS does

The OS has three jobs:

  1. Manage resources like memory and devices.
  2. Give you a way to use the computer.
  3. Let programs use the computer's resources.

Key words

WordMeaning
MultiprogrammingSeveral programs in memory at the same time
ProcessA program that is running
CPU schedulingPicking which process runs next
Real-time systemA system where fast response really matters
Device driverA small program that knows how to talk to one device

Addresses

Physical = where the program starts + logical. Program starts at 100, logical is 23, so physical is 123.

Partitions

Picking a block

Slide example. Blocks: A 1000, B 700, C 750, D 1500, E 300, F 350.

RequestFirst fitBest fitWorst fit
1000AAD
25AED
780AAD
1300DDD
325AFD

Process states

  1. New: being created.
  2. Ready: waiting for its turn on the CPU.
  3. Running: using the CPU right now.
  4. Waiting: waiting for something else, like a file or the printer.
  5. Terminated: finished.

Lots of processes can be ready or waiting. Only one can be running.

Scheduling

AlgorithmRuleType
First-Come, First-ServedIn the order they arriveNonpreemptive
Shortest Job NextShortest one firstNonpreemptive
Round RobinEveryone gets a turn of fixed lengthPreemptive

Average turnaround

Add up when each process finishes, then divide by how many there are. Example: P1 = 50, P2 = 20, P3 = 30.

Quick check

Use the block list A 1000, B 700, C 750, D 1500, E 300, F 350.

A program starts at 500. A variable has logical address 42. What is its physical address?

542500 + 42.

Best fit for a request of 325?

F (350)E (300) is too small, F is the smallest that fits.

First fit for a request of 780?

A (1000)It's the first block that is big enough.

A process is waiting for the printer. Which state is it in?

Waiting.

Which scheduling algorithm is preemptive?

Round Robin.

Processes A = 30, B = 10 arrive in that order. Average turnaround with SJN?

25B finishes at 10, A at 40. (10 + 40) ÷ 2 = 25.

Chapter 5Networks and Internet

Key words

WordMeaning
NetworkDevices connected so they can share
Node (host)Any device on the network
BandwidthHow fast data moves
LatencyThe delay before data arrives
ProtocolThe rules for how data is sent
GatewayConnects a LAN to other networks
RouterSends packets toward where they're going
ISPThe company that gives you Internet

Two ways to set up a network

Sizes of networks

Packet switching

A message is cut into small numbered packets. Each packet travels on its own. They are put back together at the end.

Protocols to know

ProtocolJob
TCPCuts the message into packets and puts them back together
IPFinds the route for each packet
SMTPEmail
FTPSending files
TelnetLogging into another computer
HTTPWeb pages

The OSI model has 7 layers. A firewall filters traffic to protect a network.

Addresses

The Web

HTML, CSS and XML

Cloud and blockchain

Quick check

Last one. You've got this.

Which network type has a single point of failure?

Client-server.

TCP or IP: which one cuts messages into packets?

TCP.IP handles the routing.

Which protocol sends email?

SMTP.

What does DNS do?

Turns a hostname into an IP address.

How many bits are in an IPv4 address? In IPv6?

32 and 128.

Are the Internet and the Web the same thing?

No.The Web runs on top of the Internet.

Which HTML section holds what you see on the page?

The body.

← Home