Tech Python
239 subscribers
120 photos
10 files
179 links
Python Programming Hub | Learn & Master Python

Welcome to the perfect channel to learn Python Programming — from beginner to advanced!

For promotions & collaborations:
techbywedcoder@gmail.com

Join now and accelerate your Python journey!
Download Telegram
Channel created
🧠 Python MCQ Question

What is the output of the following code? >>print(bool("False"))
Anonymous Poll
37%
True
43%
False
17%
Error
3%
None
Correct Answer: A) True


📘 Explanation:

The bool() function in Python returns False only for:

Empty strings ""

The number 0

Empty containers ([], {}, set())

None

"False" (with quotes) is a non-empty string, so it is truthy.

Therefore, bool("False") returns True.


React ❤️ if you got it right
🧠 Python MCQ Question

What is the output of the following code? >>print(3 * "abc")
Anonymous Poll
64%
abcabcabc
9%
abc*3
5%
Error
21%
abc abc abc
Correct Answer: A) abcabcabc


📘 Explanation:

In Python, multiplying a string by an integer repeats the string that many times.

So, 3 * "abc" is the same as "abc" + "abc" + "abc", which gives:

→ "abcabcabc"


React ❤️ if you got it right
🧠 Python MCQ Question

What is the output of the following code? >>print(10 // 3)
Anonymous Poll
40%
3.33
46%
3
6%
4
8%
3.0
Correct Answer: B) 3


📘 Explanation:

// is the floor division operator in Python.

It divides two numbers and returns the largest integer less than or equal to the result.

10 // 3 equals 3.333..., and the floor of that is 3 (as an integer).


React ❤️ if you got it right
Forwarded from TECH BY WEB CODER
Python Programming Notes.pdf
6.7 MB
Important Web Developer Language Notes 🔗

👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻

Topic :- Python (Basic To Advance)
1
🧠 Python MCQ Question

What is the output of the following code? >>print(type([]) == list)
Anonymous Poll
51%
True
14%
False
28%
<class 'list'>
7%
Error
Correct Answer: A) True


📘 Explanation:

[] creates an empty list.

type([]) returns <class 'list'>.

So, type([]) == list compares <class 'list'> == list, which is True.


React ❤️ if you got it right
🧠 Python MCQ Question

What is the output of the following code? >>print([i**2 for i in range(3)])
Anonymous Poll
18%
[1, 2, 3]
32%
[0, 1, 4]
27%
[1, 4, 9]
23%
[0, 1, 2]
Correct Answer: B) [0,1,4]


📘 Explanation:

This is a list comprehension that squares each number in range(3) → [0, 1, 2]. So:

0**2 = 0

1**2 = 1

2**2 = 4

Hence, the output is [0, 1, 4].

React ❤️ if you got it right
1
🧠Python MCQ Question

What is the output of the following code? >>print([i for i in range(5) if i % 2])
Anonymous Poll
28%
[0, 1, 2, 3, 4]
30%
[1, 3]
29%
[0, 2, 4]
13%
[2, 4]
Correct Answer: B) [1, 3]

📘Explanation:

range(5) generates numbers: [0, 1, 2, 3, 4].

i % 2 checks if the number is odd (i.e., remainder when divided by 2 is 1).

Only 1 and 3 satisfy this condition.

So the list comprehension filters out odd numbers: [1, 3].


React ❤️ if you got it right
1