Академический Документы
Профессиональный Документы
Культура Документы
x="apple,pear,peach"
y=x.split(",")
for z in y:
a. ==
b. !=
c. =
d. >
True / False
Q7. Identify the valid bitwise operator in Python from the following.
a) For
b) Num
Identify the method that will be used to display all (i) keys (ii) values
Q10. Which operator is used in python to import all modules from package?
a) .Operator b) ->Symbol c) *Operator d) ,Operator
Q11. Find and write the output of the following python code(if errors means correct it):
L = ["X",20,"Y",10,"Z",30]
CNT = 0
ST = ""
INC = 0
for C in range(1,6,2):
CNT= CNT + C
i.
arr = [1, 2, 3, 4, 5, 6]
arr[i - 1] = arr[i]
ii.
print( )
Q13. Rewrite the following code in python after removing all syntax error(s). Underline each
correction done in the code.
Num = input("Number:")
Sum = 0
for i in range(10,Num,3)
Sum+=i
if i%2=0:
print ( i*2)
Else:
Q14. Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[-2 : -5 : -1])
Q15. Suppose a tuple T is declared as T = (10, 12, 43, 39), which of the following is incorrect? a)
print(T[1]) b) T[2] = -29 c) print(max(T)) d) print(len(T)
a. mytup.index(67)
b. mytup.index(0)
c. mytup.index(89)
d. mytup.index(2)
c. abc = 1,000,000
Q19. Suppose a tuple T is declared as T = (10, 20, 40, 80, 20) Write the output of the following code?
i. print(T[1])
ii. print(count(20))
iii. print(max(T))
iv. print(len(T))
“hello world”.isalnum()
A = ‘7’
print(A*4+str(int(A)*2))
A=[12,45,78,45,234] B=len(A)
for i in range(0,B,2):
print(i)
Q24.Which of the following are not valid operations in python? i. Slicing a list ii. Concatenation of a
list and a tuple iii. Slicing a dictionary iv. Adding an element to an existing tuple.
X=eval(input(“Enter data”))
i) [1,3,53]
ii) 45
(Mutable / Immutable)
print (x, y)
Q30.
a=5
if x:
print (“Good”)
else:
print(“By”)
str1="6/4"
print("str1")
(i) print(str1[-7:-12])
(ii) print(str1[-11:-7])
(iii) print(str1[-11:-6])
(iv) print(str1[-7:-11])
(i) tuple1=("a","b")
(ii) tuple1[2]=("a","b")
(iii) tuple1=(5)*2
(iv) None of the above
Q35. The record of a student (Name, Roll No., Marks in five subjects and percentage of marks) is
stored in the following list:
Q36 Write Python statements to retrieve the following information from the list stRecord.
(i)
x, y=20,60
print(x, y)
(ii)
a, b=12,13
c, b=a*2,a/2
print(a, b, c)
Q38. Find and write the output of the following Python program code :
>>>print (12%5*3+(2*6) // 4)
Q39. Name the law shown below and verify it using a truth table.
A + B.C=(A+B).(A+C)
A. print(mySubject[0:len(mySubject)])
B. print(mySubject[-7:-1])
C. print(mySubject[::2])
D. print(mySubject[len(mySubject)-1])
E. print(2*mySubject)
F. print(mySubject[::-2])
Text=”gmail@com”
L=len(Text) ntext=””
if text[i].isupper():
ntext=ntext+text[i].lower()
elif text[i].isalpha():
ntext=ntext+text[i].upper()
else:
ntext=ntext+’bb’
print(ntext)
Q42.
Q43. Write a Python program to calculate the compound interest. The principal, rate of interest and
time must be entered by the user. (Formula: Compound Interest = Principal (1 + Rate/100) Time )
Q44. Write a program that creates a GK quiz consisting of any five questions of your choice. The
questions should be displayed randomly. Create a user defined function score() to calculate the
score of the quiz and another user defined function remark (score value) that accepts the final score
to display remarks as follows:
Q45. Program to find prime numbers between 2 to 50 using nested for loops. OR Write a function
that checks whether an input number is a palindrome or not. [Note: A number or a string is called
palindrome if it appears same when written in reverse order also. Forexample, 12321 is a
palindrome while 123421 is not a palindrome]