NCERT Solutions Class 12 Computer Science (Python) Chapter -5 (Exception Handling & Generator Function)
Class 12 Computer Science (Python)
Chapter-5 (Exception Handling & Generator Function)
Questions and answers given in practice
Chapter-5 (Exception Handling & Generator Function)
1.)……………………… are exceptional, unusual and unexpected situations and they are never part of the normal flow of a program.
a.)Algorithm
b.) Flowchart
c.) Errors
d.) Class
Answer: c.) Errors
2.) It is the process of responding in such situations.
a.) Exceptions Handling
b.) Error Handling
c.) Program Handling d.) None of these
Answer:- a.) Exceptions Handling
3.) The statement that is used for raising exception program.
a.) raise
b.) update
c.) upgrade
d.) upload
Answer: – a.) raise
4.) The statement allows the programmer to force a specified exception to occur.
a.) if – else
b.) raise
c.) if
d.) to
Answer: – b.) raise
5.) As the argument is optional the default value is ………………….. which is used in case the argument is not provided.
a.) None
b.) 1
c.) 10
d.) 50
Answer: – a.) None
6.) The error which is raised when we try to perform an operation on incorrect type of value.
a.) IO Error
b.) Index Error
c.) Name error
d.) Type Error
Answer: – d.) Type Error
7.) The error is raised when I/O operator fails
a.) IO Error
b.) Index Error
c.) Name error
d.) Type Error
Answer:– a.) IO Error
8.) The error which raises when one of the file method i.e read(), readline(), or readlines(), try to read beyond the file.
a.) EOF Error
b.) Index Error
c.) Name error
d.) Type Error
Answer: – a.) EOF Error
9.) The …………………….. is raised when a built in function/method receives an argument of correct type but with inappropriate value.
a.) Value Error
b.) IO Error
c.) Index Error
d.) Import Error
Answer:- a.) Value Error
10.) This error is raised when in division operation, denominator is zero.
a.) Zero Division Error
b.) EOError
c.) IndexError
d.) IOError
Answer:
11) This statement is used when we think that the code might fail.
a.) try…..except
b.) If
c.) If – Else
d.) None of these
Answer:- a.) try…..except
12.) The ……………….. clause written after all except statements, is executed, if code in try block does not raise any exception.
a.) try…..except
b.) If
c.) If – Else
d.) Else
Answer: – d.) Else
13.) It is the repetition of a process in computer program.
a.) Iteration
b.) Alteration
c.) adulteration
d.) None of these
Answer: – a.) Iteration
14.) It is used to allow a user to process every element of container, without knowing internal structure of the container.
a.) Proforma
b.) Instructions
c.) Protocol
d.) Method
Answer:- c.) Protocol
14.) In Iteration protocol, every iterator should have three operator which are
…………………. , ………………………. and ………………..
a.) Addition, subtraction, Multiplication b.) Top, Middle, Bottom
c.) Increment, De-referencing, Non-equality comparison
d.) All of these
Answer: – c.) Increment, De-referencing, Non-equality comparison
16.) This helps us to write user defined iterator, without worrying about the iterator protocol.
a.) Adjuster
b.) Generator
c.) Creator
d.) Developer
Answer:- b.) Generator
17.) This functions are not much different from normal functions, and use def to define a function.
a.) try…..except
b.) If
c.) If – Else
d.) Generator
Answer: – d.) Generator
18.) The statement which allows the generator function to suspend the processing and send a value, simultaneously retaining the existing state of generator to resume processing over time.
a.) try…..except
b.) yield
c.) If –Else
d.) Generator
Answer: – b.) yield