0% found this document useful (0 votes)
28 views5 pages

CS Holiday Homework 12

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)
28 views5 pages

CS Holiday Homework 12

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/ 5

SCHOLARS ACADEMY ROORKEE

AN ISO 9001:2015 CERTIFIED INSTITUTION


HOLIDAY HOMEWORK (2024-25)
SUB – COMPUTER SCIENCE CLASS – XII
1. What will be the output of the following code?
def Alter (M,N=50):
M=M + N
N= M – N
print (M, “@”,N)
return M
A = 200
B = 100
A = Alter (A, B)
print (A, “#”, B)
B = Alter (B)
print (A, “@”, B)
2. What will be the output of the following code?
def ChangeVal(M, N):
for i in range (N):
if M[i]%5 ==0 :
M[i]//=5
if M[i]%3 ==0:
M[i]//=3
L = [25, 8, 75, 12]
ChangeVal(L, 4)
for i in L :
print (i, end = ‘#’)
3. What will be the output of the following code?
def fun (s):
k = len(s)
m=""
for i in range (0, k):
if (s[i].isupper( )):
m=m+s[i].lower( )
elif s[i].isalpha( ):
m=m+s[i].upper( )
else:
m=m+'bb'
print(m)
fun('school12@com')
4. What will be the output of the following code?
str = "Computer Science "
print (str[-5 : -2])
print (str[5 : 2 : -1])
print (str[-2 : -5: -1])
print (str[-2 : -5: -2])
5. What will be the output of the following code?
p=5
def sum (q, r=2):
global p
p=r+q**2
print (p, end = ‘#’)
a = 10
b=5
sum(a, b)
sum (r = 5, q =1)

6. What will be the output of the following statements?


(i) 3 – 10 ** 2 + 99/11
(ii) 16 * 5/4*2/5-8
(iii) 6 * 3 + 4**2 // 5 – 8

7. What will be the output of the following code?


(i) 10 > 5 and 7 > 12 or not 18 > 3
(ii) Not True and False or True
(iii) 5 < 10 and 12 > 7 or not 7 > 4
(iv) print((0<5)or(not(10==5)and(9<5)))

8. What will be the output of the following code?


s="[email protected]"
l = len(s)
m=" "
for i in range(0,l):
if s[i].isupper():
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
elif s[i].isdigit():
m=m+"$"
else:
m=m+"*"
print(m)
9. What will be the output of the following code?
Msg="CompuTer"
Msg1=''
for i in range(0, len(Msg)):
if Msg[i].isupper():
Msg1=Msg1+Msg[i].lower()
elif i%2==0:
Msg1=Msg1+'*'
else:
Msg1=Msg1+Msg[i].upper()
print(Msg1)
10. What will be the output of the following code?
def replacefun():
str='Partoitism'
m=''
for ch in str:
if ch in 'aeiouAEIOU':
m=m+'*'
else:
m=m+ch
print(m)
replacefun()
11. What will be the output of the following code?
a=30
def call(x):
global a
if a%2==0:
x+=a
else:
x-=a
return x
x=20
print(call(35))
print(call(40))
12. What will be the output of the following code?
def change(A):
S=0
for i in range(len(A)//2):
S+=(A[i]*2)
return S
B = [10,11,12,30,32,34,35,38,40,2]
C = change(B)
print('Output is',C)
13. What will be the output of the following code?
p,q=8,[8]
def sum(r,s=5):
p=r+s
q=[r,s]
print (p, q, sep='@')
sum(3,4)
print (p, q, sep='@')
14. What will be the output of the following code?
def func(x):
p=q=r=0
for i in range(x):
if i%2==0:
p+=i
elif i%5==0:
q+=i
else:
r+=i
print(p,q,r)
func(12)
15. What will be the output of the following code?
def ChangeVal(M,N):
for i in range(N):
if M[i]%5==0:
M[i]//=5
if M[i]%3==0:
M[i]//=3
L=[25,8,75,12]
ChangeVal(L,4)
for i in L:
print(i,end='#')
16. What will be the output of the following code?
s="Rs.23"
n, m = len(s),' '
for i in range(0, n):
if s[i].islower():
m = m +s[i]
elif s[i].isupper():
m = m +s[i+1]
elif s[i].isdigit( ):
m = m*int(s[i])
else:
m = m+"@"
print(m)
17. What will be the output of the following code?
def vcount( ):
phr='Easy Coding'
vowel='aeiouAEIOU'
count=0
for ch in phr:
if ch in 'aeiouAEIOU':
count=count+1
else:
pass
print(count)
vcount( )
18. What will be the output of the following code?
def divlist(nlist):
for number in nlist:
if number % 3==0:
print(number,end='*')
print()
num=[40,45,4,89,75,12,56]
divlist(num)
19. What will be the output of the following code?
count = 0
while count <10:
print ('Hello')
count+=1
20. What will be the output of the following code?
Str="Computer"
Str=Str[-4:]
print(Str*2)

You might also like