CSC103 2011 Take-Home Final Exam 2

From dftwiki3
Revision as of 21:55, 14 April 2011 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut 22:47, 14 April 2011 (EDT)



This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at noon on Friday April 22nd, 2011.

The work has to be done individually, not in a group. You cannot discuss the details of this exam with anyone except your prof. The TAs are not allowed to help you out with exam material in any way. Questions will only be answered in two ways: in person, in class only. Outside class time, only via email. If you have questions regarding the exam and cannot wait until the next class time, or if the last class has already been given, then you should send your question(s) via email to thiebaut@cs.smith.edu, and the question and its answer will be broadcast back to the whole class via email.

The exam is given under the rules of the Smith College Honor Code.

Make sure you reference all work/resources you use to answer the questions below.



Problem #1: Boolean Logic (30 points)

The three equations below represent three different logic expressions using and, or and not gates of three boolean variables A, B, and C. A boolean variable can take only one of two possible values: True or False.

Which of the two expressions are identical, meaning that for any combination of A, B, and C they are both True or both False.


  • Expression 1: (B and (not C) ) OR ( A and C ) OR ( A and B )
  • Expression 2: (A and B) OR ( not A and B and not C ) OR ( A and ( not B ) and C )
  • Expression 3: (A and C ) OR ( not C )


In your answer explain how you figure out which expression is different (in terms of its output given the same combination of A, and B from the other two.


Problem #2: Assembly (30 points)

Write an assembly language program that uses ten memory locations (variables) filled with 0, starting at Address 30, and that stores the values 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, and 2048 in them. Your program will store 2 at Address 30, 4 at address 31, 8 at address 32, etc.


Your program should contain the following lines to initialize the ten memory locations


 @30
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0


Your program must use a loop.

Use the solution programs for Homework #3 as examples of good formats and good documentation.

You are encouraged to use labels, as they make the programs more readable, but if you prefer not to use labels, you will not be penalized.

Problem #3: Javascript (40 points)

Write a javascript program that uses only one print statement of the form:

  document.write( "*" );

and displays the generate the following output:

**********
 *********
  ********
   *******
    ******
     *****
      ****
       ***
        **
         *

Note that there are 10 lines, and each line contains a decreasing number of stars. The first line contains 10 stars, the second 9 stars, etc.

The first star of the first line starts at the left margin of the screen. The first star of the second line starts after 1 space from the left margin. The first star of the third line starts after 2 spaces from the left margin, etc.

You must use loops. The number of loops is up to you.

Remember that all the stars must be printed by only one document.write() statement that prints only one star: document.write( '*' ). You may have additional document.write() statements, but these cannot print stars.


Use the programs from the Lab 4 solution page for inspiration in terms of organization and documentation.


Submission

  • Write your answers in a Microsoft Word document, and when you're done, save it as a PDF document. See this Microsoft page for information on how to do this.
  • Make sure you write your name at the top of the document.
  • Submit your pdf file as an attachment of a message you will mail to 103b@cs.smith.edu, with the subject final exam