There is no single answer
c and d have always been the same cached object in all implementations of CPython (you could technically tweak the size of the small int cache in a custom build, but all common builds would include 5). So we can say there are at most three unique objects here (technically, c = 5 and d = 5 don't even create objects; the small int cache created them during interpreter setup, before it even compiled this code, but 5 is at least a unique object). We also know there are at least two objects, because a 5 clearly isn't the same object as a 300. Outside CPython, we can't even limit the maximum to three; all four integers could be unique objects in an alternate interpreter.
But even if we stick to CPython, CPython's varying caching rules make the question about a and b unanswerable question without additional information. Specifically, in modern versions (unsure when it was introduced), all integer constants within a single module are deduplicated. In interactive mode though, this deduplication doesn't happen if they're on separate lines, and might not happen if they're on a single semicolon separated line.
So running a = 300; b = 300; print(a is b) in the interactive interpreter will print (sometimes, depends on exact interpreter configuration and maybe Python version) False. Running:
>>> a = 300
>>> b = 300
>>> print(a is b)
will reliably print False. But if you put the exact same code in a file (on one line or three), e.g. test_identity.py, then run python3 test_identity.py, it will reliably output True. On the other hand, if you wrote two modules:
# a.py
a = 300
and
# b.py
b = 300
and then ran import a, b; print(a.a is b.b), you'll get False again; int constant deduplication is limited to the module-level, it doesn't occur between modules like string literal interning does. Thus, depending how where the code is executed, there could be two or three unique objects involved. And even then, the Python the language makes no guarantees that either object is deduplicated, so the range is 2-3 for the CPython implementation, but 2-4 for Python the language.
As a side-note, none of these objects are created when the line is run (this gets a little weird, definition-wise, in the interactive interpreter where both compilation and execution are combined, but in a module, there is a clear distinction). They're created and cached when the line is compiled. If the same line in the same file is executed again (as part of a loop, or a repeatedly called function, or whatever) the same constant int value is loaded, so arguably, no objects were created: the 5s were created in the small int cache when Python launched before it even began running Python-level code, and the 300(s) were created when the Python-level code was compiled, and running the code merely loads them.
This is a terrible interview question
Really, the answer here is that this is either a poor interview question, or they're looking for people with deep knowledge of CPython internals. As the various other answers here demonstrate, even people who think they know the int cache rules miss other caching rules that change the answer to the question in different contexts.
aandbrefer to the same object in memory (along with c and d)