GATE 2022 Computer Science and Information Technology question: What is printed by the following ANSI C program? code ASCII encoding for relevant…
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
| A | B | C | ... | Z |
|---|---|---|---|---|
| 65 | 66 | 67 | ... | 90 |
| a | b | c | ... | z |
|---|---|---|---|---|
| 97 | 98 | 99 | ... | 122 |
| * | + | - |
|---|---|---|
| 42 | 43 | 45 |
Show answer
Official answer: A