HomeTriviaTech & GamesPython programming language
concept🎮 Tech & Games

Python programming language Trivia Questions

How much do you really know about Python programming language? Below are 8 true or false statements. Click each one to reveal the answer and explanation.

1.

The `global` keyword is required to modify a variable defined outside a function.

Click to reveal answer ›

Easy
✓ TRUE

Without `global`, assigning to a variable inside a function creates a local variable instead of modifying the outer one.

2.

The `is` operator in Python checks if two variables reference the same object in memory.

Click to reveal answer ›

Easy
✓ TRUE

`is` compares identity, not equality; it's often used with `None` because `None` is a singleton.

3.

You can assign an attribute to a Python function object, like `my_func.custom_data = 42`.

Click to reveal answer ›

Medium
✓ TRUE

Functions are first-class objects in Python, so you can attach arbitrary attributes to them just like any object.

4.

Python's `and` operator returns a boolean `True` or `False` regardless of operand types.

Click to reveal answer ›

Medium
✗ FALSE

`and` returns the first falsy operand or the last operand if all are truthy, not necessarily a boolean.

5.

Python's `list` type uses a linked list data structure internally.

Click to reveal answer ›

Medium
✗ FALSE

Python lists are implemented as dynamic arrays (contiguous memory), not linked lists, allowing fast indexing.

6.

Python's `print` function always flushes output to the terminal immediately.

Click to reveal answer ›

Medium
✗ FALSE

By default, `print` buffers output; it flushes only when the buffer is full or a newline is printed (in interactive mode).

7.

Python's `else` clause on loops runs only if the loop completed without hitting `break`.

Click to reveal answer ›

Medium
✓ TRUE

The `else` block executes after a `for` or `while` loop finishes normally, but not if exited via `break`.

8.

Python's `__init__` method is actually a constructor that creates the object in memory.

Click to reveal answer ›

Hard
✗ FALSE

`__init__` initializes an object after it's created; `__new__` is the true constructor that allocates memory.

More in Tech & Games

MinecraftTrivia Questions →ChessTrivia Questions →TetrisTrivia Questions →Super MarioTrivia Questions →The Legend of ZeldaTrivia Questions →
View all Tech & Games topics →

Want to test yourself in real time?

Swipe right for True, left for False. New questions every day on PopBluff.

Play PopBluff Free →