TGViewer
Coding Projects Coding Projects @programming_experts ยท 67.9K subscribers
Post #2639 2.65K
๐Ÿ”ฅ Programming Questions with Answers & Explanations ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿง 

Q1. What will be the output?

x = [1, 2, 3]

y = x

y.append(4)

print(x)

โœ… Answer:

[1, 2, 3, 4]

๐Ÿ’ก Explanation:
"y = x" does not create a new list.

Both "x" and "y" point to the same list in memory.

So when:

y.append(4)

the original list also gets updated.

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Q2. What will be the output?

print(2**3**2)

โœ… Answer:

512

๐Ÿ’ก Explanation:
Exponent operator ("**") works from RIGHT to LEFT.

So 2**3**2

be(2**(3**2)

= 2 ** 9

= 512

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Q3. What will be the output?

a = "5"
b = 2

print(a * b)

โœ… Answer:

55

๐Ÿ’ก Explanation:
In Python:

string * number

means repetition.

So:

"5" * 2

becomes:

"55"

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Q4. What will be the output?

def func(items=[]):
items.append(1)
return items

print(func())
print(func())

โœ… Answer:

[1]
[1, 1]

๐Ÿ’ก Explanation:
Default mutable arguments are created only once.

So the same list is reused every time the function is called.

First call:

[1]

Second call:

[1, 1]

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Q5. What will be the output?

for i in range(3):
print(i)
else:
print("Done")

โœ… Answer:

0
1
2
Done

๐Ÿ’ก Explanation:
The "else" block inside loops executes when the loop finishes normally.

Since there is no "break" statement, the loop completes successfully and then prints:

Double Tap โค๏ธ For More
  • โค 11
More from @programming_experts
  1. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  2. Oct 7, 2026๐ŸงฉNow, Let's Understand Functions in Programming ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ”ฅ After variables, operators, condiโ€ฆ
  3. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Sep 29, 2026Post #2901
  6. Sep 29, 2026Post #2900
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’