My Report

C Operators Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Do logical operators in the C language are evaluated with the short circuit?

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

    #include <stdio.h>
    int main()
    {
        int a = 10, b = 5, c = 5;
        int d;
        d = b + c == a;
        printf("%d", d);
    } 

3. What is the result of logical or relational expression in C?

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

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

5. Are logical operator sequence points?

6. Relational operators cannot be used on ____________

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

    #include <stdio.h>
    int main()
    {
        int a = 10;
        if (a == a--)
            printf("TRUE 1\t");
        a = 10;
        if (a == --a)
            printf("TRUE 2\t");
    } 

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


 

Start practicing “1000 MCQs on C”, and once you are ready, you can take tests on all topics by attempting our “C Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.