NIELIT O Level Exam

<p>what is the output of the following code?</p><pre><span style="font-size: 12.6px;">M=['b' *x for x in range(4)] print(M)</span><br></pre>

what is the output of the following code?

M=['b' *x for x in range(4)]
print(M)


निम्नलिखित कोड का आउटपुट क्या है?

M=['b' *x for x in range(4)]
print(M)

A. ['', 'b', 'bb', 'bbb']

B. ['b,'bb', "bbb', "bbbb']

C. ['b','bb', bbb']

D. none of these इनमे से कोई नहीं




Correct Answer is :

A. ['', 'b', 'bb', 'bbb']



Explanation

range(4) gives: [0, 1, 2, 3]

'b' * x repeats the character 'b' x times

So:

'b' * 0 → ''

'b' * 1 → 'b'

'b' * 2 → 'bb'

'b' * 3 → 'bbb'

Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad