CS W1001 Introduction to Computer Science

Homework 2 (11 points)

Hardware, HTML and Stinky



Due Date:

Tuesday, February 22.

For this assignment, hardcopies (only) of the first Part are required, and electronic submissions (only) of the second and third Parts are needed. Place your TA's name on the upper-right corner of the hardcopy. For the electronic submission, you should only submit a text file with the URL of your home page (which will in turn include your solution to Part III, below). Do not submit any HTML source code; do not submit the contents of your public_html directory. The course web page provides directions for electronic submission.

Reading:

"An Invitation to Computer Science," the rest of Chapter 4 (Section 4.4.2 is optional (but interesting); you are responsible for the examples (compare-for-equality and binary addition) in Section 4.4.3, which are covered in class, but your not responsible for the use of the algorithm from Section 4.4.2 to construct them), Chapter 5 on higher-level computer hardware organization and the history thereof (sections 5.2.2 and 5.3.4 are optional and section 5.3, on hardware history, should be read for concepts and trends, but don't worry about memorizing details, e.g., computer names), Section 8.4.3 on HTML and Section 12.4 on the Internet and the Web.

Part I: Digital and Computer Organization Theory Questions (4 points)

Show your work or explain your answer to each of the following:
  1. How many possible two-input boolean functions are there? How many possible 3-input boolean functions? How about for n inputs? Note: assume each boolean function has only one boolean output. Hint: think of the truth table that describes such a function -- how many rows are there? Now, given that many rows, how many possible ways are there to fill the output column with 1s and 0s (or Ts and Fs, if you like)?
  2. Draw a circuit using only AND, OR and NOT that performs XOR ("exclusive OR") (this was shown in class). Now, draw another circuit to do the same thing using only 1-CE and NOT.
  3. Figure 4.2.1 of the text shows the design for a 1-ADD circuit. This fulfills the behavior of the truth table in Figure 4.19. However, there are other ways we could design this circuit. If we changed the design of 1-ADD in a way that did not change its adherence to the truth table that describes its desired behavior (i.e., it still does the same thing), what is the most radical change that would or could be required of the Full Adder circuit in Figure 4.22 as a result of doing this? Explain why in one sentence.
  4. Chapter 4, exercise 15. Show the truth table, also.
  5. Chapter 4, exercise 16. Show the truth table, also.
  6. Abstract the result from the previous exercise into a black box. Use odd-parity circuits with 3 inputs each to construct an odd-parity circuit for 9 inputs.
  7. Chapter 5, exercises 6, 10, 16, 17. After reading number 16, you may want to read the following hint. I am providing a hint for 16 since reading about I/O (input/output) in Chapter 5 is optional. Basically, the CPU is doing its fetch-decode-execute cycle thang, and one of the instructions it fetches and then executes could be to output some character (8 bits) to the screen. To do (i.e., execute) this, it sends a signal to the I/O saying "output this character please", and then the I/O starts working at that. In the meantime, while the I/O is working, the CPU is now free to go ahead and start doing the next thing it wants to do, which is, of course, to fetch, decode and execute more instructions. This all happens wicked fast, of course.
  8. Our text (chapter five) describes an example machine language instruction set with 16 commands. Briefly list 3 advantages and also 3 disadvantages of expanding this to 32 commands.

Part II: Make Your Web Homepage (4 points)

HTML is the acronym for Hypertext Markup Language. It is a language used for typesetting Web documents and for creating hyperlinks. As such, it is not a full-fledged programming language like C, Pascal or Java. Other type-setting languages include Tex, Latex, and RTF. HTML was initially developed at CERN (a research institute in Switzerland, primarily concerned with physics).

A type-setting language provides commands for controlling formats and layout on a page. Hyperlinks are a way of providing a link between text (or possibly a picture) with things like other text, pictures, sounds, video, and documents, just to name a few possibilities. For example, footnotes or endnotes in a paper could be considered to be examples of hyperlinks since they tie sentences in the text to the information contained in the note.

One good way to start creating your pages is to copy someone else's page, and modify it. However, if you do this, you must modify it enough so that it makes complete sense as your home page. For example, if there is a link that goes to "my Mom's home page", you need to get rid of it or change it, unless you have the same mother as the person from whom you copied the home page. If you are looking at a page, you can save the HTML source by selecting "save as" under the File menu. Note that if you do this on a Mac, it will save it to that Mac's hard disk, and you will then need to use Fetch to transfer it to your home directory for your AcIS account.

If you decide to start with my home page, or that of a TA, you can copy the HTML source directly from their home directory. For example, you can copy files from ~es66/public_html/ or from ~cs1001/public_html/ or from any of the TAs, in their public_html directory (if their homepage is on AcIS).

The TA home pages are available from the the course main web page (not the TA office hour page). Note that most of our TAs have done fancy things with their home page that are above and beyond the requirements of this assignment, so it may be easier to just start from my home page. However, the TA pages are much more inspired than my page, so at least look at them for general ideas. You can even look at the web page your are reading right now for examples.

You will learn about HTML from the reading in our text, mentioned above, the two-page reference of HTML commands handed out in class, and see the AcIS page on creating web pages at Columbia, http://www.columbia.edu/cu/help/create.html . Optionally, you can also see books that specialize on the Web and HTML, or surf the web for more information about HTML, e.g., http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html

You must create the HTML files with a text editor such as Pico. For this assignment, you are expected to not use a special HTML editor (also known as a WYSIWYG editor). This is important for you to get experience directly modifying a computer language. The next language you will use, Java, will be even more intracit.

Your main web page must contain, as minimal requirements:

Your special interest page must contain:

Have fun sprucing up your pages. Remember that a link to your page will be included in Columbia's directory of home pages, and you can have your friends point to it from their home page. Even more seriously, all major web search engines will eventually index it. Furthermore, you can include basic information about yourself, or even a resume, so that it can be a reference you give to both personal and business contacts; put your URL on your business card. Don't put anything on your home page that you don't want the entire world to see.

Images. One way to get images for you pages is to copy them from a web site that you like. For example, on an HP, if you click the right mouse button on an image you can save it to your disk. A more personal alternative is to put your own pictures on the web. There is reportedly a scanner on the fifth floor of Butler, so you can bring photographs to scan in and put on your home page. If you know of another publically-available scanner on campus, please let me know! If you have access to a digital camera, that is another way to get pictures on the web.

Your web page must work -- check it at each saved modification with the reload button. Technical considerations abound. There are a variety of versions of HTML, as well as numerous browsers. Older versions of HTML may not support some new features while newer versions may have additional capabilities when it comes to formatting and multimedia. Browsers are programs that are used to view web pages. They include Netscape Navigator, Netscape Communicator, NCSA Mosaic, and Microsoft Internet Navigator. Depending on which browser you use, the web page may appear somewhat differently and some features may or may not be supported.

Homepage in a nutshell: you gotta make a subdirectory called public_html and put in it an HTML file called index.html. This file needs the correct permissions set so the world is allowed to access it. Do that with the following unix commands:

AcIS guidelines to creating Web Pages: http://www.columbia.edu/cu/help/create.html

Part III: Draw with Stinky (3 points)

Go to the Stinky programming web page, http://www.cs.columbia.edu/~evs/stinky/ . Read it to understand how to program in Stinky.

Edit the Stinky source code that (as you will see) is inside that HTML file to change the drawing so it is either your initials (two letters is enough), your first name, your nick-name, or so it is recognizably a drawing of a person or a face (you can put on the page who it is supposed to be -- a self-portrait, perhaps?). If it is a figure or face, plan, at least initially, to do a very simple job, e.g., a "stick figure".

Unfortunately, we cannot give extra credit for artistic merit. However, your image will be considered for the Stinky Hall of Fame.

Make a clear link from somewhere on your homepage (towards the top if you have a big homepage) going to your stinky page, labeling it clearly as either "Stinky" or "Solution to Part II". When your homework is being graded, your TA will go from your homepage to your Stinky drawing.


Thanks to Andrew Kosoresow for help with Part II, above. email: evs at cs dot columbia dot edu