Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
E1: Exam#1: Written


1. E1: Exam#1
38: Exam#1: Written , Name: ___________________________

2. Question 1 (25 points). Binary numbers and base conversion
On the left half of the page, write the numbers from 0 to 15, one per line. Do this in binary (left most column), hexadecimal (middle column), and decimal (rightmost column). Include the appropriate suffix for each number.

You will be given a decimal number in the range of 0 to 255. On the right part of the page, convert that number to base 2 and base 16 representation, including the appropriate suffix for each number. Clearly indicate each answer by drawing a box around just the answer for each part.

3. Question 2 (25 points). Truth table, tree, assignment statements
You will be provided a logical expression.

For the logical expression provided, construct an extended truth table, as done in class and as appears in the notes. Above the extended truth table, draw a tree for the logical expression, as done in class. Order the possible values for the variables in the expression as done in class using a binary ordering. Add a label (variable name) for each operator node, starting with a and the left and continuing to the right.

Below the extended truth table, write the assignment statements, using the variable name labels for the operators, that, given values for the logical variables, will calculate the values of all interior nodes.

4. Question 3 (25 points). Programs writing programs
Pick any 3 different programming languages. Write a program in language 1 that writes a program in language 2 that writes a program in language 3 that outputs the text "CS340".

5. Question 4 (25 points). Postfix code
Use the provided postfix code and values for the variables in the postfix code. The variable values to be used will be provided. (Note: This was done in class when the exam was given and this text added after the exam).

6. Question 5 (25 points). Tree traversal
Given a tree in prefix form and only containing variables and the NAND "!&" binary operator, write a tree traversal routine in a programming language of your choice (except JavaScript) to do an output or transformation which will be one of the following. Note: The tree traversal code should be based on the JavaScript tree traversal code covered in class (and in the notes), except that this problem is simplified in that both integer literals and unary operators are omitted in this problem.

7. Question 6 (25 points). Language history
During class time, we covered the background and history of the following programming languages.

Pick language#1 from the following group. Pick language#2 from the following group. Write a short essay of no more than one page as follows.

First paragraph/sentence: Identify the two languages picked and that you are comparing.

For each of the two languages, write a short paragraph that contains the following. The creator of the language, the time frame it was created, some of the goals of that language, and some good points and some bad points of that language.

Last paragraph/sentence: Write a summary of what you have discussed.

8. Scoring rubric

CS 340 - E1 : Exam#1: Written Your grade: _ / 150    [LATE] Late or redo penalty: _ / -150    1. [Q1] Binary numbers and base conversion: _ / 25    2. [Q4] Truth table, tree assignment statements: _ / 25    3. Programs writing programs: _ / 25    4. Postfix code: _ / 25    5. Tree traversal: _ / 25    6. Language history: _ / 25    [CREDIT] Extra credit: _ / +30 Comments: