C Programming – Float Datatype

C Programming - Float Datatype

Question 1
 The number of digits present after decimal in float is________.
A
1
B
3
C
6
D
16
Question 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
Question 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
Question 4
 What is the size of float in a 32-bit compiler?
A
1
B
2
C
4
D
8
Question 5
 Loss in precision occurs for typecasting from____________.
A
char to short
B
float to double
C
long to float
D
float to int
Question 6
For union
    union temp
    {
    char a;
    int b;
    float c;
    };
A
char
B
int
C
float
D
Both (b) and (c)
Question 7
%f access specifier is used for
A
Strings
B
Integral types
C
Floating type
D
All of the mentioned
Question 8
 Select the odd one out with respect to type?
A
char
B
int
C
long
D
float
Question 9
What is the output of this C code?
    #include 
    printf("%.0f", 2.89);
A
2.890000
B
2.89
C
2
D
3
Question 10
What is the output of this C code?
    #include 
    int main()
    {
    float a = 2.455555555555;
    printf("%f", a);
    }
A
2.455555
B
2.455556
C
2.456
D
2.46
Question 11
 Which of the following % operation is invalid?
A
2 % 4;
B
2 % 4l;
C
2 % 4f;
D
Both (b) and (c)
Question 12
Which data type is suitable for storing a number like?     10.0000000001
A
int
B
float
C
double
D
Both (b) and (c)
Question 13
Modulus for float could be achieved by?
A
a % b
B
modulus(a, b);
C
fmod(a, b);
D
mod(a, b);
Question 14
 Predict the data type of the following mathematical operation?     2 * 9 + 3 / 2 . 0
A
int
B
long
C
float
D
double
Question 15
%lf is used to display
A
float
B
long float
C
double
D
All of the mentioned


Check Your Answers:

  1. C
  2. D
  3. C
  4. C
  5. D
  6. D
  7. C
  8. D
  9. D
10. A
11. C
12. C
13. C
14. D
15. C


SHARE

Unknown

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment