Top | MCQs on Bitwise Algorithms and Bit Manipulations with Answers | Question 23

Last Updated :
Discuss
Comments

What is the output of the below code?

C++
#include <bits/stdc++.h>
using namespace std;
int main()
{
    if (~0 == 1)
        cout << "Yes";
    else
        cout << "No";
}
C
#include <stdio.h>
int main() {
    if (~0 == 1)
        printf("Yes");
    else
        printf("No");
    return 0;
}
Java
public class Main {
    public static void main(String[] args) {
        if (~0 == 1)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
Python
if ~0 == 1:
    print("Yes")
else:
    print("No")
JavaScript
if (~0 === 1)
    console.log("Yes");
else
    console.log("No");

Yes 

No

Error

None

Share your thoughts in the comments