V CS 130 Computing Concepts: final exam review (Spring 2006)
V Exam details
* the exam will be held on Friday 5 May from 8-11am in Collins 204
* exam will consist of True/False, multiple choice, shorter and longer answer
V typical question forms
* define or use a concept; calculate something; spot an error; tell how something will behave
* target time = approx. 90 minutes (some will finish sooner, some later)
* coverage: about 1/2 from before the midterm, about 1/2 from after the midterm
* an appendix will include powers of 2, common HTML tags, logical operator tables, etc.
V Class materials useful for review
* review notes: from the midterm and these notes
* midterm exam: study this both for content and for examples of exam question style
* on-line resources: dozens of links on the course homepage
* lab assignments: 8 different labs; see web for details
* class handouts: e.g., XML/XSL handout
V General themes
* symbolic / digital representation of information
* computers as automated transformers of data (and thus of information)
* multi-layered systems of abstraction, hiding representation details
* modularity for separation of concerns (e.g., style separated from content)
* automation can empower people to create, but this creativity is limited by the choices of the designer
* See midterm review notes for summary of pre-midterm topics!
V HTML and hypertext document structures
V HTML is a document description language which uses mark-up
* in mark-up languages the text content is the main focus, i.e., it is also the content displayed
* but we also have tags in the mark-up document which don’t show up directly when it is displayed
* tags have effects on the style and layout of the content (bold, indentation, centering, etc.)
V HTML tags normally have an opening part and a closing part (same name): <TAG> ... </TAG>
* some tags do not require a closing part (<P>, <BR>)
* tags may also have (several) attribute/value pairs: <TAG ATTR1=value1 ATTR2=value2 ...>
V physical versus logical structure
* some tags directly affect the physical appearance of the display: bold, italic, centering
V other tags are more abstract, addressing document structure issues without specifics
* (for example, emphasis could be bold, italic or even red colored text)
V specific HTML features and tags
* emphasis, bold and other text styles, as well as fonts and type sizes
* titles and headings: title shows in browser window, headings mark document sections
* paragraphs and line breaks: in HTML, these do not require closing tags (they are separators)
* ordered and unordered lists: use enclosed <LI> tags (list item); show as indented
* tables: use tags for tables (TABLE), table rows (TR) and table data (TD)
* images: uses an unclosed IMG tag with a SRC attribute to specify image URL
* hyperlinks: uses a URL or a local file name or even a named anchor in the same file
V serving pages over the Internet
* the pages reside on machines called servers: the client browser sends requests for them
* the HTTP (hypertext transfer protocol) is used to negotiate the exchange of files over the net
V CSS style sheets: content is put in one file (HTML) and style information is put in another (CSS)
* a modern approaches to HTML, better at separating physical style from document structure
V content and style files can be put together in different combinations in order to get:
* different content files all with the same style (layout, colors, fonts, etc.)
* or the same content file with different styles (as in the CSS Zen Garden website)
V XML and data structures
V XML is a language for describing user data
* HTML has specific tags for document structure
* XML lets you define any tags you want
V XML tag structure: similar to HTML, but stricter rules
* angle brackets as in HTML, but now all tags must have a corresponding closing tag
* but, we can shortcut a closing tag if there is no enclosed content: <TAG />
* nested tags can't “cross”: one must be fully nested within another
* attributes and values as in HTML, but all values should be enclosed in quotation marks
V XML schemas: enforcing rules about structure
* an XML schema defines a restricted set of tags, attributes and how they can nest
* groups of people can use XML schemas to enforce mutual rules about information structure
* examples: MathML, CML (chemistry), XHTML (revised HTML for documents), SVG (graphics)
V XSL and data transformation
V XSL is a language for transforming XML data
* we can transform data structures into document structures for display (e.g., as HTML)
* we can also transform data into other XML formats (e.g., graphic display of chemicals)
V XSL is also an XML language!
* XSL is built using tags and attributes, according to XML rules (it is actually a schema)
* similar to how electricity is used as medium for both representation and control in transistors
* and to how binary is used as medium for both representation and control in programs
* XSL for-each tag: allows to match against (nested) tags and produce output for each inner tag
V XSL contexts: every for-each searches within the context introduced by the enclosing one
* repeated contexts (universe/galaxy, then galaxy/planet) will usually fail to select tags,
unless the actual XML data includes (e.g.) one galaxy inside another
V XSL value-of tag: allows access to the value or attributes of a tag matched by the for-each tag
* used (for example) to output the name attribute of a galaxy (or department or class)
V displaying XML data and connecting XSL to XML data
* by default, most browsers display “raw” XML data in an indented, clickable (hide/show) outline
* we can specify in the XML file which XSL file should be used to transform it for display
V Transistors, gates and circuits
V transistors are electronically-controlled switches or valves which affect the flow of electronic signals
* they are cheaper and faster than mechanical switches; they also use electricity to control electricity
V logical operators: given some set (usually 1 or 2) of inputs, each operator produces certain outputs
* AND: it yields a 1 value if both inputs are 1 (otherwise 0)
* OR: it yields a 1 value if either input is 1 (or even if both are)
* XOR: like OR, but it yields a 0 when both inputs are 1 (“exclusive OR”)
* NOT: takes one input and “flips” it (a 0 yields 1, but a 1 yields 0)
* NAND: like AND, but with an extra NOT on the way out (it yields 1 when not both inputs are 1)
* NOR: yields 1 when neither input (“NOR” the other) is 1 (so it yields 1 when both are 0)
* we can describe each operator using a truth table (see exam appendix!)
V gates are built from transistors and implement common logical operators
* the proper use of gates assumes that all signals involved will be exactly 0 or 1, nothing else
V circuits are built from combinations of gates in order to compute something useful
* example: addition (of two binary numbers); demonstrated in class using XORs and ANDs
V example: memory circuit (stores a bit value over time)
* built using a “loop”; in other words, a feedback mechanism linking outputs back to inputs
* example: selection (choose one input from several based on “binary number”); see lecture notes
V Computer architecture
V the storage hierarchy
* a storage location holds a bunch of bits (8, 16, …) over time (using the memory circuit)
* we can write new bits in (the old ones are destroyed) or read out what is stored there
V a spectrum: from closer/faster/fewer/more expensive to further/slower/more/cheaper
* (recall analogy from lecture: books on desk, on shelf, in library or in other cities)
V basic computer components
* RAM (random access memory): storage locations on the chip but not “close” to the ALU
* registers: storage close to the ALU which can usually be operated on directly
* ALU (arithmetic/logic unit): computes operator values from arguments
* PC (program counter): a register which keeps track of the current instruction
V IR (instruction register): a register into which the current instructions fetched
* (then taken apart to be actually performed by the decoder, ALU and MUX)
* decoder: takes instruction apart and routes the pieces
* MUX / selection: chooses RAM or register; same circuit used to choose ALU results
V overall fetch/execute cycle: get an instruction from RAM, oerform it, and repeat
* normally increase the PC each time (to go to next instruction), but over-write it for jumps
V the circuits are usually synchronized by a clock which forces results at specific intervals
* (this is the clock speed of the chip, e.g., 1 GigaHertz = 1 billion times per second)
V Instruction sets and programs
V structure of an instruction
* operator and arguments
* operator = “verb” (what to do)
* arguments = “nouns” (what to do it to)
V machines may allow one, two or three arguments in an instruction
* (if 1, usually an implicit argument (ACC) is used); if 3, the 3rd specifies where the result goes
* byte = 8 bits; word = “natural” size of data on some specific computer (data path width)
* some machines use multiple words for each instruction (“double scoop” technique)
* total number of bits = sum of numbers of bits for each part
V an operator is represented by bit values
* we need as many bit patterns as there are operators: it doesn't matter which ones we use
V we compute all possible operator results, then select the one we want based on its binary code
* (using the selection circuit as developed in lab 9)
* we can support as many operators as 2 to the power of the number of bits we have
V arguments are bit values
* immediate mode: bits in the instruction are interpreted as the actual data itself
* direct mode: bits are interpreted as an address where the actual data is held
* indirect mode: bits are the address which itself holds the address of the actual data
V kinds of instructions
* arithmetic/logical operators: use the ALU to produce results
* data movement: specify that data should be copied from registers to RAM (or vice versa)
* jumps: replace the program counter with a new address, effectively jumping to a new instruction
* conditions: check whether some (numeric) comparison is true, producing a 0 or 1 (false or true)