Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2022
Questions

Q34

MCQ2 marks, −0.67Programming

What is printed by the following ANSI C\text{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\text{ASCII} encoding for relevant characters is given below ABC…Z656667…90abc…z979899…122∗+−424345\begin {array}{|c|c|c|c|c|} \hline \text{A} & \text{B} & \text{C} & \dots & \text{Z} \\\hline 65 & 66 & 67 & \dots & 90 \\\hline \end{array} \qquad \begin {array}{|c|c|c|c|c|} \hline \text{a} & \text{b} & \text{c} & \dots & \text{z} \\\hline 97 & 98 & 99 & \dots & 122 \\\hline \end{array} \\ \qquad \qquad \qquad \quad \begin {array}{|c|c|c|} \hline * & + & - \\\hline 42 & 43 & 45 \\\hline \end{array}

Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.