Study Guides (248,169)
CMPT 120 (36)
Midterm

# sampleMidtermSol.pdf

6 Pages
271 Views

School
Department
Computing Science
Course
CMPT 120
Professor
Salahuddin Muntaseer
Semester
Summer

Description
CMPT120 – Introduction to Computing Science and Programming I Instructor: Muntaseer Salahuddin Midterm Exam: Spring 2013 Total Points: 40 Total Time: 90 minutes Last Name: _______________________________________________ First Name: _______________________________________________ English Name (if applicable):_________________________________ Student ID: _______________________________________________ Signature (Bank Signature): __________________________________ INSTRUCTIONS: • Please fill in the information above very clearly. • Do not open this test booklet until instructed to do so. • Show all your workings. Failure to show workings will result in a 0 for that question, regardless if the answer is correct. • Please write all your answers in this booklet. You will not be given any extra pages to write your answers. There is one empty page at the end in case you need to make draft notes. • There is partial marking where appropriate, so answer as much as you can. • There are 5 questions in total. • Good luck! 1. Perform -4)10- 60)10in a 7 bit binary 2’s complement system. Also indicate whether this is a case of OVERFLOW or NO OVERFLOW and mention why. [5 points] Carry-> 11111000 1111100 = -4) 10 1000100 = -60) 10 ----------------- 1000000 = -64) [special case] 10 This is a case of IGNORE CARRY as the carry-in to the MSB (1) is the same as the carry-out of the MSB (1) 2. Given that we are working in a 6 bit 2's complement system, state how many integers may be represented by this system as well the largest and smallest positive and negative integers that may be represented by this system. [5 points] 8 2 = 256 so 256 numbers may be represented. Half positive and half negative so 128 positive and 128 negative. Largest positive: +127 Smallest positive: +0 Largest negative: -1 Smallest negative: -128 2 3. Draw a flow-chart that takes an input positive integer N and outputs all its factors and also the count of number of factors it has. For example, if N=10 then its factors are 1,2,5 and it has 3 factors. If N=12 then its factors are 1,2,3,4,6 and it has 5 factors.
More Less

Related notes for CMPT 120
Me

OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Join to view

OR

By registering, I agree to the Terms and Privacy Policies
Just a few more details

So we can recommend you notes for your school.