Question: Task 2: Finding data ranges in a simple program (4 marks) We learned numeric ranges in Week 2 for different data types. A sample C

 Task 2: Finding data ranges in a simple program (4 marks)

Task 2: Finding data ranges in a simple program (4 marks) We learned numeric ranges in Week 2 for different data types. A sample C code is given below which you can compile and get results. You need to answer questions as provided below. \#include \#include int main() \{ int intType; float floatType; double doubleType; float x=10.327; int y=2147483647; int y1 = 2147483648; printf("The float value : \%f(n", x ); printf("The int value : \% d ,y); printf("The int value : %d ", y1); printf("Size of int: \%zu bytes \ "", sizeof(intType)); printf("Size of float: \%zu bytes ", sizeof(floatType)); printf("Size of double: \%zu bytes \ n", sizeof(doubleType)); return 0 ; \} Q1: Considering what we learned in Week2, what results you are getting for variable y and y1? Explain, why these two values are different? Q2: What float value was displayed when you compile this code and why? What does float correspond to in IEEE 754 format and what determines the total number of decimal places? Explain

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!