C Programming 10

COEP
Lets Crack Online Exam

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

Subject: C Programming 10

Part 10: List for questions and answers of C Language

 

Q1. Choose correct order of evaluation? z = x + y * z / 4 % 2 – 1

a) * / % + – =

b) = * / % + –

c) / * % – + =

d) % / – + =

 

Q2. Which of the following correctly shows the hierarchy of arithmetic operations in C?

a) / + * –

b) * – / +

c) + – / *

d) / * + –

 

Q3. Which of the following is the correct usage of conditional operators used in C?

a) a>b ? c=30 : c=40;

b) a>b ? c=30;

c) max = a>b ? a>c?a:c:b>c?b:c

d) return (a>b)?(a:b)

 

Q4. Choose correct order if calling functions in the below code?

a = f1(23, 14) * f2(12/4) + f3();

a) f1, f2, f3

b) f3, f2, f1

c) Order may vary from compiler to compiler

d) None of above

 

Q5. Which of the following are unary operators in C?

1. ! 2.sizeof 3. ~ 4. &&

a) 1, 2

b) 1, 3

c) 2, 4

d) 1, 2, 3 

 

Q6. In which order do the following gets evaluated

1.Relational 

2.Arithmetic 

3.Logical 

4.Assignment

a) 2134

b) 1234

c) 4321

d) 3214

 

Q7. What is the type of the below assignment expression if x is of type float, y is of type

int?y = x + y;

a) int

b) float

c) There is no type for an assignment expression

d) double

 

Q8. What is the value of the below assignment expression (x = foo())!= 1 considering foo() returns 2

a) 2

b) True

c) 1

d) 0

 

Q9. Operation “a = a * b + a” can also be written as:

a) a *= b + 1;

b) (c = a * b)!=(a = c + a);

c) a = (b + 1)* a;

d) All of the mentioned

 

Q10. C was primarily developed as

a) System programming language

b) General purpose language

c) Data processing language

d) None of the above

 

Q11. Declare the following statement?”An array of three pointers to chars”

a) char *ptr[3]();

b) char *ptr[3];

c) char (*ptr[3])();

d) char **ptr[3]; 

 

Q12. Which of the following is an invalid assignment operator?

a) a %= 10;

b) a /= 10;

c) a |= 10;

d) None of the mentioned

 

Q13. What is the output of this C code?

int main()

{

int x = 2, y = 0;

int z = (y++) ? y == 1 && x : 0;

printf(“%d\n”, z);

return 0;

}

a) 0

b) 1

c) Undefined behaviour

d) Compile time error

 

Q14. What is the output of this C code?

int main()

{

int y = 1, x = 0;

int l = (y++, x++) ? y : x;

printf(“%d\n”, l);

}

a) Compile time error

b) Whatever character getchar function returns

c) Ascii value of character getchar function returns

d) 2

 

Q15. What do the following declaration signify?int (*pf)();

a) pf is a pointer to function

b) pf is a function pointer

c) pf is a pointer to a function which return int

d) pf is a function of pointer variable

 

Q16. Which of the following comments about the ++operator are correct?

a) It is a unary operator

b) The operand can come before or after the operator

c) It cannot be applied to an expression

d) All of the above

 

Q17. In C programming language, which of the following type of operators have the highest precedence

a) Relational operators

b) Equality operators

c) Logical operators

d) Arithmetic operators 

 

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

a) A+

b) B*

c) C/

d) %

 

Q19. In an expression involving || operator, evaluation

I.Will be stopped if one of its components evaluates to false

II.Will be stopped if one of its components evaluates to true

III.Takes place from right to left

IV.Takes place from left to right

a) I and II

b) I and III

c) I and III

d) II and IV

 

Q20. How will you free the allocated memory ?

a) remove(var-name);

b) free(var-name);

c) delete(var-name);

d) dalloc(var-name); 

 

Part 10: List for questions and answers of C Language

 

Q1. Answer: a

 

Q2. Answer: d

 

Q3. Answer: c

 

Q4. Answer: c

 

Q5. Answer: d

 

Q6. Answer: a

 

Q7. Answer: a

 

Q8. Answer: a

 

Q9. Answer: d

 

Q10. Answer: a

 

Q11. Answer: b

 

Q12. Answer: d

 

Q13. Answer: a

 

Q14. Answer: c

 

Q15. Answer: c

 

Q16. Answer: d

 

Q17. Answer: d

 

Q18. Answer: d

 

Q19. Answer: d

 

Q20 Answer: b