C Programming 16

COEP
Lets Crack Online Exam

IT Interview Exam Questions: C Programming 16 (IT Interview Exam Question, IT Campus Placement)

Subject: C Programming 16

Part 16: List for questions and answers of C Language

 

Q1. What are the different types of real data type in c ?

a) Float, double

b) Short int, double, long int

c) float, double, long double

d) Double, long int, float

 

Q2. What will you do to treat the constant 3.14 as a long double?

a) Use 3.14ld

b) use 3.14l

c) Use 3.14dl

d) Use 3.14lf

 

Q3. What is the output of the below code snippet? 

Main() { for(1;2;3)printf(“hello”);}

a) infinite loop

b) Prints “hello” once

c) No output

d) Compile error

 

Q4. Which of the following range is a valid long double (turbo c in 16 bit dos os) ?

a) 3.4e-4932 to 1.1e+4932

b) 3.4e-4932 to 3.4e+4932

c) 1.1e-4932 to 1.1e+4932

d) 1.7e-4932 to 1.7e+4932

 

Q5. Which statement will you add in the following program to work it correctly? 

#include <stdio.h>

Int main()  

{

     printf(“%f\n”, log(36.0));  

     return 0;

}

a) Conio.h

b) math.h

c) Stdlib.h

d) Dos.h

 

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

a) 1

b) 3

c) 6

d) 16 

 

Q7. 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

 

Q8. 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

 

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

a) 1

b) 2

c) 4

d) 8

 

Q10. Loss in precision occurs for typecasting from____________

a) Char to short

b) Float to double

c) Long to float

d) float to int

 

Q11. 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)

 

Q12. %f access specifier is used for

a) Strings

b) Integral types

c) floating type

d) All of the mentioned 

 

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

a) Char

b) Int

c) Long

d) float

 

Q14. What is the output of this c code? Printf(“%.0f”, 2.89);

a) 2.890000

b) 2.89

c) 2

d) 3

 

Q15. 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

 

Q16. Which of the following % operation is invalid?

a) 2 % 4;

b) 2 % 4l;

c) 2 % 4f;

d) Both (b) and (c)

 

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

a) Int

b) Float

c) double

d) Both (b) and (c)

 

Q18. Modulus for float could be achieved by?

a) A % b

b) Modulus(a, b);

c) fmod(a, b);

d) Mod(a, b); 

 

Q19. Predict the data type of the following mathematical operation? 2 * 9 + 3 / 2 . 0

a) Int

b) Long

c) Float

d) double

 

Q20. %lf is used to display

a) Float

b) Long float

c) double

d) All of the mentioned 

 

Part 16: List for questions and answers of C Language

 

Q1. Answer: c

 

Q2. Answer: b

 

Q3. Answer: a

 

Q4. Answer: a

 

Q5. Answer: b

 

Q6. Answer: c

 

Q7. Answer: d

 

Q8. Answer: c

 

Q9. Answer: c

 

Q10. Answer: d

 

Q11. Answer: d

 

Q12. Answer: c

 

Q13. Answer: d

 

Q14. Answer: d

 

Q15. Answer: a

 

Q16. Answer: c

 

Q17. Answer: c

 

Q18. Answer: c

 

Q19. Answer: d

 

Q20. Answer: c