Test Index

CBSE Class 12 Computer Science 2026 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 6 of 37
Marks: +1, -0
If L is an empty list, then which of the following expressions are invalid ?
Solution:  
Concept:
+ on a list joins it only with another list; * repeats a list an integer number of times.
Explanation:
(A) L + 'Hello': list + string → TypeError: can only concatenate list (not "str") to list. Invalid.
(B) L + [] → [] (valid)
(C) L + [2] → [2] (valid)
(D) L * 2 → [] (valid)
Key point: L += 'Hello' would work (it extends the list with the characters), but the expression L + 'Hello' does not.
Answer:
Option A (L +'Hello')
© examsnet.com
Advertisements
Go to Question: