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

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

View Full Document Right Arrow Icon
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
Image of page 1

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

View Full Document Right Arrow Icon
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
Image of page 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 common error: the priority of operators. ** has higher priority than +.
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern