Mid-term Solution (cs105- Spring 2008) 1- Both serve as mediums (tools for communication) for instructing (programming) the machines to do tasks we have in our minds by combining some simple instructions provide by these machines. 2- For a complete answer refer to section 1.4 of module 1. 3- A finite collection of simple instructions that can be performed by a computer and is guaranteed to halt (stop) in a finite amount of time. ex: Algorithm for finding the remainder of number m divided by number n: 1- If m is less than n output m and halt. 2- If r = m – n is less than n output r and halt. 3- m ←m – n (Replace m with m – n) 4- Go to step 2. ex: m = 17 n = 3 - m > n go to step 2 - r = 17 – 3 > 3 go to step 3 - m = 17 – 3 = 14 go to step 4 - go to step 2 - r = 14 – 3 > 3 go to step 3 - m = 14 – 3 = 11 go to step 4 - go to step 2 - r = 11 – 3 > 3 go to step 3 - m = 11 – 3 = 8 go to step 4 - go to step 2 - r = 8 – 3 > 3 go to step 3 - m = 8 – 3 = 5 go to step 4 - go to step 2 - r = 5 – 3 < 3 output r = 5 - 3 = 2 and halt. 4- In a WYSIWYG word processor whatever you type into that word processor and you see it on the monitor will be presented exactly in the same way in the final work. A non- WYSIWYG word processor has some special instructions, marks or tags which tell the word-processor how we want the output to be displayed. So these special instructions are not part of the output. To see the output we need some special program to read these instructions and produce the final work based on these instructions. MS-word is an example of a WYSIWYG word processor any word processor based on LaTeX or HTML is a non-WYSIWYG word processor. 5a- Data may get corrupted during transmission along the network. Since TCP splits the data into packets, if a data corruption occurs during the transmission, we only need to retransmit a single packet, namely the packet which contains the corrupted piece of data, as opposed to the whole file if we don’t chop it into packets. Note that the size of file can be thousands of times larger than the size of a packet. Thus, the waste of network resources and time is clear. b- We can send small packets along different routes of the network. This has several benefits If one route is congested, the remaining packets can go along other routes. We can send packets via several routes at the same time (parallelism). Many users can share a single route. 6A. DNS: Domain Name Server is a server which has a large table. This table contains the symbolic names of servers on the net (such as: www.google.com, www.yahoo.com , …) along with their IP addresses. The job of this server is to return the IP address of servers given their symbolic names. B. Mail Server: Servers which manage our email accounts, send and receive our emails. When we login to our account we communicate with the mail server that we have account at. C. TCP: The protocol which is responsible for splitting the data into packets at the source, reassembling the packets at destination and resending a packet if it is lost or garbled along the way. D. IP Address: The unique address of each entity on the net. An IP address essentially is consists of four numbers in the range of 0 to 255 separated by dots. E. HTTP: A widely used (perhaps the most widely used) protocol for communication among applications (software or programs) on the internet such as browsers and server applications. 7- The ability to return to a previous state after taking one or more action, perhaps erroneous action or actions. 8<HTML> <HEAD><TITLE>Question 8</TITLE></HEAD> <BODY BACKGROUND="flower.jpg"> <TABLE CELLPADDING="5" BORDER="4"> <TR> <TH>HEADER1</TH> <TH>HEADER2</TH> </TR> <TR> <TD><B>n11</B></TD> <TD><A HREF="http://www.umb.edu" > Link to UMB </A> </TD> </TR> <TR> <TD><U>n21</U></TD> <TD>n22</TD> </TR> </TABLE> <HR WIDTH="50%" ALIGN="left" > <UL TYPE="DISC"> <LI>item1</LI> <LI>item2</LI> <LI>item3</LI> </UL> </BODY> </HTML> 9- It’s not well-formed because of rule 3. Name of an XML element cannot begin with the prefix “XML”, (“xml” or “xML”, ets). 10- Choice A. Think generically. Remember, tags should not directly convey the information in an XML document. They should describe what information the document contains. Structure A helps to facilitate searching the document. For example we want to list the name of all plants with price less than $5.00 using XSL. In case A we can use XSL path CATALOG/PLANT/PRICE to access all the prices. But in case B we need to know the name of all plants in order to be able to retrieve their prices. For example to access the price of plant Bloodroot we need XSL path: CATALOG/Bloodroot/PRICE which contains the name of the plant. 11- 1. Menu/food 2. @price = ‘5.0’ 3. name 12- We use XSL instruction <xsl:for-each select=”…”> when we have an XML element repeated several times in the XML document and we want to apply some set of styling or filtering XSL instructions on all instances of that XML element or any of its children (successors).