Log In Register

Units

### Unit: Relational & Logical Operators - Questions and Answers

Practice these Relational & Logical Operators under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Relational & Logical Operators for following purpose.

– Anyone who is wishing to increase their perfect knowledge of Relational & Logical Operators of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Relational & Logical Operators.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Relational & Logical Operators under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Relational & Logical Operators topic of C Programming:

1.

What is the final value of j in the below code?

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

Answer: Option D

Explanation:

2.

Are logical operators sequence points?

Answer: Option D

Explanation:

3.

What is the output of this C code?

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

Answer: Option D

Explanation:

4.

Result of a logical or relational expression in C is

Answer: Option A

Explanation:

5.

What is the output of this C code?

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

Answer: Option D

Explanation:

6.

Which among the following is NOT a logical or relational operator?

Answer: Option A

Explanation:

7.

Does logical operators in C language are evaluated with short circuit?

Answer: Option C

Explanation:

8.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int x = 1, z = 3;`
5. `        int y = x << 3;`
6. `        printf(" %d\n", y);`
7. `    }`

Answer: Option A

Explanation:

9.

Relational operators cannot be used on:

Answer: Option D

Explanation:

10.

What is the final value of j in the below code?

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

Answer: Option C

Explanation:

11.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    int main()`
3. `    {`
4. `        int a = 10, b = 5, c = 3;`
5. `        b != !a;`
6. `        c = !!a;`
7. `        printf("%d\t%d", b, c);`
8. `    }`

Answer: Option D

Explanation:

12.

What is the output of this C code?

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

Answer: Option B

Explanation:

13.

What will be the value of d in the following program?

1. `    #include <stdio.h>`
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. `    }`

Answer: Option C

Explanation:

14.

What is the output of this C code?

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

Answer: Option C

Explanation:

15.

What is the output of this C code?

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

Answer: Option B

Explanation:

This is a sequence point problem and hence the result will be implementation dependent