> Comp 150 Final exam study guide Dordal ========================================================================== Dale & Lewis exercises: 1. HTML, Ch 16: Book exercises: p 526, #40, 41 40: Dale Home Page 41: The browser quits the current page and goes to the utexas page. ================================== 2. Networks, Chapter 15 Book exercises: p 502, #32, 36, 41, 43, 44, 56, 58, 59, 60 32: A local-area Ethernet is limited in size by the physical limits built into ethernet, but is usually much smaller than even that: one floor of a building, typically. Larger Ethernets are built with switches. 36. An ISP provides your connection to the backbone. The backbone itself is the largest ISPs (with full routing tables, no DEFAULT routes) exchanging traffic. 41. DSL uses native digital signalling over the phone line. Analog modems send digital data encoded as an analog signal. (As such, they are capped by the 4,000 Hertz cap for voice signals!) 43. Packets are small buffers of data, with headers. Data is sent as packets so that lines can be shared by other connections through alternation of different packets from different sources. 44. Packet switching refers to a switch/router receiving a packet and retransmitting it along the next link to its final destination. 56. IP addresses are 4-byte addresses used by the Internet Protocol. Every host on the Internet has a unique IP address. 58. An IP address has a Network part and a Host part. 59. Class A has 7 bits for network addr and 24 bits for host. Class B has 14 network bits and 16 host bits; class C has 21 net and 8 host bits. To find the maximum number of networks or hosts, take 2 to the power of the # of bits. 60. How many hosts are possible in Class A, B, and C networks? Class A: 2^24 hosts Class B: 2^16 hosts Class C: 2^8 hosts ================================== 3. Operating-system basics, ch 10 Book exercises: pp 347-350: 33, 57, 58, 59, 60, 61, 62, 63, 66, 67 33. Timesharing means that clock interrupts are used to ensure that every process is granted at least *some* time very promptly. This makes it possible to run interactive processes that require rapid response, while at the same time also allowing long, slow programs. 57. In the book's notation, a virtual address of <2,133> would mean page 2 (wherever that was), 133 bytes into it. Normally these would be expressed as a single number; if the page size were 4K, then the 2 would represent 2*4096, or 8192+133=8325. 58. From the table, page 2 is located at physical page (frame) 7, so the physical address is 7*1024 + 85 = 7253. 59. From the table, page 3 is located at physical page (frame) 3 (purely coincidentally), so the physical address is 3*1024 + 555 = 3627. 60. The logical address <3,1555> is really <4,531>, since 1555=1024+531 is bigger than 1024. Given the table shown, it is not a legal address. 61. Virtual memory (literally, having more apparent memory than is physically present) is *implemented* by demand paging, in which frames that have not been used recently can be written out to the disk. 62. See Fig 10.8: New, Ready, Running, Waiting, (back to Ready), eventually to Terminated. 63. A process moves from Ready to Running when the scheduler gets around to it. A process moves from Running to Waiting when it has requested some non-immediate service from the OS (such as any I/O). A process moves from Waiting to Ready when that I/O has completed and the data is available. A process moves from Running to Ready if it has consumed its immediate cpu time quota. 66. A context switch is essentially the shift from one process (and one set of page tables) to another. 67. Nonpreemptive scheduling means no timer interrupts, so that a process that is not doing any I/O can hog the CPU for a long time. Preemptive means that the timer interrupts will always give other processes a chance. ================================== 4. Artificial Intelligence, ch 13 Book exercises: p 437, # 31, 43 31: The Turing Test is Alan Turing's proposed test for whether a computer can be said to be indistinguishable from a person (in the context of the test). 43. Trees for chess are too large because the size is exponential. Specifically, suppose at each turn there are 20 plausible moves (even that number requires substantial trimming to remove trivial or unlikely moves). Then to account for both sides' possible moves in one turn, we have 20x20 = 400 cases. To try to consider what the consequences might be 10 moves into the future, we have 400^10 cases, ~ 10^26. ================================== 5. Relational database model, ch 12 Book exercises: p 405, 48, 49, 50, 51, 52 48. A relational DB is organized as a collection of tables. 49. Fields are "columns" of the tables: specific attributes (name, address, date) that an object can have. 50. Other fields that the table of figure 12.7 might contain could be: any other field about a specific movie, eg: playing time VHS v DVD director star 51. Other fields that the table of figure 12.8 might contain could be: any other field about a specific customer, eg: city, state phone account # email 52. A key is a column (or sometimes set of columns) in a table that uniquely determines the rest of the data in that row. Specifically, two different rows of a table are NOT permitted to have the same key. ========================================================================== ========================================================================== > Sample problems: > > 1. Write a python function to check each word in a list "wlist" > for membership in a dictionary "dict". If word w is found in dict > (if w in dict), return dict[w]. If no word matches, return "notfound". > > def wcheck1 (wlist): The nice thing about writing this as a function is that, once you've found a match, you just return, and don't have to worry about the rest of the function: def wcheck1 (wlist): for w in wlist: if w in dict: return dict[w] return "notfound" Note that the following version is WRONG: it never gets past the first word. It either returns dict[w] for w the first word of wlist, or it returns "notfound" WRONG: def wcheck1 (wlist): WRONG: for w in wlist: WRONG: if w in dict: WRONG: return dict[w] WRONG: else: WRONG: return "notfound" > (b). Write a python function to check each word in a list "wlist" > for membership in dictionary "dict1". Then, if none of the words > are in "dict1", check each word for membership in dictionary "dict2". > Again, return dict1[w] if word w is in dict1; dict2[w] if a word > is found in dict2, and "notfound" otherwise. > > Be sure you check all the words for being in dict1 before you > check any for being in dict2. An application of this might be > a chatterbot where we first tried to match a dict1 word, and > only if all those failed did we go on to dict2. def wcheck1 (wlist): for w in wlist: if w in dict1: return dict1[w] for w in wlist: # now start over on dict2 if w in dict2: return dict2[w] return "notfound" =============================================== > 2. Discuss the security risks involved in having your browser > run programs downloaded remotely from a web page, and discuss > how java applets and Microsoft activeX each deal with these risks. If your browser runs programs on your machine that are downloaded from the remote site, then those programs potentially have full control of your machine. Java deals with this by running remote programs in a "sandbox", where access to *any* local-machine files is disallowed (unless permitted by the user). ActiveX addresses this by giving the program full control, but requiring that the program be digitally signed so you can be sure of its authenticity. Alas, in practice, being sure that a buggy program is "authentic" may not be worth much. =============================================== > 3. (a). Write HTML for a simple (b). Write the html neces- > page with two headers, two para- sary to produce two column > graphs below each header, and at text using a TABLE; create > least one unnumbered list of the table and show where the > topics. text would go. The result should > look like this problem. (b) One-row table: a single
3. (a). Write HTML for a simple page with two headers, two para- graphs below each header, and at least one unnumbered list of topics. | (b). Write the html neces- sary to produce two column text using a TABLE; create the table and show where the text would go. The result should look like this problem. |