Chapter 1: Data Storage

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Magnetic systems

The most common example of magnetic systems today is the magnetic disk or hard disk drive(HDD), in which the magnetic coating is used to hold data.

Gates & Flip-flops

*Gate* - a device that produces the output of a Boolean operation when given the operation's input values. -Can be constructed from a variety of technologies such as gears, relays, and optic devices. Provide the building blocks from which computers are constructed. -The AND, OR, XOR, and NOT gates are represented by distinctively shaped symbols, with the input values entering on one side, and the output exiting the other. Triangle=NOT gate, Letter D=N gate, & spaceship=OR gate, smiley face =XOR gate *Flip-flop(collections of circuits)* - a fundamental unit of computer memory. Produces an output value of 0 or 1, which remains constant until a pulse(temporary change to a 1 that returns to 0) from another circuit causes it to shift to the other value. -One means of storing a bit within a modern computer. A flip-flop can be set to have the output value of either 0 or 1. Other circuits can adjust this value by sending pulses to the flip-flop's inputs and still, other circuits can respond to the stored value by using the flip-flop's outputs as their inputs. Thus many flip-flops, constructed as very small electrical circuits can be used inside a computer as a means of recording information that is encoded as patterns of 0s & 1s. Very large-scale integration(VSLI) - allows millions of electrical components to be constructed on a wafer (chips), and used to create miniature devices containing millions of flip-flops along with their controlling circuitry. Consequently, these chips are used as abstract tools in the construction of computer systems.

Memory organization

-A computer's main memory is organized into manageable units called cells, w/ a typical cell size being 8 bits. (a string of 8 bits is called a byte) Thus, a typical memory cell has a capacity of one byte. -Although there is no left or right within a computer, bits within a memory cell as being arranged in a row. The left end of this row is called the *high-order end,* and the right end is called the *low-order end.* The left-most bit is called either the high-order bit or the most significant bit. The right-most bit is known as the low-order bit or *least significant bit.* -To identify individual cells in a computer's main memory, each cell is assigned a unique "name", called *address.* -To complete the main memory of a computer, the circuitry that actually holds the bits is combined w/ the circuitry required to allow other circuits to store & retrieve data from memory cells. In this way, other circuits can get data from the memory by electronically asking for the contents of a certain address (read operation) or they can record information in the memory by requesting that a certain bit patterns be placed in the cell at a particular address (write operation).

1.1 Bits and Their Storage

-Inside computers are information encoded as patterns of 0s & 1s known as bits (short for binary digits). Bits are symbols whose meaning depends on the app at hand. Sometimes patterns of bits are used to represent numeric values & sometimes characters in an alphabet and punctuation marks, and sometimes images or sounds. -To understand how individual bits are stored and manipulated inside a computer, it is wise to imagine that the bit 0 represents the value false and the bit 1 represents the value true. These operations that manipulate true/false values are called Boolean operations.

c

// ConsoleApplication2.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include "pch.h" #include <iostream> using namespace std; void readTestScores(double & grade, double & tavge) { // Read the student's Grade cout << endl << "ENTER Your Grade in percentage: "; cin >> grade; // Print prompt and read the student's test scores int score[5]; int n, i; float num[100], sum = 0.0, tavge; cout << "Enter your score out of 100: "; cin >> n; while (n > 100 || n <= 0) { cout << "Error! number should be in the range of between 1 to 100." << endl; cout << "Enter the number again: "; cin >> n; } for (i = 0; i < n; ++i) { cout << i + 1 << ". Enter your score: "; cin >> num[i]; sum += num[i]; } tavge = sum / n; cout << "Your Average score is = " << tavge; } double computeFinalScore(double grade, double tavge) { // Computes final score as follows: 4/10(test scores average) + 6/10(exam score), then returns final score double finalscore; finalscore = (.4 * tavge) + (.6 * grade); return finalscore; } char getLetterGrade(double score) { char grade; if (score >= 90) grade = 'A'; else if (score >= 80 && score < 90) grade = 'B'; else if (score >= 70 && score < 80) grade = 'C'; else if (score >= 60 && score < 70) grade = 'D'; else if (score < 60) grade = 'F'; return grade; } void printComment(char grade) { switch (grade) { case 'A': cout << endl << "Very Good"; break; case 'B': cout << endl << "Good"; break; case 'C': cout << endl << "Satisfactory"; break; case 'D': cout << endl << "Needs Improvement"; break; case 'F': cout << endl << "You've Failed"; break; } int main() { int id; double exam; double tavge; double finalscore; char grade; while (1) { cout << endl << "ENTER STUDENT NAME: "; cin >> id; readTestScores(exam, tavge); finalscore = computeFinalScore(exam, tavge); cout << endl << "The AVERAGE grade is: " << tavge; cout << endl << "FINAL SCORE IS: " << finalscore; grade = getLetterGrade(finalscore); cout << endl << "LETTER GRADE IS: " << grade; cout << endl << "COMMENT: "; cout << "COMMENT: "; printComment(grade); // cout << endl << "Comment; } return(0); }

Boolean operations

3 of the basic Boolean operations are AND, OR, & XOR(exclusive or). -These operations are similar to the arithmetic operations TIMES & PLUS because they combine a pair of values (operator's input) to produce a third value (output) -The Boolean operation AND is designed to reflect the truth or falseness of a statement formed by combining two smaller, or simpler statements with the conjunction *and.* Such statements have the generic form: P AND Q. P represents one statement, and Q represents another. For Example: *Kermit is a frog* AND *Miss Piggy is an actress.* 1) The inputs to the AND operation represent the truth or falseness of the compound statement's components; the output represents the truth or falseness of the compound statement itself. Since a statement of the form P AND Q is true only when both of its components are true, we conclude that 1 AND 1 should be 1, whereas all other cases should produce an output of 0. 2) OR operation: Such statements are true when at least one of their components is true, which agrees w/ the OR operation. 3) XOR operation: produces an output of 1(true) when one of its inputs is 1(true) and the other is 0(false). Example, a statement of the form p XOR q means "either P or Q but not both". -In short, the XOR operation produces an output of 1 when its inputs are different. 4) NOT operation: differs from AND, OR, and XOR because it has only one input. -Its output is the opposite of that input; if the input of the operation NOT is true, then the output is false, and vice versa. -Thus, if the input of the NOT operation is the truth or falseness of the statement: -"Fozzie is a bear." Then the output would represent the truth or falseness of the statement: -"Fozzie is NOT a bear"

1.3 Mass storage

Due to the volatility & limited size of a computer's main memory, most computers have additional memory devices called *mass storage* (secondary storage systems).incl. magnetic disks, CDs, DVDs, magnetic tapes, flash drives, & solid-state disks. Advantages of mass storage systems over main memory incl. less volatility, large storage capacities, low costs, and in many cases the ability to remove the storage medium from the machine for archival purposes. Disadvantages of magnetic & optical mass storage systems incl. that they typically require mechanical motion and therefore require significantly more time to store & retrieve data than a machine's main memory, where all activities are performed electronically. `

1.2 Main memory

For the purpose of storing data, a computer contains a large collection of circuits (such as flip-flops), each capable of storing a single bit. This bit reservoir is known as the machine's main memory.

Hexadecimal Notation

When considering the internal activities of a computer, we deal w/ patterns of bits(string of bits), some of which can be quite long (stream). -Hexadecimal notation uses a single symbol to represent a pattern of 4 bits. For example, a string of 12 bits can be represented by 3 hexadecimal symbols.


Set pelajaran terkait

L&D, L&D At Risk, and Common Concerns Passpoints for OB Exam 3

View Set

C++ OOP Interview/TopOfMind Questions

View Set

Life Insurance - Chapter 8: Life Insurance and Annuities - Policy Replacement and Cancellation

View Set

105.1-105.20 // Sculpture Cut // Lesson Challenge

View Set

Which of the following is not a coping strategy

View Set