GATE CS 2022 · Question 44 · Programming and Data Structures · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer
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 ", 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 |
- (A) z K S
- (B) 122 75 83
- (C) * - +
- (D) P x +
Answer
Answer (A)
Answer from the official GATE CS 2022 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes