test1-odd.fmCS350 Spring 2020 1/4 Test 1, Thur, 2/20/2020CS350 Spring 2020 1/4 Test 1, Thur, 2/20/2020Spring 2020, CS350 Test 1, Thur, 2/20/2020Name:Make sure you have four pages. Do not...

1 answer below »
I have attached 3 Tests below and some notes (slides) below for reference. The purpose of this is not just the answers, but I want to learn, please include calculations and how they are doing ( that's the most important thing) I want to study for the next test and I want to see the both the calculations and notes as part of this submission.
Please do help me understand. I really appreciate your work and effort for helping me learn and hoping that you prepare me well for my exam.



Thank you.



test1-odd.fm CS350 Spring 2020 1/4 Test 1, Thur, 2/20/2020 CS350 Spring 2020 1/4 Test 1, Thur, 2/20/2020 Spring 2020, CS350 Test 1, Thur, 2/20/2020 Name: Make sure you have four pages. Do not take any page(s) with you. Any missing page(s) will result in failure in the exam. This exam is closed book close notes. Do not exchange anything during the exam. You all have the same exam. No questions will be answered during the exam, including typos. I don’t want to give different answers to different people. If you are in doubt, briefly state your assumptions below, including typos if any. Make sure you are sitting at the designated seat. Make sure you are holding your exam, not someone else’s. You may not go to the restroom. I have read and understood all of the instructions above. On my honor, I pledge that I have not violated the provisions of the NJIT Academic Honor Code. Signature: Date: 1. (6 points) Fill the table with =0, !=0, >0, >=0, <0,><=0, n/a="" (none="" of="" the="" above).="" pick="" the="" closest="" one.="" 2.="" (4="" points)="" when="" the="" following="" loop="" is="" executed:="" for="" (i=""><10;i++) d="fun(i);" what="" is="" the="" earliest="" itera-="" tion="" that="" can="" start="" triggering="" "segmentation="" fault="" (core="" dumped)"="" when="" compiled="" without="" stack="" protec-="" tor?="" answer:="" _______________="" question="" answer="" question="" answer="" for="" float="" f="40000.0," f*f?="" for="" int="" i="40000," i*i?="" for="" float="" f="60000.0," f*f?="" for="" int="" i="60000," i*i?="" for="" float="" f="80000.0," f*f?="" for="" int="" i="80000," i*i?="" typedef="" struct="" {="" float="" x[3];="" int="" y;="" }="" struct_t;="" double="" fun(int="" i)="" {="" volatile="" struct_t="" s;="" s.y="314;" s.x[i]="1.073741824;" return="" s.y;="" }="" cs350="" spring="" 2020="" 2/4="" test="" 1,="" thur,="" 2/20/2020="" cs350="" spring="" 2020="" 2/4="" test="" 1,="" thur,="" 2/20/2020="" 3.="" (10="" points)="" fill="" in="" the="" table="" for="" bit="" and="" logical="" operations:="" 4.="" (8="" points)="" fill="" in="" with=",">, >=, <,><=, n/a="" for="" the="" relationship="" between="" a="" and="" b:="" 5.="" (4="" points)="" fill="" in="" with="," !=",">, >=, <,><=, n/a="" for="" the="" relationship="" between="" a="" and="" b:="" 6.="" (11="" points)="" consider="" a="" 6-bit="" two’s="" complement="" representation.="" fill="" in="" the="" empty="" boxes="" in="" the="" following="" table.="" addition="" and="" subtraction="" should="" be="" performed="" based="" on="" the="" rules="" for="" 6-bit,="" two’s="" complement="" arithmetic.="" tmin="" refers="" to="" the="" two’s="" complement="" minimum="" while="" tmax="" refers="" to="" the="" two’s="" comple-="" ment="" maximum.="" question="" answer="" in="" hexa="" question="" answer="" in="" hexa="" ~0x11="" !0x11="" ~0xff="" !0xff="" 0x96="" ^="" 0x96="" !!0x11="" 0x96="" &="" 0x96="" 0xf0="" &&="" 0x0f="" 0x96="" |="" 0x96="" 0xf0="" ||="" 0x0f="" value="" a="" a="" b="" value="" b="" 0="" 0u="" -1="" 0u="" 2147483647="" -2147483648="" 2147483647u="" -2147483648="" -1="" -2="" (unsigned)-1="" -2="" 2147483647="" 2147483648u="" 2147483647="" (int)2147483648u="" value="" a="" a="" b="" value="" b="" for="" unsigned="" int="" uix="12," uiy="34," uiz="56;" (uix+uiy)+uiz="" uix+(uiy+uiz)="" for="" int="" six="12," siy="34," siz="56;" (six+siy)+siz="" six+(siy+siz)="" for="" float="" fx="1.00e+20," fy="-1.00e+20," fz="3.14;" (fx+fy)+fz="" fx+(fy+fz)="" (fx+fz)+fy="" fx+(fz+fy)="" cs350="" spring="" 2020="" 3/4="" test="" 1,="" thur,="" 2/20/2020="" cs350="" spring="" 2020="" 3/4="" test="" 1,="" thur,="" 2/20/2020="" 7.="" (10="" points)="" derived="" from="" saturating_add="" of="" hw2="" problem="" 6,="" fill="" in="" the="" c="" statements="" to="" compute="" neg-="" ative="" overflow="" flag="" using="" only="" bit="" operators="" including="" &,="" |,="" ~,="">>, <. do="" not="" use="" any="" logical="" operators="" such="" as="" &&,="" ||,="" !.="" use="" the="" following="" variables="" only,="" given="" x="" and="" y="" are="" passed="" as="" parameters:="" int="" sum="x" +="" y,="" int_len_less_1=""><3)-1; int="" sum_mask,="" x_mask,="" y_mask,="" overflow="" sum_mask="___________________________________;" *="" to="" find="" if="" sum="" overflows/underflows="" */="" x_mask="_____________________________________;" *="" to="" find="" if="" x="" overflows/underflows="" */="" y_mask="_____________________________________;" *="" to="" find="" if="" y="" overflows/underflows="" */="" overflow="____________________________________________________________;" 8.="" (20="" points)="" for="" signed="" and="" unsigned="" addition,="" fill="" in="" the="" following="" table="" for="" w="5:" number="" decimal="" representation="" binary="" representation="" n/a="" -15="" n/a="" 011000="" n/a="" 101000="" tmin="" -="" 1="" tmin="" tmax="" tmax="" +="" 1="" type="" x="" y="" x="" +="" y="" x="" +="" t5="" y="" indicate="" overflow,="" underflow,="" n/a="" (a)="" integer="" binary="" 01101="" 00101="" 10010="" 10010="" (b)="" integer="" binary="" 00011="" 00100="" 00111="" 00111="" (c)="" integer="" binary="" 11000="" 00111="" 11111="" 11111="" (d)="" integer="" binary="" 10111="" 11001="" 110000="" 10000="" (e)="" integer="" binary="" 10101="" 10010="" 10111="" 00111="" cs350="" spring="" 2020="" 4/4="" test="" 1,="" thur,="" 2/20/2020="" cs350="" spring="" 2020="" 4/4="" test="" 1,="" thur,="" 2/20/2020="" 9.="" (12="" points)="" assume="" 8-bit="" floats,="" where="" bit="" 7="" (the="" most="" signifincant="" bit)="" is="" the="" sign="" bit,="" bits="" 3-6="" are="" expo-="" nents,="" and="" the="" rest="" (bits="" 0-2)="" are="" the="" significand.="" fill="" in="" the="" table="" below="" when="" converting="" decimal="" values="" to="" floats:="" 10.="" (15="" points)="" consider="" the="" following="" 6-bit="" floating="" point="" representation.="" for="" denomarlized="" numbers,="" actual="" exponent="" is="" 1="" -="" bias.="" for="" nomarlized="" numbers,="" actual="" exponent="" is="" e="" -="" bias="" and="" the="" implied-1="" rule="" applies.="" fill="" in="" the="" table="" below.="" you="" do="" not="" need="" to="" fill="" in="" entries="" marked="" “---”="" value="" in="" decimal="" value="" in="" binary="" before="" rounding="" with="" binary="" point="" exp="" in="" decimal="" after="" rounding="" with="" binary="" point="" adjusted="" exp="" result="" in="" decimal="" 37="" 38="" 127="" 256="" type="" sign="" exponent="" e="" fraction="" m="" actual="" exponent="" value="" ---="" 0="" 000="" 00="" ---="" denomarlized="" actual="" exponent="1" -="" bias="" 0="" 000="" 01="" 0="" 000="" 10="" 0="" 000="" 11="" nomarlized="" actual="" exponent="E" -="" bias="" 0="" 001="" 00="" 0="" 001="" 01="" 0="" 001="" 10="" 0="" 110="" 01="" 0="" 110="" 10="" 0="" 110="" 11="" ---="" 0="" 111="" 00="" ---="" ---="" 0="" 111="" 01="" ---="" 0="" 111="" 10="" ---="" 0="" 111="" 11="" ---="" test1-v3.fm="" cs350="" spring="" 2022="" 1/4="" test="" 1,="" thur,="" 2/17/2022="" cs350="" spring="" 2022="" 1/4="" test="" 1,="" thur,="" 2/17/2022="" spring="" 2022,="" cs350="" test="" 1,="" thur,="" 2/17/2022="" name:="" make="" sure="" you="" have="" four="" pages.="" do="" not="" take="" any="" page(s)="" with="" you.="" any="" missing="" page(s)="" will="" result="" in="" failure="" in="" the="" exam.="" this="" exam="" is="" closed="" book="" close="" notes.="" do="" not="" exchange="" anything="" during="" the="" exam.="" you="" all="" have="" the="" same="" exam.="" no="" questions="" will="" be="" answered="" during="" the="" exam,="" including="" typos.="" i="" don’t="" want="" to="" give="" different="" answers="" to="" different="" people.="" if="" you="" are="" in="" doubt,="" briefly="" state="" your="" assumptions="" below,="" including="" typos="" if="" any.="" make="" sure="" you="" are="" sitting="" at="" the="" designated="" seat.="" make="" sure="" you="" are="" holding="" your="" exam,="" not="" someone="" else’s.="" you="" may="" not="" go="" to="" the="" restroom.="" i="" have="" read="" and="" understood="" all="" of="" the="" instructions="" above.="" on="" my="" honor,="" i="" pledge="" that="" i="" have="" not="" violated="" the="" provisions="" of="" the="" njit="" academic="" honor="" code.="" signature:="" date:="" 1.="" (20="" points)="" consider="" a="" 7-bit="" two’s="" complement="" representation.="" fill="" in="" the="" empty="" boxes="" in="" the="" following="" table.="" addition="" and="" subtraction="" should="" be="" performed="" based="" on="" the="" rules="" for="" 7-bit,="" two’s="" complement="" arithmetic.="" tmin="" refers="" to="" the="" two’s="" complement="" minimum="" while="" tmax="" refers="" to="" the="" 7-bit="" two’s="" complement="" maximum.="" number="" decimal="" representation="" binary="" representation="" n/a="" 1100011="" n/a="" 0110000="" tmax="" +="" 1="" -tmax="" tmax="" +="" tmax="" tmax="" -tmin="" tmin+1="" tmin="" +="" tmin="" tmin="" tmin="" -="" 1="" cs350="" spring="" 2022="" 2/4="" test="" 1,="" thur,="" 2/17/2022="" cs350="" spring="" 2022="" 2/4="" test="" 1,="" thur,="" 2/17/2022="" 2.="" (20="" points)="" we="" are="" running="" programs="" on="" a="" machine="" with="" the="" following="" characteristics:="" •="" values="" of="" type="" int="" are="" 32="" bits.="" they="" are="" represented="" in="" two’s="" complement,="" and="" they="" are="" right="" shifted="" arithmetically.="" values="" of="" type="" unsigned="" are="" 32="" bits.="" •="" values="" of="" type="" float="" are="" represented="" using="" the="" 32-bit="" ieee="" floating="" point="" format,="" while="" val-="" ues="" of="" type="" double="" use="" the="" 64-bit="" ieee="" floating="" point="" format.="" we="" generate="" arbitrary="" values="" x,="" y,="" and="" z,="" and="" convert="" them="" to="" other="" forms="" as="" follows:="" *="" create="" some="" arbitrary="" values="" */="" int="" x="random();" int="" y="random();" int="" z="random();" *="" convert="" to="" other="" forms="" */="" unsigned="" ux="(unsigned)" x;="" unsigned="" uy="(unsigned)" y;="" double="" dx="(double)" x;="" double="" dy="(double)" y;="" double="" dz="(double)" z;="" for="" each="" of="" the="" following="" c="" expressions,="" you="" are="" to="" indicate="" whether="" or="" not="" the="" expression="" always="" yields="" 1.="" if="" so,="" circle="" “y”.="" if="" not,="" circle="" “n”.="" you="" will="" be="" graded="" on="" each="" problem="" as="" follows:="" •="" if="" you="" circle="" no="" value,="" you="" get="" 0="" points.="" •="" if="" you="" circle="" the="" right="" value,="" you="" get="" 2="" points.="" •="" if="" you="" circle="" the="" wrong="" value,="" you="" get="" -1="" points="" (so="" don’t="" just="" guess="" wildly).="" expression="" always="" true?="">-y) Y N 17*y+15*x == ((x+y)<4) +="" y-x="" y="" n="" ˜(x+y)="=" ˜x+˜y+1="" y="" n="" -(y-x)="=" ux-uy="" y="" n="" (x="">< ux)="" ||="" (x="">= 0) Y N ((x >> 1) < 1)=""><= x y n (double)(float) x == (double) x y n dx + dy == (double) (y+x) y n dx + dy + dz == dz + dy + dx y n dx * dy * dz == dz * dy * dx y n cs350 spring 2022 3/4 test 1, thur, 2/17/2022 cs350 spring 2022 3/4 test 1, thur, 2/17/2022 3. (25 points) for signed and unsigned addition, fill in the following table for w=5: 4. (15 points) consider the following 8-bit floating point representation. for denomarlized numbers, actual exponent is 1 - bias. for nomarlized numbers, actual exponent is e - bias and the implied-1 rule applies. fill in the table below. for value and increment columns, fill in only numerators. do not change the denominator 512. type x y x + y x + t5 y indicate overflow, underflow, n/a (a) integer in decimal binary 10100 10011 100111 00111 (b) integer in decimal binary 10110 11010 110000 10000 (c) integer in decimal binary 11001 00110 011111 11111 (d) integer in decimal binary 00100 00011 000111 00111 (e) integer in decimal binary 01110 00100 010010 10010 type sign exponent e fraction m actual exponent value increment denormalized actual exponent = 1 - bias 0 0000 001 /512 /5120 0000 010 /512 0 0000 011 /512 normalized actual exponent = e - bias 0 0001 000 /512 /512 0 0001 001 /512 0 0001 010 /512 0 0001 011 /512 0 0001 100 /512 0 0001 101 /512 0 0001 110 /512 0 0001 111 /512 cs350 spring 2022 4/4 test 1, thur, 2/17/2022 cs350 spring 2022 4/4 test 1, thur, 2/17/2022 5. (22 points) assume 8-bit floats, where bit 7 (the most signifincant bit) is the sign bit, bits 3-6 are exponents, and the rest (bits 0-2) are the significand. fill in the table below when convert- ing decimal values to floats. if you are unable to convert to float, write nan. 6. (22 points) consider the following 7-bit floating point representation based on the ieee float- ing point format: • there is a sign bit in the most significant bit. • the next 3 bits are the exponent. the exponent bias is 23-1 - 1 = 3. • the last 3 bits are the fraction. • the representation encodes numbers of the form: v = (-1)s ×m ×2e, where m is the signif- icand and e is the biased exponent. the rules are like those in the ieee standard (normalized, denormalized, representation of 0, infinity, and nan). fill in the table below. here are the instructions for each field: • binary: the 7 bit binary representation. • m: the value of the significand. this should be a number of the form x or x/y , where x is an integer, and y is an integral power of 2. examples include 0, 3/4 . • e: the integer value of the exponent. • value:the numeric value represented. note: you need not fill in entries marked with “---”. value in decimal value in binary fraction in binary before rounding exp in decimal fraction in binary after rounding adjusted exp in decimal result in decimal 37 40 126 256 don’t fill don’t fill description binary mmantissa e exponent value minus zero -0.0 --- 0 100 010 smallest denormalized (negative) largest normalized (positive) one 1.0 --- 1.5 positive infinity --- +¥ 2021-spring-test1.fm cs350 spring 2021 1/4 test 1, thur, 2/18/2021 cs350 spring 2021 1/4 test 1, thur, 2/18/2021 spring 2021, cs350 test 1, thur, 2/18/2021 name: make sure you have four pages. do not take any page(s) with you. any missing page(s) will result in failure in the exam. this exam is closed book close notes. do not exchange anything during the exam. you all have the same exam. no questions will be answered during the exam, including typos. i don’t want to give different answers to different people. if you are in doubt, briefly state your assumptions below, including typos if any. make sure you are sitting at the designated seat. make sure you are holding your exam, not someone else’s. you may not go to the restroom. i have read and understood all of the instructions above. on my honor, i pledge that i have not violated the provisions of the njit academic honor code. signature: x="" y="" n="" (double)(float)="" x="=" (double)="" x="" y="" n="" dx="" +="" dy="=" (double)="" (y+x)="" y="" n="" dx="" +="" dy="" +="" dz="=" dz="" +="" dy="" +="" dx="" y="" n="" dx="" *="" dy="" *="" dz="=" dz="" *="" dy="" *="" dx="" y="" n="" cs350="" spring="" 2022="" 3/4="" test="" 1,="" thur,="" 2/17/2022="" cs350="" spring="" 2022="" 3/4="" test="" 1,="" thur,="" 2/17/2022="" 3.="" (25="" points)="" for="" signed="" and="" unsigned="" addition,="" fill="" in="" the="" following="" table="" for="" w="5:" 4.="" (15="" points)="" consider="" the="" following="" 8-bit="" floating="" point="" representation.="" for="" denomarlized="" numbers,="" actual="" exponent="" is="" 1="" -="" bias.="" for="" nomarlized="" numbers,="" actual="" exponent="" is="" e="" -="" bias="" and="" the="" implied-1="" rule="" applies.="" fill="" in="" the="" table="" below.="" for="" value="" and="" increment="" columns,="" fill="" in="" only="" numerators.="" do="" not="" change="" the="" denominator="" 512.="" type="" x="" y="" x="" +="" y="" x="" +="" t5="" y="" indicate="" overflow,="" underflow,="" n/a="" (a)="" integer="" in="" decimal="" binary="" 10100="" 10011="" 100111="" 00111="" (b)="" integer="" in="" decimal="" binary="" 10110="" 11010="" 110000="" 10000="" (c)="" integer="" in="" decimal="" binary="" 11001="" 00110="" 011111="" 11111="" (d)="" integer="" in="" decimal="" binary="" 00100="" 00011="" 000111="" 00111="" (e)="" integer="" in="" decimal="" binary="" 01110="" 00100="" 010010="" 10010="" type="" sign="" exponent="" e="" fraction="" m="" actual="" exponent="" value="" increment="" denormalized="" actual="" exponent="1" -="" bias="" 0="" 0000="" 001="" 512="" 5120="" 0000="" 010="" 512="" 0="" 0000="" 011="" 512="" normalized="" actual="" exponent="E" -="" bias="" 0="" 0001="" 000="" 512="" 512="" 0="" 0001="" 001="" 512="" 0="" 0001="" 010="" 512="" 0="" 0001="" 011="" 512="" 0="" 0001="" 100="" 512="" 0="" 0001="" 101="" 512="" 0="" 0001="" 110="" 512="" 0="" 0001="" 111="" 512="" cs350="" spring="" 2022="" 4/4="" test="" 1,="" thur,="" 2/17/2022="" cs350="" spring="" 2022="" 4/4="" test="" 1,="" thur,="" 2/17/2022="" 5.="" (22="" points)="" assume="" 8-bit="" floats,="" where="" bit="" 7="" (the="" most="" signifincant="" bit)="" is="" the="" sign="" bit,="" bits="" 3-6="" are="" exponents,="" and="" the="" rest="" (bits="" 0-2)="" are="" the="" significand.="" fill="" in="" the="" table="" below="" when="" convert-="" ing="" decimal="" values="" to="" floats.="" if="" you="" are="" unable="" to="" convert="" to="" float,="" write="" nan.="" 6.="" (22="" points)="" consider="" the="" following="" 7-bit="" floating="" point="" representation="" based="" on="" the="" ieee="" float-="" ing="" point="" format:="" •="" there="" is="" a="" sign="" bit="" in="" the="" most="" significant="" bit.="" •="" the="" next="" 3="" bits="" are="" the="" exponent.="" the="" exponent="" bias="" is="" 23-1="" -="" 1="3." •="" the="" last="" 3="" bits="" are="" the="" fraction.="" •="" the="" representation="" encodes="" numbers="" of="" the="" form:="" v="(-1)s" ×m="" ×2e,="" where="" m="" is="" the="" signif-="" icand="" and="" e="" is="" the="" biased="" exponent.="" the="" rules="" are="" like="" those="" in="" the="" ieee="" standard="" (normalized,="" denormalized,="" representation="" of="" 0,="" infinity,="" and="" nan).="" fill="" in="" the="" table="" below.="" here="" are="" the="" instructions="" for="" each="" field:="" •="" binary:="" the="" 7="" bit="" binary="" representation.="" •="" m:="" the="" value="" of="" the="" significand.="" this="" should="" be="" a="" number="" of="" the="" form="" x="" or="" x/y="" ,="" where="" x="" is="" an="" integer,="" and="" y="" is="" an="" integral="" power="" of="" 2.="" examples="" include="" 0,="" 3/4="" .="" •="" e:="" the="" integer="" value="" of="" the="" exponent.="" •="" value:the="" numeric="" value="" represented.="" note:="" you="" need="" not="" fill="" in="" entries="" marked="" with="" “---”.="" value="" in="" decimal="" value="" in="" binary="" fraction="" in="" binary="" before="" rounding="" exp="" in="" decimal="" fraction="" in="" binary="" after="" rounding="" adjusted="" exp="" in="" decimal="" result="" in="" decimal="" 37="" 40="" 126="" 256="" don’t="" fill="" don’t="" fill="" description="" binary="" mmantissa="" e="" exponent="" value="" minus="" zero="" -0.0="" ---="" 0="" 100="" 010="" smallest="" denormalized="" (negative)="" largest="" normalized="" (positive)="" one="" 1.0="" ---="" 1.5="" positive="" infinity="" ---="" +¥="" 2021-spring-test1.fm="" cs350="" spring="" 2021="" 1/4="" test="" 1,="" thur,="" 2/18/2021="" cs350="" spring="" 2021="" 1/4="" test="" 1,="" thur,="" 2/18/2021="" spring="" 2021,="" cs350="" test="" 1,="" thur,="" 2/18/2021="" name:="" make="" sure="" you="" have="" four="" pages.="" do="" not="" take="" any="" page(s)="" with="" you.="" any="" missing="" page(s)="" will="" result="" in="" failure="" in="" the="" exam.="" this="" exam="" is="" closed="" book="" close="" notes.="" do="" not="" exchange="" anything="" during="" the="" exam.="" you="" all="" have="" the="" same="" exam.="" no="" questions="" will="" be="" answered="" during="" the="" exam,="" including="" typos.="" i="" don’t="" want="" to="" give="" different="" answers="" to="" different="" people.="" if="" you="" are="" in="" doubt,="" briefly="" state="" your="" assumptions="" below,="" including="" typos="" if="" any.="" make="" sure="" you="" are="" sitting="" at="" the="" designated="" seat.="" make="" sure="" you="" are="" holding="" your="" exam,="" not="" someone="" else’s.="" you="" may="" not="" go="" to="" the="" restroom.="" i="" have="" read="" and="" understood="" all="" of="" the="" instructions="" above.="" on="" my="" honor,="" i="" pledge="" that="" i="" have="" not="" violated="" the="" provisions="" of="" the="" njit="" academic="" honor="" code.="">
Answered 4 days AfterFeb 09, 2023

Answer To: test1-odd.fmCS350 Spring 2020 1/4 Test 1, Thur, 2/20/2020CS350 Spring 2020 1/4 Test 1, Thur,...

Baljit answered on Feb 10 2023
49 Votes
Spring 2020
1.
Before solving the question we should the know the maximum and minimum range of float and int in c

float :- 1.2E-38 to 3.4E+38
int:- -2,147,483,648 to 2,147,483,647 
·
For float f=40000.0, f*f?
f*f=1.6E+9 which is in the range of float and so f*f>0
· For float f=60000.0, f*f?
f*f=3.6E+9 which is in the range of float and so f*f>0
· For float f=80000.0, f*f?
f*f=6.4E+9 which is in the range of float and so f*f>0
· For int i=40000, i*i?
f*f=1.6E+9 which is in the range of int and so f*f>0
· For int i=60000, i*i?
f*f=3.6E+9 which is out of the range of int so it will give garbage value and so n/a
· For int i=80000, i*i?
f*f=6.4E+9 which is out of the range of int so it will give garbage value and so n/a
2.
Float in c has size 4 bytes so float x[3] has size of 12 bytes. So program will run correctly till x[o],x[1],x[2].So core dumped When in function trying to access x[3] in 4th iteration.
3.
Bit wise operatons
· ~0x11
~ operator is called Bitwise NOT and it inverts all the bits. 0x11 is 00010001 in binary. Now we have to just invert the bits from 0 to 1 and 1 to 0.
00010001 → 11101110
11101110 is EE in hexadecimal so our final answer is : 0xEE .
· ~0xFF
we have to perform Bitwise NOT operation. 0xFF is 11111111 in binary.
11111111 → 00000000
00000000 is 00 in hexadecimal so our final answer is : 0x00
· 0x96 ^ 0x96
Now we have to perform Bitwise XOR operation. Bitwise XOR will return 1 if both the bits are different otherwise it will return 0. We are performing this operation on 0x96 and 0x96, as both the numbers are same so Bitwise XOR will return 00000000
00000000 is 00 in hexadecimal so our final answer is : 0x00
· 0x96 & 0x96
Here we have are performing Bitwise AND operation. Bitwise AND will return 1 if both the bits are 1 otherwise it will return 0. We are performing this operation on 0x96 and 0x96, as both the numbers are same so Bitwise AND will return...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here