0% found this document useful (0 votes)
99 views6 pages

CS Xii Mcq&a 3

Uploaded by

harisudan941
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views6 pages

CS Xii Mcq&a 3

Uploaded by

harisudan941
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

CLASS : XII SUBJECT: COMP. SCI.

UNIT – I TOPIC- Exception Handling


……………………………………………………………………………………………………0
1. Errors resulting out of violation of programming language’s grammar rules
are known as …………………….
(a) Compile time error (b) Logical error
(c) Runtime error (d) Exception
2. An unexpected event that occurs during runtime and causes program
disruption, is called ………………………
(a) Compile time error (b) Logical error
(c) Runtime error (d) Exception
3. The errors encountered when a user violates the syntax of a programming
language while writing a code are termed as …………………………………………
(a) Compile time error (b) Logical error (c) Runtime error (d)
Exception
4. An interrupt or forced disruption that occurs when a program is run or
executed is termed as …………………………………
(a) Compile time error (b) Exception (c) Runtime error (d) Logical error
5. Which of the following keywords are not specific to exception handling?
(a) try (b) except (c) else (d) finally

6 Which block is a mandatory block in exception handling process? (a) try


(b) except (c) finally (d) else

7 Forced exceptions are indicated using which of the following keywords?


(a) try (b) except (c) finally (d) raise
8. ……………………… exception is raised when input() hits an EOF without
reading any data
9. ……………………… exception when a local or global name is not found.

10. ….………………. Exception is raised when an operation is applied to an object


of wrong type.
11. When denominator of a division expression is zero, …………. Exception is
raised.

12. While accessing a dictionary, if the given key is not found, ……………….
exception is raised.

13 The code which might raise an exception is kept in ……………… block.

14 …………………… Exception is raised when the module given with import


statement is not found.

15. …………………… Exception is raised when the result of an arithmetic


operation is too large to be represented.
16. ………………………… Exception is raised when Esc , Del or Ctrl + C is pressed
during program execution and normal program flow gets disturbed.
17 …………….. and ………………. Statement is used when we think that the code
might fail.
18. Exception and error are the same. (True/False)

19. All type of errors can be found during compile time (True/False)
(True/False)
20. A program running properly but producing wrong output is an exception.
(True/False)
21. Unexpected rare condition occurring during runtime which disrupts a
program’s execution is an exception. (True/False)
22. The except block deals with the exception, if it occurs. (True/False)
23. try , except , finally is the correct order of blocks in exception handling
(True/False)
24. An exception may be raised even if the program is syntactically correct.
(True/False)
25. Value Error occurs due to wrong indentation in a program (True/False)

26. Which statement is/are true about exception handling?


i. There can be try block without catch block but vice versa is not
possible
ii. There is no limit on the number of catch block corresponding to try
block
iii. The object must be created of a specific class of which the error has
occurred otherwise runtime error will occur
iv. To execute a code with each and every run of program, the code is
written in finally block
(a) i and ii, iv
(b) only iii
(c) ii and iv only
(d) only ii

*The following questions contain two statements: Assertion and


Reasoning. Each question has four choices – (i), (ii), (iii), (iv) –
only one of which is correct. In the light of these statements,
choose the most appropriate option.
(i) Both A and R are true and R is the correct explanation of A.
(ii) Both A and R are true but R is not the correct explanation of A.
(iii) A is true but R is false
(iv) A is false but R is true

27 Assertion (A): Exception handling handles all types of errors and


exceptions
Reasoning(R): Exception handling is responsible for handling anomalous
situations during the execution of a program.

28 Assertion (A) : Exception handling code is separate from normal code.


Reasoning (R) : Program logic is different while exception handling code
uses specific keywords to handle exceptions.
29 Assertion (A) : Exception handling code is clear and block based in
Python.
Reasoning (R) :The code where unexpected runtime exception may
occur is separate from the code where the action takes
place when an exception occurs
30 Assertion (A) : No matter what exception occurs, you can always make
sure that some common actions takes place for all types
of exceptions.
Reasoning (R) : The finally block contains the code that must execute.
: ANSWERS:
1. (a) Compile time error
2. (c) Runtime error
3. (a) Compile time error
4. (c) Runtime error
5. (c) else
6. (c) finally
7. (d) raise
8. EOFError
9. NameError
10. TypeError
11. ZeroDivisionError
12. KeyError
13. try
14. ImportError
15. OverflowError
16. KeyboardInterrupt
17. try , except
18. False, Syntax Error / Compile time error are not considered as Exception.
19. False, Only syntax errors can be found during compile time and Runtime errors
occurs only after we run the program.
20. False, there may be logic error in the program, which may produce wrong
output.
21. True, Exceptions are unexpected conditions occurring at run time.
22. True, except block contain the code that should be executed in case of
exception is raised.
23. True
24. True, Exception is raised during runtime only, if any unexpected condition
occurs at run time
25. False, Due to wrong indentation in a program, IndentationError occurs.
26. (a) i , ii and iv
27. (iv) A is false but R is true
28. (i) Both A and R are true and R is the correct explanation of A.
29. (i) Both A and R are true and R is the correct explanation of A.
30. (i) Both A and R are true and R is the correct explanation of A.

******************

You might also like