sample-final - CS 211 Final 100 points 45 extra credit points Instructor Prof Santosh Nagarakatte Full Name Here RUID NETID Instructions Write your Name

sample-final - CS 211 Final 100 points 45 extra credit...

This preview shows page 1 - 4 out of 15 pages.

CS 211: Final 100 points + 45 extra credit points Instructor: Prof. Santosh Nagarakatte Full Name Here: RUID: NETID: Instructions: Write your Name, RUID, NetID. If don’t write it, you get zero. Exam is closed book. You are allowed one cheat sheet. You are not allowed to use any electronic devices. Show as much work as you can. Partial credit is possible only when the intermediate steps are shown. Regular Final Points Question Max Points Points 1 20 2 20 3 25 4 35 Extra Credit Problems Question Max Points Points 1 20 2 10 3 15 SAS Assessment Questions Question Max Points Points A (2.1) 10 B (3.1) 15 C (4.1-4.3) 6 1
Image of page 1
Problem 1: Data Representation + C Programming (20 points) 1. (8 points) Convert the following positive numbers to corresponding binary, decimal and hexadecimal format. Binary Decimal Hexadecimal 1010 1F Binary Decimal Hexadecimal 11011.101 A.C 2. (3 points) Represent -8.25 in IEEE 754 format. 3. (5 points) Complete a C function below which checks if the n -th bit is 1 in a 64-bit number (size t data type on a 64-bit machine) The function returns 1 if the n-th bit is 1 in the number and 0 otherwise. The argument specifying the n -th bit named nbit below ranges from 1 to 63. Hint: it is likely one line of code. Explain your intuition in 2 sentences. int check_bit(size_t number, int nbit){ int condition = .... return condition; } 2
Image of page 2
4. (4 points) You are creating a 6-bit representation of an integer. (a) What is the maximum value in two’s complement 6-bit integer representation? (b) What is the minimum value in two’s complement 6-bit integer representation? (c) What is the maximum value in one’s complement 6-bit integer representation?
Image of page 3
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture