Test Index

CBSE Class 12 Computer Science 2025 Paper Set 4 Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 11 of 37
Marks: +1, -0
Consider the statements given below and then choose the correct output from the given options :
N='5'
try:
print('WORD' + N, end='#')
except:
print('ERROR',end='#')
finally:
print('OVER')
Solution:  
Concept:
The except block runs only if the try block raises an exception; the finally block runs always.
Explanation:
N is the string '5', so 'WORD' + N is string concatenation = 'WORD5' (no error). It is printed with end='#' → WORD5#
No exception, so except is skipped.
finally prints OVER on the same line.
Output:
WORD5#OVER
Key point: 'ERROR' would appear only if N were a number (str + int raises TypeError).
Answer:
Option B (WORD5#OVER)
© examsnet.com
Advertisements
Go to Question: