GATE CS 2022 (Forenoon) — Question 44

Programming in CData Types, Syntax, Control Structures, LoopsMCQ2 marks · −2/3 if wrongMedium

What is printed by the following ANSI C program?
c
1#include <stdio.h>
2int main(int argc, char *argv[ ]) {
3    char a = 'P';
4    char b = 'x';
5    char c = (a & b) + '*';
6    char d = (a | b) - '-';
7    char e = (a ^ b) + '+';
8    printf("%c %c %c\n", c, d, e);
9    return 0;
10}
11
ASCII encoding for relevant characters is given below:
Question image
  1. A
    z K S
  2. B
    122 75 83
  3. C
    * - +
  4. D
    P x +
Practise the full 2022-FN paper
Challenge a friend: WhatsApp Telegram
Recommended book · affiliate linkCompilers: Principles, Techniques & ToolsThe "Dragon Book" for parsing, syntax-directed translation and code generation.
Practise more on Data Types, Syntax, Control Structures, LoopsTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group