C# Programming - Operators - Discussion
Discussion Forum : Operators - General Questions (Q.No. 18)
18.
Which of the following statements are correct about the following code snippet?
int a = 10;
int b = 20;
bool c;
c = !(a > b);
- There is no error in the code snippet.
- An error will be reported since ! can work only with an int.
- A value 1 will be assigned to c.
- A value True will be assigned to c.
- A value False will be assigned to c.
Discussion:
5 comments Page 1 of 1.
Prashant kumar sharma said:
1 decade ago
On solving bracket we have false value and then not operator so it invert the value. It become true.
And 4th option also correct.
And 4th option also correct.
Robert said:
1 decade ago
Bool means true or false c is declared as bool, So the value return true not 1, if c declared int then the value return 1.
Bhavin Umaraniya said:
1 decade ago
In bracket condition is false when applied with NOT operator (!) it will become TRUE.
Namrata said:
1 decade ago
When the value will be one and when the value will be True ?
Shiv said:
9 years ago
True will be assigned to C.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers