APRIL MONTHLY TEST QP CS XII

 APRIL MONTHLY TEST QP

KV WALTAIR   MONTHLY TEST APRIL 2023     SUB: CS   MM: 20M

1

What is a variable defined outside a function referred to as?

a)A static variable     b)A global variable  c)A local variable  d)An automatic variable

 

2

The output of the code shown below is:

def f1():

     x=15

     print(x)

x=12

f1()

a) Error           b) 12               c) 15              d) 1512

 

3

If return statement is not used inside the function, the function will return :

a) 0                    b) None object         c) An arbitrary iinteger     d) error

 

4

Which of the following function call will cause error while invoking the function header def test(a,b)

(a ) test(10,20)                (b) test(a=10, b=20)

(c)   test(a=10, b)                (d) test(10, b=20)

 

5

Which of the given argument types can be skipped form a function call?

a) Positional arguments        b)Keyword arguments

c) Named arguments             d)Default arguments

 

6

CASE STUDY BASED

Observe the code carefully and write answer of questions given below .

A=10

B=12

Text Box: i) what is the output of this program? ii) What is the value of 
a) x      b)   Y     c)z     in the above program?
def change():

A=9

global b

B=7

Print(a,b)

Y=b

change()

x=a

z=b

5

7

Write a function which takes three strings as arguments and returns the smallest string

3

8

Explain local and Global variables using an example code

2

9

Rewrite the following code in python after removing all the syntax errors.

Underline each correction done in the code.

num1,num2 =10

While num1 % num2 = 0

num1+=20

num2t=30

Else:

          print('hello')

2

10

Find the Output of the following code:

myvalue=["A", 40, "B", 60, "C", 20]

alpha =0 beta = ""

gama = 0

for i in range(1,6,2):

alpha +=i

beta +=myvalue[i-1]+ "#"

gama += myvalue[i]

print(alpha, beta, gama)

3

 


No comments:

Post a Comment