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 »

View more »
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
52 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
March
January
February
March
April
May
June
July
August
September
October
November
December
2025
2025
2026
2027
SunMonTueWedThuFriSat
23
24
25
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30