What is printed by the following ANSI C program? #include<stdio.h> int…

PYQ GATE 2022

What is printed by the following ANSI C program?

    #include<stdio.h>
    int main(int argc, char *argv[]){
         char a = 'P';
         char b = 'x';
         char c = (a & b) + '*';
         char d = (a | b) - '-';
         char e = (a ^ b) + '+';
         printf("%c %c %c\n", c, d, e);
        return 0;
    }

ASCII encoding for relevant characters is given below

ABC...Z65666790

abc...z979899122

*+-424345

  1. A.

    z K S

  2. B.

    122 75 83

  3. C.

    * - +

  4. D.

    P x +

Attempted by 675 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…