...
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.
5 1 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!