हिंदी

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Exception Handling & Generate Functions [Latest edition]

Advertisements

Chapters

Unit -1 : Review of Phython & Concept of Oops

    1: Review of Phython

    2: Concept of Object Oriented Programming

    3: Classes in Python

    4: Inheritance

Unit -2 : Advanced Programming with Python

    1: Liner List Manipulation

    2: Stacks & Queues in list

    3: Data File Handling

▶ 4: Exception Handling & Generate Functions

Unit -3 : Databases Management Systems and SQL

    1: Databases Concepts and SQL

    2: Structure Query Language

Unit -4 : Introduction to Boolean Algebra

    1: Boolean Algebra

    2: Boolean Functions and Reduce Forms

   Chapter 3: Application of Boolean Logic

Unit -5 : Communication Technologies

   Chapter 1: Networking Concepts Part I

   Chapter 2: Networking Concepts Part II

   Chapter 3: Networking Protocols

   Chapter 4: Mobile Telecommunication Technologies, Network Security and Internet Services

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Exception Handling & Generate Functions - Shaalaa.com
Advertisements

Solutions for Chapter 4: Exception Handling & Generate Functions

Below listed, you can find solutions for Chapter 4 of CBSE CBSE for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२.


EXERCISE
EXERCISE [Pages 156 - 158]

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ 4 Exception Handling & Generate Functions EXERCISE [Pages 156 - 158]

1.Page 156

What all can be possible outputs of the following code?

def myfunc(x=None):
    result = ""
    if x is None:
    result = "No argument given"
    elif x == 0:
    result = "Zero"
    elif 0 < x <= 3:
    result = "x is between 0 and 3"
 else:
        result = "x is more than 3"
 return result
2.Page 156

We will try to read input from the user. Press Ctrl-d and see what happens:

>>> s = raw_input('Enter something --> ')

3.Page 156

What will happen when following functions are executed?

def fib():
x,y = 1,1
while True:
yield x
x,y = y, x+y
def odd(seq):
for number in seq:
if number % 2:
yield number
def under Four Million(seq):
for number in seq:
if number > 4000000:
       break
yield number
       print sum(odd(underFourMillion(fib())))
4.Page 157

Find out the situation(s) in which the following code may crash.

while loop == 1:
try:
     a = input('Enter a number to subtract from > ')
     b = input ('Enter the number to subtract > ')
     except NameError:
     print "\nYou cannot subtract a letter"
     continue
except SyntaxError:
print "\nPlease enter a number only."
continue
print a - b
try:
loop = input('Press 1 to try again > ')
except (NameError,SyntaxError):
loop = 0
5.Page 157

Describe what the following module is doing:

c = start
while True:
value = yield c
if value != None:
c = value
         else:
            c += 1
6.Page 158

When do we get a TypeError?

7.Page 158

List the situation(s) in which the code may result in IOError?

8.Page 158

What is the purpose of the yield statement?

9.Page 158

How is yield different from return?

10.Page 158

Write the syntax of the raise statement.

11.Page 158

Write a function called oops that explicitly raises a Index Error exception when called. Then write another function that calls oops inside a try/except statement to catch the error. What happens if you change oops to raise Key Error instead of Index Error?

12.Page 158

range() function in python does not include the stop value. Write a generator function equivalent to range() function that includes the stop value also. The function will take three arguments start, stop and step and will generate the desired list.

13.Page 158

Write a function to find average of a list of numbers. Your function should be able to handle an empty list and also list containing string.

14.Page 158

Write a function to generate cube's of numbers over time.

15.Page 158

Write a program, to accept a date as day, month & year from user and raise appropriate error(s), if legal value(s) is not supplied. Display appropriate message till user inputs correct value(s).

16.Page 158

Create a class Person to store personal information (of your choice) for a person. Ensure that while accepting the data incorrect entry is properly handled.

Solutions for 4: Exception Handling & Generate Functions

EXERCISE
CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Exception Handling & Generate Functions - Shaalaa.com

CBSE solutions for कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 - Exception Handling & Generate Functions

Shaalaa.com has the CBSE Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. CBSE solutions for Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE 4 (Exception Handling & Generate Functions) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.

Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. CBSE textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.

Concepts covered in कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ chapter 4 Exception Handling & Generate Functions are .

Using CBSE कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ solutions Exception Handling & Generate Functions exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in CBSE Solutions are essential questions that can be asked in the final exam. Maximum CBSE कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ students prefer CBSE Textbook Solutions to score more in exams.

Get the free view of Chapter 4, Exception Handling & Generate Functions कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ additional questions for Mathematics कम्प्यूटर साइंस विद पाइथान [अंग्रेजी] कक्षा १२ CBSE, and you can use Shaalaa.com to keep it handy for your exam preparation.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×