Test1-Solutions

# Test1-Solutions - CS 303E (Mitra) Test 1 Fall 2010 Last...

This preview shows pages 1–4. Sign up to view the full content.

CS 303E (Mitra) Test 1 Fall 2010 Last Name:____________________________________________ First Name:____________________________________________ UT EID: ____________________________ Section 52220: MWF 1200 - 0100 Section 52225: MWF 0200 - 0300 Section: __________________________ Question # Score Question # Score 1 / 10 5 / 10 2 / 15 6 / 20 3 / 15 7 / 20 4 / 10 8 / 5 Total / 100 1

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

View Full Document
Ques 1. (10 pt) a) Convert 109 in decimal to binary and hexadecimal. 109 10 = 1101101 2 = 6D 16 b) Use the result above to express -109 in 2’s complement 8-bit binary representation -109 10 = 10010011 Ques 2. (15 pt) Define variables from the following descriptions. The variables should have a descriptive name and a value. a) The human body temperature of 98.4. bodyTemp = 98.4 b) The number of inches in a yard (1 yard = 3 feet, 1 foot = 12 inches) inches = 36 c) The speed limit in a school zone (20 m.ph.) speedLimit = 20 d) The name of UT’s mascot mascot = "Bevo" e) The result of determining if 123 is a prime number or not. isPrime = False 2
Ques 3. (15 pt) Suppose a, b, c, d are integer variables initialized to 2, 4, 3, and 1 respectively. The ASCII code for ‘0’ is 48, ‘A” is 65, and ‘a’ is 97. Evaluate the following expressions: i) ( (a % d) + (d % a) ) ** (b / a) + (c / d) = (0+1)**2 + 3 = 4

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/17/2010 for the course CS ANS taught by Professor Brereton during the Spring '10 term at University of Texas at Austin.

### Page1 / 7

Test1-Solutions - CS 303E (Mitra) Test 1 Fall 2010 Last...

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

View Full Document
Ask a homework question - tutors are online