English

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? - Computer Science (Python)

Advertisements
Advertisements

Question

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?

Options

  • is

  • is not

  • and

  • or

MCQ
Advertisements

Solution

is

Explanation:

The is operator checks identity, not value. It returns True if both variables refer to the same memory location, and False otherwise.

  • is → same object in memory
  • is not → different objects in memory
  • and, or → logical operators, not identity checks

Hence, the correct option is is.

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Set 4
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×