250+ TOP MCQs on Relational & Logical Operators and Answers

C Objective Questions on “Relational & Logical Operators”. One shall practice these Objective Questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C Objective Questions come with detailed explanation of the answers which helps in better understanding of C concepts.

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

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

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 1, y = 0, z = 5;
  5.         int a = x && y || z++;
  6.         printf("%d", z);
  7.     }

a) 6
b) 5
c) 0
d) Varies
Answer: a
Clarification: None.

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

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 1, y = 0, z = 5;
  5.         int a = x && y && z++;
  6.         printf("%d", z);
  7.     }

a) 6
b) 5
c) 0
d) Varies
Answer: b
Clarification: None.

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

  1.     #include 
  2.     int main()
  3.     {
  4.         int x = 1, y = 0, z = 3;
  5.         x > y ? printf("%d", z) : return z;
  6.     }

a) 3
b) 1
c) Compile time error
d) Run time error
Answer: c
Clarification: None.

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

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 1, z = 3;
  5.         int y = x << 3;
  6.         printf(" %dn", y);
  7.     }

a) -2147483648
b) -1
c) Run time error
d) 8
Answer: d
Clarification: None.

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

  1.     #include 
  2.     void main()
  3.     {
  4.         int x = 0, y = 2, z = 3;
  5.         int a = x & y | z;
  6.         printf("%d", a);
  7.     }

a) 3
b) 0
c) 2
d) Run time error
Answer: a
Clarification: None.

6. What will be the final value of j in the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 0, j = 0;
  5.         if (i && (j = i + 10))
  6.             //do something
  7.             ;
  8.     }

a) 0
b) 10
c) Depends on the compiler
d) Depends on language standard
Answer: a
Clarification: None.

7. What will be the final value of j in the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 10, j = 0;
  5.         if (i || (j = i + 10))
  6.             //do something
  7.             ;
  8.     }

a) 0
b) 20
c) Compile time error
d) Depends on language standard
Answer: a
Clarification: None.

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

  1.     #include 
  2.     int main()
  3.     {
  4.         int i = 1;
  5.         if (i++ && (i == 1))
  6.             printf("Yesn");
  7.         else
  8.             printf("Non");
  9.     }

a) Yes
b) No
c) Depends on the compiler
d) Depends on the standard
Answer: b
Clarification: None.

  250+ TOP MCQs on Error Handling and Answers

Leave a Comment

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

Scroll to Top