Which of the following operator evaluates to True if the variable on either…
2025
Which of the following operator evaluates to True if the variable on either side of the operator points towards the same memory location and False otherwise?
Answer: A. is — The 'is' operator in Python checks whether two variables refer to the same object in memory. It returns True if both variables point to the same memory…
- A.
is
- B.
is not
- C.
and
- D.
or
Attempted by 1132 students.
Show answer & explanation
Correct answer: A
The 'is' operator in Python checks whether two variables refer to the same object in memory. It returns True if both variables point to the same memory location, and False otherwise. This behavior directly matches the condition described in the question.
हिन्दी उत्तर:
पायथन में 'is' ऑपरेटर दो चरों के लिए यह जाँचता है कि क्या वे समान ऑब्जेक्ट को संदर्भित करते हैं। यह तब True लौटाता है जब दोनों चर एक ही मेमोरी स्थान को संदर्भित करते हैं, अन्यथा False। यह व्यवहार प्रश्न में वर्णित शर्त के अनुरूप है।