Assignment.0 - CS3240 ASSIGNMENT 0 Due Monday:59 p.m This...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS3240: A SSIGNMENT 0 Due: Monday January 23, 11:59 p.m. This assignment does not count towards your semester grade. General directions: * This is a closed-book, closed notes, closed calculator assignment. * The assignment is to be pledged. Part 1 Directions: * No computersfor this part of the assignment. * Prepare your solution as a PDF file and submit via Collab. Part 2 Directions: * Computers can be used for preparing and running your solution only. *
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS 3240 Page 1 P ART 1 1. What is the two’s complement representation of the following numbers. State your answer in 16-bit hexadecimal: (a) 255 (b) -255 (c) 3240 (d) -3240 (e) 65535 (f) -65535 2. The IEEE 741 floating-point standard includes the notion of a “hidden” bit. Briefly explain the idea of the hidden bit and explain why its use is possible. 3. Write the algebraic definition (i.e., do not try to enumerate the elements) of the set that con- sists of the integers between 1 and 1000 which are squares of other integers. 4. Write a predicate that is true if an integer is between 1 and 1000 and is the square of another integer. 5. Suppose a function is defined as {(1, f), (2, a),(3, f), (4, d)} where the source is the set {1, 2, 3, 4, 5} and the target is the set {a, b, c, d, e, f} (a) Is this function an injection? Why or why not? (b) Is the function a surjection? Why or why not? (c) Is the function total? Why or why not? 6. Write a recursive method that calculates the following recursive mathematical definition: public static int f(int n) { Hint: the notation x denotes the integer obtained by truncating the fractional part of x . In Java, integer division will do this. 7. Briefly explain the concept of a critical section . 8. Here is a grammar to produce an English sentence. (the numbers to the left are not part of the grammar, they are production numbers): (1) <start>:== Over break I will <verb> <object> . (2) <verb> :== <verb> and <verb> | find | buy | eat (3) <object> :== children | food | presents | <adjective> <object> (4) <adjective> :== holiday | Santa’s | small | festive Generate a sentence that is a valid statement according to this grammar using <start> as the initial symbol. Make use of at least one production for each non-terminal. Write out your sen-
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

Assignment.0 - CS3240 ASSIGNMENT 0 Due Monday:59 p.m This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online