...
Programming
September 5, 2023
GATE 2023
September 19, 2023
Programming
September 5, 2023
GATE 2023
September 19, 2023

Programming

Question 1

Let x be an integer which can take a value of 0 or 1. The statement if(x = =0) x = 1; else x = 0; is equivalent to which one of the following?

A
x = 1 + x;
B
x = 1 – x;
C
x = x – 1;
D
x = 1 % x;
Question 1 Explanation: 
x = 1 – x
For x = 0, it gives 1.
For x = 1, it gives 0.
Correct Answer: B
Question 1 Explanation: 
x = 1 – x
For x = 0, it gives 1.
For x = 1, it gives 0.

Leave a Reply

Your email address will not be published. Required fields are marked *