Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

Consider the following code:

x = 5

def test(a):

    _________________  # Missing Statement

    x = x + a

    print(a, x)

test(3)

If the output produced is 3 8, which of the following statements should be given in the blank for the missing statement?

Options:

  1. global a

  2. global x

  3. global x=5

  4. global a=5

Answer:

Answer by student

b)  global x

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science, Social Science, Physics, Chemistry, Computer Science at Teachoo.