0% found this document useful (0 votes)
1 views3 pages

Errors Output Functions

The document contains a series of Python programming questions focused on identifying and correcting errors, as well as determining outputs of various functions and code snippets. It includes tasks related to function definitions, loops, conditionals, and the use of global variables. The questions aim to test understanding of Python syntax and functionality.

Uploaded by

yuvaram9790
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views3 pages

Errors Output Functions

The document contains a series of Python programming questions focused on identifying and correcting errors, as well as determining outputs of various functions and code snippets. It includes tasks related to function definitions, loops, conditionals, and the use of global variables. The questions aim to test understanding of Python syntax and functionality.

Uploaded by

yuvaram9790
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PUSHPALATA VIDYA MANDIR

XII A B D E –COMPUTER SCIENCE


QUESTIONS ON OUTPUT AND ERROR BASED QUESTIONS ON FUNCTIONS IN PYTHON

Q. Identify the errors, underline it and correct the errors

a)Def Sum(a=1,b)
return a+b
print (“The sum =” Sum(7,-1)

b) def main ( )
print ("hello")

(c) def func2() :


print (2 + 3)

func2(5)

Q1. Find the output of the following numbers:


Num = 20
Sum = 0
for I in range (10, Num, 3)
Sum+=i
if i%2==0:
print
i*2
else:
print i*3
Q2.Find the output of the following
Text=”gmail@com”
L=len(Text)
ntext=” “
For i in range (0,L):
If text[i].isupper():
ntext=ntext+text[i].lower()
elif text[i].isalpha():
ntext=ntext+text[i].upper()
else:
ntext=ntext+’bb’
Q3. def power (b , p):
r = b ** P
return r

def calcSquare(a):
a = power (a, 2)
return a

n=5
result = calcSquare(n)
print (result )

Q 4. Find the output of the following-


Import math
print (math. Floor(5.5))
Q 5. Find the output
def gfg(x,l=[]):
for I in range(x):
l.append(i*i)
print(l)
gfg(2)
gfg(3,[3,2,1])
gfg(3)
Q 6. count =1
def dothis():
global count
for I in (1,2,3)
count+=1
dothis()
print count
Q 7. def addem(x,y,z):
Print(x+y+z)
def prod(x,y,z):
return x*y*z
A=addem(6,16,26)
B=prod(2,3,6)
Print(a,b)
Q 8. def Func(message,num=1):
print(message*num)
Func(‘python’)
Func(‘easy’,3)

Q 9.def Check(n1=1,n2=2)
n1=n1+n2
n2+=1
print(n1,n2)

Check()
Check(2,1)
Check(3)
Q. 10. a=10
def call():
global a
a=15
b=20
print(a)
call()

You might also like