What will be the output of the following program.?

(a) 1       def increase (x):      (b) a=1

     2          a=a+x                      def f():

     3          return                          a=10

     4                                          print(a)

     5      a=20

     6    b=5

     7    increase (b)

     8    print(a) 

 

 

Answer:

(a)

Question 11 - Teachoo.jpg

This code gives an error as there is no value assigned to ‘a’ in the function ‘increase( )’.

(b)

Question 11(b) - Teachoo.jpg

The code gives an output 1 .

Remove Ads
Teachoo · Class 12 Explore Class 12
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh is an IIT Kanpur graduate and has been teaching for 16+ years. At Teachoo, he breaks down Maths, Science and Computer Science into simple steps so students understand concepts deeply and score with confidence.

Many students prefer Teachoo Black for a smooth, ad-free learning experience.