Computer StudyMCQ Computer ScienceQuiz Computer ScienceUGC NET

C Programming Questions and Answers – Float Datatype

C Programming Questions and Answers – Float Datatype

 

1.The number of digits present after decimal in float is________.

a)1

b)3

c)6

d)16

View Answer

Answer:c

2.Which among the following is never possible as an output for float?

a)3.666666

b)3.666

c)3

d)None of the mentioned

View Answer

Answer:d

3.In a 32-bit compiler, which 2 types have same size?

a)char and short

b)short and int

c)int and float

d)float and double

View Answer

Answer:c 

4.What is the size of float in a 32-bit compiler?

a)1

b)2

c)4

d)8

View Answer

Answer:c 

5.Loss in precision occurs for typecasting from____________.

a)char to short

b)float to double

c)long to float

d)float to int

View Answer

Answer:d 

6.For union

union temp

{

char a;

int b;

float c;

};

The size is decided by:

a)char

b)int

c)float

d)Both (b) and (c)

View Answer

Answer:d

7.%f access specifier is used for

a)Strings

b)Integral types

c)Floating type

d)All of the mentioned

View Answer

Answer:c 

8.Select the odd one out with respect to type?

a)char

b)int

c)long

d)float

View Answer

Answer:d

9.What is the output of this C code?

#include <stdio.h>

printf(“%.0f”, 2.89);

a)2.890000

b)2.89

c)2

d)3

View Answer

Answer:d  

10.What is the output of this C code?

#include <stdio.h>

int main()

{

float a = 2.455555555555;

printf(“%f”, a);

}

a)2.455555

b)2.455556

c)2.456

d)2.46

View Answer

Answer:a  

11.Which of the following % operation is invalid?

a)2 % 4;

b)2 % 4l;

c)2 % 4f;

d)Both (b) and (c)

View Answer

Answer:c 

12.Which data type is suitable for storing a number like?

10.0000000001

a)int

b)float

c)double

d)Both (b) and (c)

View Answer

Answer:c  

13.Modulus for float could be achieved by?

a)a % b

b)modulus(a, b);

c)fmod(a, b);

d)mod(a, b);

View Answer

Answer:c 

14.Predict the data type of the following mathematical operation?

2 * 9 + 3 / 2 . 0

a)int

b)long

c)float

d)double

View Answer

Answer:d 

15.%lf is used to display

a)float

b)long float

c)double

d)All of the mentioned

View Answer

Answer:c

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button