250+ TOP MCQs on Relational & Logical Operators and Answers

’s MCQs on C helps anyone preparing for placement in IBM and other companies. Anyone looking for IBM placement papers should practice these questions continuously for 2-3 months, thereby ensuring a top position in placements.

Here is a listing of C Objective Questions on “Relational & Logical Operators” along with answers, explanations and/or solutions:

1. Are logical operator sequence points?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
Answer: a
Clarification: None.

2. Do logical operators in the C language are evaluated with the short circuit?
a) True
b) False
c) Depends on the compiler
d) Depends on the standard
Answer: a
Clarification: None.

3. What is the result of logical or relational expression in C?
a) True or False
b) 0 or 1
c) 0 if an expression is false and any positive number if an expression is true
d) None of the mentioned
Answer: b
Clarification: None.

4. What will be the final value of d in the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int a = 10, b = 5, c = 5;
  5.         int d;
  6.         d = b + c == a;
  7.         printf("%d", d);
  8.     }

a) Syntax error
b) 1
c) 5
d) 10
Answer: b
Clarification: None.

5. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int a = 10, b = 5, c = 3;
  5.         b != !a;
  6.         c = !!a;
  7.         printf("%dt%d", b, c);
  8.     }

a) 5 1
b) 0 3
c) 5 3
d) 1 1
Answer: a
Clarification: None.

6. Which among the following is NOT a logical or relational operator?
a) !=
b) ==
c) ||
d) =
Answer: d
Clarification: None.

7. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int a = 10;
  5.         if (a == a--)
  6.             printf("TRUE 1t");
  7.         a = 10;
  8.         if (a == --a)
  9.             printf("TRUE 2t");
  10.     }

a) TRUE 1
b) TRUE 2
c) TRUE 1  TRUE 2
d) Compiler Dependent
Answer: d
Clarification: This is a sequence point problem and hence the result will be implementation dependent.

8. Relational operators cannot be used on ____________
a) structure
b) long
c) strings
d) float
Answer: a
Clarification: None.

Leave a Reply

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