Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 22

Q1-39 (set-I)

Q40-92(set-II)

Q1

Ans:

Indentation

Q2

Ans: None

Q3

Ans: Scope
Q4

Ans : 100

Q5

Ans : 100

Q6.
Ans:

None

Q7.

Option C is correct

Q8.

option d is correct : function_name()

Q9
Ans : def

Q10.

ans : return

Q11.

Ans : local

Q12.

Ans: default

Q13.

What is the output of the code

def hello(p,r=10,t=20):
print(p+r+t)

hello(r=30,p=50)

a) Error b) 80 c) 100 d) 60

Ans: 100 (option c)

Q14.

def hello(p,r=10,t=20):

print(p+r+t)

hello(q=30,p=50)

a) Error b) 80 c) 100 d) 60

Ans: Error

(because keyword argument name in calling statement should match with


the argument name in the function header

Q15.

Ans: functions

Q16

Ans: identifier
Q17.

Ans: tuples

Q18

Ans: d none of the above

Because function can return all literals, variable, expression

Q19

Ans: void function

Q20

Ans: colon
Q21

Ans: Hello! Mahesh

Q22. What is the output

def study(num=5):

print(num+5)

study()

study(7)

a) Error b) 10 12 c) 10 10 d) 12 12

Ans: 10 12 (option b)

Q23.
Ans:

a,b both are correct

Q24.

Ans: (14,0)

Q25.
Ans: 100 (option a)

(because is never called)

(if function was called before printing than global variable will be overwritten
and answer would be 50)
Q26.
s="WelCoMe"
for x in s:
if x.isupper():
print(x)

What is the output of the code a)


(correct)
WCM
b) W e l
c)can not predict
d)none of the above
Q27.
s="WelCoMe"
s2=''
for x in s:
if x.isupper():
s2=s2+x.lower()
elif x.islower():
s2=s2+x.upper()

print(s2)

What is the output of the code


a)
welcome
b) WelCoMe c)
WELCOME
d) (correct) WELcOmE
Q28.
s="WeLcOme"

for i in range(7):
print(i,end='')

Qwhat is the output of code


a) WeLcOme
b) 0123456 (correct)
c) 1234567
d) 01234567

Q29
s="WeLcOme"
for i in range(7):
if i%2==0:
print(s[i],end='')
Qwhat is the output of code
a) WeLc
b) WLcO
c) WLOe(correct)
d) WLoe

Q30.
s="WeLcOme"
for i in range(7):
if i%2==1:
print(s[i],end='')

Qwhat is the output of code


a) WLOe
b) eLc
c) ecO
d) ecm (correct)
Q31
s="WeLcOme"

for i in range(7):
if i%2==1:
print(s[i+1],end='')
else:
print(s[i-1],end='')

Qwhat is the output of code


a) WeLcO
b) emOLe
c) eLeOcem (correct)
d) none of the above
Q32
If character is capital convert it to small
if it is small convert it to capital
if even (copy the previous character)
if odd(copy @)
sTUDYtRIGGERr@2@2

StudyTriggerR@2@2
Ans: option a) is correct
Q33

Ans : a

Q34

Ans : arugments (option a)


Q35

ans: parameters( option b) Q36.

Ans: default arugment (option b)


Q37.
Ans: 12 12 (option ) Q38

Ans: random
Q39 to use any module which keyword is used
a) Use
b) Include
c) import (correct)
d) get
(SET-2)

You might also like