O Level Online Exam
Menu mobile
Home
MCQ Topic Wise
INFORMATION TECHNOLOGY TOOLS AND NETWORK BASIS
New
WEB DESIGNING AND PUBLISHING
New
PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON
New
INTERNET OF THINGS AND ITS APPLICATIONS
New
Online Mock Test
INFORMATION TECHNOLOGY TOOLS AND NETWORK BASIS
New
WEB DESIGNING AND PUBLISHING
New
PROGRAMMING AND PROBLEM SOLVING THROUGH PYTHON
New
INTERNET OF THINGS AND ITS APPLICATIONS
New
Old Papers
Practical Questions
Projects
Report Bug
QusWhat does ~~~~~~5 evaluate to? Qus ~~~~~~5 का मूल्यांकन किससे होता है?
A. +5
B. -11
C. +11
D. -5
Solution
A. +5
Explanation
The expression ~~~~~~5 evaluates to 5.
In Python, the ~ operator is the bitwise NOT operator, which inverts all the bits of its operand. When applied to an integer n, it computes -(n + 1).
Here's a step-by-step breakdown of the evaluation:
~5 evaluates to -(5 + 1), which is -6.
~~5 evaluates to ~~5. Since ~5 is -6, applying ~ again: ~-6 evaluates to -(-6 + 1), which is 5.
This pattern continues: each pair of ~ operators cancel each other out. Since there are an even number of ~ operators in ~~~~~~5 (six in total), they all cancel out, leaving the original number, which is 5.
Latest Current Affairs 2024
Online Exam Quiz for One day Exam
Online Typing Test
CCC Online Test
Python Programming Tutorials
Best Computer Training Institute in Prayagraj (Allahabad)
Online MBA 2 years
Online MCA
Online BCA
Best Website and Software Company in Allahabad