Download 1(SOLUTIONS) - GEHU CS/IT Deptt

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
TUTORIAL -1(SOLUTIONS)
COMPUTER ORGANISATION
IT-IV SEM
(TIT-402)
Prepared by: Mr.Dilip Kumar gangwar
Faculty,CS/IT Deptt(GEHU),Dehradun
Q1.(43)10 = ( ? )2’s
(GATE 2000)
a)01010101 b)11010101 c)00101011 d)10101011
Q2.The 2’s complement representation of (-539)10 in hexadecimal is (GATE
2001)
a)ABE B)DBC c)DE5 d) 9E7
Q3. The decimal value 0.25 (GATE 2002)
(a) is equivalent to the binary value 0.1
(b) is equivalent to the binary value 0.01
(c) is equivalent to the binary value 0.00111…
(d) cannot be represented precisely in binary
Q4. The 2’s complement representation of the decimal value –15 is (GATE
2002)
(a) 1111 (b) 11111 (c) 111111 (d) 10001
Q5. In 2’s complement addition, overflow (GATE 2002)
(a) is flagged whenever there is carry from sign bit addition
(b) cannot occur when a positive value is added to a negative value
(c) is flagged when the carries from sign bit and previous bit match
(d) None of the above
Q6. Assuming all numbers are in 2’s complement representation, which of the
following numbers is divisible by 11111011?
(A)11100111 (B) 11100100 (C) 11010111 (D) 11011011
Q7. Find the following differences using twos complement arithmetic:
a.
110011 - 111000
All numbers are in 2’s complement form
(110011)2s= -(001100+1)= -(12+1)= -13
(111000)2s = -(000111+1)=-(7+1)= -8
i.e we are given -13 - -8 which is equal to -13+8=-5
now
110011 + (-111000)
convert 111000 in 2s complement form=-(000111+1)=-(001000)
110011
+ 001000
11101 1 =now it is in 2s form so convert it
(111011)2s=-(000100+1)=-(000101)=-5
b.
101110 - 11001100=00101110-11001100
(11001100)2s=-(00110011+1)=-(00110100)=-52
 00101110 =46
 46 - -52=46+52=98
Now
00101110 =46
00110100 =52
0110001 0 =98
c.
110011110011 - 111100001111
110011110011=-(001100001100+1)=-(001100001101)=-781
111100001111=-(000011110000+1)=-(000011110001)=-241
-781 - -241=-781 + 241=-540
110011110011
000011110001
110111100100 = -(001000011011+1)=-(001000011100)=-540
d.
11101000- 11000011
11000011=-(00111101)
11101000
00111101
00100101 =37
Q8. Is the following a valid alternative definition of overflow in twos
complementarithmetic?
If the exclusive-OR of the carry bits into and out of the leftmost column is 1,
then there is an overflow condition. Otherwise, there is not.
Ans:Yes,because on different bits ,xor gate gives result as 1 so if carry out and
carr in are different that it can be checked by their xoring .If result=0 then no
overflow otherwise there is overflow
Q9. Represent the following twos complement values in decimal:
1101011=-21
0101101=47
Q10. Represent the following decimal numbers in both binary sign/magnitude
and twos complement using 16 bits 1) +401 2) -14
1)401
sign/magnitude form=0000 0001 1001 0001
twos complement form=1111 1110 0110 1111
2)-14
sign/magnitude form=1000 0000 0000 1110
twos complement form=1111 1111 1111 0010
Q11.the unsigned (1011011)2 =( ? )10
a)63 b)91 c) 92 d)13
Q12.Which has the largest value?
A)(110)10 b) ( 10011011)2 c)(1111)2 d)(9A)16 e) (222)8
Q13.What is the weight of digit 3 in base 7 number 12345?
a)3 b)5 c)7 d)14 e)49
Q14.if (321)4=(57)10 What is the decimal equivalent of (32100000)4
a)57 x 105 b) 57 x 104 c) 57 x 45 d) 57 x 410
ans: (32100000)4 =(321)4 x 45
=57 x 45
Q15. The unsigned binary number (110001)2 is equal to ( ? )8
a)49 b)61 c)31 d)15 e)None of the above
Q16.In 6 bit 1’s complement binary no system ,what is the decimal value
represented by
(010100)1s
a)-11 b)43 c)-43 d)20 e)-20
Q17.In 6 bit 2’s complement binary no system ,what is the decimal value
represented by
(100100)2s
a)-4 b)36 c)-36 d)-27 e)-28
Q18.For 2’s complement binary number,the range of values for 5 bit numbers is
a)0 to 31 b) -8
to +7 c)-8 to -8 d) -15 to -15 e) -16 to +15
Q19.For 4 bit 2s complement scheme,what is the result of this
(1011)2s + (1001)2s
1011 =-5
1001 = -7
1010 0 =4
a.0100 b. 0010 c. 1100 d.1001 e.overflow
Q20. (1217)8 is equivalent to
(GATE 2009)
(A) (1217)16
(B) (028F)16
(C) (2297)10
(D) (0B17)16
Q21. If 73x (in base x number system)=54y, (in base y number system) ,then
possible values of x and y are a)8,16 b)10 ,12 c) 9,13 d)8,11 (GATE 2004)
Ans:
7 x x1 +3 x x0 = 75 x y1 +4 x y0
7 x +3 = 75 y +4
Putting values of x and y from options,by hit and trial method
We get x=8,y=11
Q22.Let A=1111 1010 and B=0000 1010 be two 8 bit 2’s complement
no’s.Their product in 2’s
complement is a)1100 0100 b)1001 1100 c)1010 0101 d)1101 0101 (GATE
2004)
Q23.The hexadecimal representation of (657)8 is
(GATE 2005)
a)1AF b) D78 c)D71 d)32F
Q24. how many kilobytes are accessible with a 23-bit address space?
A)2^23 KB B)2^23 Kb C)2^13 KB D)2^13Kb
Ans:addresses locations=2^23 bytes= 213 x 2 10 bytes= 213 Kbytes=213 KB
Q25. Represent each of the following using the 8-bit two's-complement integer
representation.
a. 10(10)=0000 1010
b. −60(10) = 1100 0100
c. −104(10) = 1001 10000
Q26. For the following, assume a six-bit two's-complement representation of
integers.
a. What numeric value does 110110 represent? = -10
b. What numeric value does 010101 represent?= 21
c. What bit pattern is used to represent −12(10)? = 110100
Q27. a. What is the smallest (most negative) number you can represent in seven
bits using sign magnitude representation? Give both the bit pattern of the
number and its base-10 translation.
Ans:smallest (most negative) number in 7 bit in sign magnitude format:
1 11 1111=-63
b. Answer the same question for a seven-bit two's-complement representation.
100 0000=-(64)10
Q28. What would be the bias value for
a. A base-2 exponent in a 6-bit field?=26-1 -1=31
b. A base-8 exponent in a 7-bit field? = 27-1 -1=63
Q29. It is said that a 32-bit format can represent a maximum of different
numbers.
How many different numbers can be represented in the IEEE 32-bit format?
Explain.
Done in class
Q30.Express the following numbers in IEEE 32-bit floating-point format:
a)-5 b) -6 c) -1.5 d) 384 e) 1/16 f)-1/32 G)1.0 H)-1.0 I) (438F0000)16
a)-5 = -(101)= -(1.01) x 2^2
exponent bits=2+127=129
1 10000001
0100000…00000
b)-6=-(110)=-(1.10) x 2^2
exp bits=2+127=129
1 10000001 1000000……000
c)-1.5 =- (1.1)2 x 20
exp=0+127=127
1 01111111 100…..0000
d)384 = 110000000 =(1.10000000) x 2^8
exp bits=8+127=135
0 1000 0111 10000000……000
e)1/16 =0.0625 = 0.00010000 =1.0000 x 2^-4
exp bits=-4+127 = 123
0 01111011 00000…..000
f)-1/32 =0.03125 =0.00001000 =1.000 x 2^-5
exp bits =-5+127 =122
0 01111010 0000…….000
g)1.0 =(1.0)2 = 1.0 x 2^0
exp bits=0+127=127
0
01111111 000……000
h)-1.0 =
1 01111111
00000000…….000000
i)(438F0000)16
convert in binary
(0100 0011 1000 1111 0000 0000 0000 0000)2
1.00 0011 1000 1111 0000 0000 0000 0000 x 2^30
Exp bits 30+127=157= (10011101)2
0
10011101
00 0011 1000 1111 0000 0000 0
Q31. The following numbers use the IEEE 32-bit floating-point format.What is
the equivalent
decimal value?
a. 1 10000011 11000000000000000000000
b. 0 01111110 10100000000000000000000
c. 0 10000000 00000000000000000000000
ans: 1 10000011 11000000000000000000000
10000011=(131)10
Now subtract 127 from 131= 131-127=4
-(1. 11000000000000000000000 )2 x 2^4
-(11100.0000000000000000000)2 x 2^4 x 2-4
=-(11100.0000000000000000000) = (-28.0)10
b) 0 01111110 10100000000000000000000
01111110=126
Now 126-127=-1
=1.10100000000000000000000 x 2^-1
= 0.110100000000000000000000 x 2^-1 x 2 ^1
=0.110100000000000000000000=0.5+0.25+0.0625=0.8125
c) 0 10000000 00000000000000000000000
10000000=128
128-127=1
=1. 00000000000000000000000 x 2^1
=1.00000000000000000000000 x 2^1 x2^-1
=10.0000000000000000000000 = (2.0)10
Q32. Express the following numbers in IBM’s 32-bit floating-point format,
which uses a 7-bitexponent with an implied base of 16 and an exponent bias of
64 (40 hexadecimal).A normalized floating-point number requires that the
leftmost hexadecimal digit be nonzero; the implied radix point is to the left of
that digit.
Ans.LEAVE THIS QUESTIONS RIGHT NOW AS IBM HAS DIFFERENT
METHOD TO REPRESENT BINARY NUMBERS
Q33.A hypothetical computer stores floationg point numbers in 7 bits.Th e first
bit is used forsign of number,the next three for the biased exponent and the next
three for the magnitude of the mantissa.The number (0010110)2 represented in
base 10 is
a)0.375 b)0.875 c) 1.5 d) 3.5
Q34. A hypothetical computer stores floationg point numbers in 7 bits.Th e first
bit is used for sign of number,the next three for the biased exponent and the next
three for the magnitude of the mantissa.You are asked to represent 33.35 in the
above word.The error in this case would be
a)underflow b)overflow c)NaN d) No error
Q35. Consider the following 32-bit floating-point representation scheme as
shown in
the formal below. A value is specified by 3 fields, a one bit sign field (with 0 for
positive and 1 for negative values), a 24 bit fraction field (with the binary point
being at the left end of the fraction bits), and a 7 bit exponent field (in excess -64
signed integer representation, with 16 being the base of exponentiation). The
sign bit is the most significant bit.
(a) It is required to represent the decimal value –7.5 as a normalized floating
point number in the given format. Derive the values of the various fields.
Express your final answer in the hexadecimal.
(b) What is the largest values that can be represented using this format?
Express your answer as the nearest power of 10.
(GATE 2002)
ANS 35(A)
=1 01111000000000000000000
0100 0001
=1011 1100 0000 0000 0000 0000
0100 0001
=AC000081
B)LARGEST NO:
0 111………111
1111110
We take exp bits as 1111110 =(126)10 , as 1111111 is generally not valid but if
you take 1111111 then also here answer will not differ much.(as here nothing is
given whether to take 1111 111 or not.But if question is explicitly about IEEE
754 then you cannot take 1111 110)
=1.111……..11 x 16126-64 (1 is used for normalisation ,in (B) part nothing is
given about to do normalisation or not,so it is optional to do normalisation)
=
(1.111.11 )2 x 1662
=
(1.999)10 x 16 62
Converting 1662 in power of 10
We get 1662 = 1075 (nearly)
=>(1.999)10 x 1075
Q36. The following is a scheme for floating point number representation using
16 bits
(GATE2003)
Let s, e, and m be the numbers represented in binary in the sign, exponent, and
mantissa fields respectively. Then the floating point number represented is:
What is the maximum difference between two successive real numbers
representable in this system?
Ans 36:The diagram in the question paper tutorial was wrong .Above is the
correct diagram
Q37.Explain why, in a computer, floating point mathematics may not be
associative or distributive, i.e. (A+B)+C may not equal A+(B+C).
Ans:
While floating-point addition and multiplication are both commutative (a + b =
b + a and a×b = b×a), they are not necessarily associative. That is, (a + b) + c is
not necessarily equal to a + (b + c). Using 7-digit decimal arithmetic:
Due to the fixed number of bits in the mantissa, floating point
arithmetic can lose precision when small numbers are added to or
subtracted from big numbers. In the worst case, the small number
has no effect at all on the larger number. If you arrange your
mathematics so that the small numbers are added to each other
first, they stand a better chance of affecting the bigger number.
Order matters.
Q38.We use negative numbers ,positive numbers in computer,then it seems that
unsigned numbers are of no use in computer So What is the application of
unsigned numbers?
ANS: Unsigned integers are used when we know that the value that we are
storing will always be non-negative (zero or positive).
One example is:
suppose the OS want to keep the information of no of total sectors in hard disk
.Now No of sectors cannot be a negative quantity .so a programmer can use a
unsigned variable to store this information.
General Questions
Q39. If a CPU has a clock frequency of 3.2 GHz, how long (in ns) does one
access cycle take?
Ans:
Time period=1/frequency=1/3.2GHz
=(1/3.2 x 109)
=0.3125 x 10-9seconds=0.3125 nanoseconds
Q40.Are hardware and software equivalent? Can you really do anything in
hardware that you can do in software, and vice-versa? Examples?
Ans:NO .
Q41.What are the three basic-level pieces of a digital computer?
Ans:
1- processor to interpret and execute programs
2- memory to store both data and programs
3- mechanism for transferring data to and from the outside world.
Q42.Give two reasons why you can't store 12GB of system memory on a hard
drive with an advertised capacity of 12GB.
Ans: Discussed in class
The operating system needs to store name and directory information on the disk,
information about sectors etc.These information are called meta data