C Programming 13

COEP
Lets Crack Online Exam

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

Subject: C Programming 13

Part 13: List for questions and answers of C Language

 

Q1. Which of the following operator takes only integer operands?

a) +

b) *

c) /

d) %

 

Q2. Pick the operator that not associates from the left?

a) +

b) –

c) =

d) is greater than

 

Q3. Pick the operator that not associates from the right?

a) ?:

b) +=

c) =\

d) !=

 

Q4. Which of the following comment about the ++ operator are correct?

a) It is unary operator

b) The operand can come before or after the operator

c) It cannot be applied to an expression

d) All of above

 

Q5. Which bitwise operator is suitable for turning off a particular bit in a number?

a) && operator

b) & operator

c) || operator

d) ! operator

 

Q6. Which bitwise operator is suitable for turning on a particular bit in a number?

a) && operator

b) & operator

c) || operator

d) | operator 

 

Q7. Which bitwise operator is suitable for checking whether a particular bit is on or off?

a) && operator

b) & operator

c) || operator

d) ! operator

 

8. For which of the following, “PI++;” code will fail?

a) #define PI 3.14

b) char *PI = “A”;

c) float PI = 3.14;

d) None of the Mentioned

 

Q9. Assunming, integer is 2 byte, What will be the output of the program? 

#include <stdio.h>

int main() 

   {

     printf(“%x\n”, -1>>1); 

     return 0; 

   }

a) ffff

b) 0fff

c) 0000

d) fff0

 

Q10. If an unsigned int is 2 bytes wide then, What will be the output of the program ?

 #include <stdio.h>

    int main()

  {

     unsigned int m = 32;

      printf(“%x\n”, ~m);

     return 0;

  }

a) ffff

b) 0000

c) ffdf

d) ddfd

 

Q11. Which of the following is not a compound assignment operator?

a) /=

b) +=

c) %=

d) ==

 

Q12. What will be the output of the following code snippet?

Y = 5;if (! Y > 10) 

X = Y + 3; else

X = Y + 10;

printf(“ X = %d Y = %d”, X, Y);

a) The program will print X = 15 Y = 5

b) The program will print X = 15 Y = 0

c) The program will print X = 8 Y = 5

d) The program will print X = 3 Y = 0 

 

Q13. Which of the following statement is correct about the code snippet given below? 

num = 5;printf( “%d”, ++num++ );

a) The code will print 5

b) The code will print 6

c) The code will result in L – value required

d) The code will result in R – value required

 

Q14. Which of the following statement is correct about the code snippet given below?

#include < stdio.h> 

int main() 

float z = 12.35, c = 10; 

if( ++z%10 –z)

c += z;  

else 

– = z; 

printf( “%f %f”, z, c); 

return 0; 

}

a) The program will result in compile time error

b) The program will print 12.35 22.35

c) The program will print 13.35 22.35

d) The program will print 1.35 11.35

 

Q15. Choose correct option about the code snippet given below?

#include < stdio.h> 

int main() 

int n = 12, k; 

printf(“%d”, (k = sizeof( n + 12.0))++); 

return 0; 

a) The code will print 17

b) The code will print 5

c) The code will result compile time error

d) The code will print 4

 

Q16. Which is executed quickly?

a) ++p

b) P++

c) Both

d) P+1

 

Q17. What is the value of X in the sample code given below? double X; X = ( 2 + 3) * 2 + 3;

a) 10

b) 13

c) 25

d) 28

 

Q18. Which of the following is the better approach to do the operation i = i * 16?

a) Multiply I by 16 and keep it

b) Shift left by 4 bit

c) Add I 16 times

d) Shift right by 4 bit 

 

Q19. What is the similarity between a structure, union and enumeration?

a) All of them let you define new values

b) All of them let you define new data types

c) All of them let you define new pointers

d) All of them let you define new structures

 

Q20. Which header file should be included to use functions like malloc() and calloc()?

a) memory.h

b) stdlib.h

c) string.h

d) dos.h 

 

Part 13: List for questions and answers of C Language

 

Q1. Answer: d

 

Q2. Answer: c

 

Q3. Answer: d

 

Q4. Answer: d

 

Q5. Answer: b

 

Q6. Answer: d

 

Q7. Answer: b

 

Q8. Answer: a

 

Q9. Answer: a

 

Q10. Answer: c

 

Q11. Answer: d

 

Q12. Answer: a

 

Q13. Answer: c

 

Q14. Answer: a

 

Q15. Answer: c

 

Q16. Answer: c

 

Q17. Answer: b

 

Q18. Answer: B

 

Q19. Answer: b

 

Q20. Answer: b