0% found this document useful (0 votes)
11 views4 pages

SET08 Generic Objective

The document presents a series of programming questions and multiple-choice answers related to Python concepts, including list manipulation, loops, functions, string operations, tuples, dictionaries, classes, and variable types. Each question is followed by four answer options labeled A to D. The questions test the reader's understanding of basic programming logic and syntax.

Uploaded by

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

SET08 Generic Objective

The document presents a series of programming questions and multiple-choice answers related to Python concepts, including list manipulation, loops, functions, string operations, tuples, dictionaries, classes, and variable types. Each question is followed by four answer options labeled A to D. The questions test the reader's understanding of basic programming logic and syntax.

Uploaded by

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

1.

list1=[a,e,t,u,o]
list2=[nt,gg,in,ser,wl]
list3=[]
for i in range(0,len(list1)):
for j in range(0,len(list2)):
if(i==j):
list3.append(list1[i]+list2[j])
else:
continue
print(list3)

A-) ['ant', 'egg', 'tin', 'user', 'owl']


B-) ['egg', 'tin', 'user', 'owl','ant' ]
C-) ['nta', 'gge', 'int', 'seru','wlo' ]
D-) ['wlo', 'sero', 'int, 'gge', 'nta' ]

2.) cost=150000
discount=10
n=0
while(cost==15):
cost=cost*(discount/100)
n=n+1
Value of n is:

A-) 3
B-) 0
C-) 4
D-) 2

3.) no_of_people=89
def movie(time):
if(time==12):
no_of_people=56
elif(time==15):
no_of_people=76
else:
no_of_people=87
return no_of_people

a=18
print(movie(a))
print(no_of_people)

A-) 87,89
B-) 87,87
C-) 89,89
D-) 89,87

4.) import math


num1= 12.87
num2= -24.67
if(math.ceil(num2)>=-23):
print("First")
elif(math.floor(num1)>=11):
print("Second")
else
print("Third")
A-) First
B-) Second
C-) Third
D-) None

5.) string1="i work at infosys"


string2="work "
What is the possible way of getting string2 from string1 ?

A-) string1[3:7]
B-) string1[2:6]
C-) string1[2:7]
D-) string1[-15:-11]

6-) tuple1="ab","cd"
tuple2=tuple1+("cd",)
tuple3=tuple1+("yz",)
tuple=tuple2+tuple3
print(tuple)

A-) ('ab', 'cd', 'cd', 'ab', 'cd', 'yz')


B-) ('cd', 'ab', 'cd', 'yz', 'ab', 'ab')
C-) ('cd', 'ab', 'cd', 'yz', 'cd', 'ab')
d-) ('yz', 'cd', 'ab', 'yz', 'ab', 'ab')

7-) list1=[3,4,5,6,7]
list2=[1,2,3]
list3=list1.append[list2]
print(len(list3))

A-) 8
B-) Error:Type Error
C-) 0
D-) 7

8-) str="suraj singh"


str1="deepika,yami."
str2=str1+str
print(len(str2))

A-) 22
B-) 23
C-) 24
D-) 21

9-) dict1={"soap":12, "toothpaste":20, "Shampoo":125, "deo":310}


for value in dict.keys:
print(value)

A-) deo shampoo toothpaste soap


B-) 12 20 125 310
C-) Error:Type Error
D-) None of these

10-) class papa:


def method1(self):
return (1)
def method2(self):
return (3)
class son:
def method1(self):
return (2)
def method2(self):
return (5)
class daughter(son, papa):
def method4(self):
return 4
D=daughter()
print (D.method1()+D.method2()+D.method4())

A-) 11
B-) 8
C-) 4
D-) Error:TypeError

11-) list1=["ram:5","shyam:6","popu:7","himi:9","tej:10"]
a=list1.split(":")
print (a)

A-) AttributeError: 'list' object has no attribute 'split'


B-) Type Error
C-) ['ram','5','shyam','6','popu','7','himi','9','tej','10']
D-) ['tej','10']

12-) def infosys(name, *id):


print(type(id))
infosys("ritesh",123456,564765,987678)

A-) class 'str'


B-) class 'int'
c-) class 'tuple'
D-) class 'list'

13-) c=0
for i in range(0,7,2):
c=c+i
print("value of attribute is",c)

A-) value of attribute is 16


B-) value of attribute is 25
C-) value of attribute is 11
D-) value of attribute is 12

14-) count=0
while(count<12):
print("Shinchan")
How many times will the code print???

A-) 12
B-) 11
C-) 13
D-) None of these

15-) class variable:


__s=1000
def __init__(self,c):
self.__c=c
def counting(self,d):
self.__c=variable.__s*d
Choose the correct option

A-) Static variable-1, Instance variable-1,Local variable-2


B-) Static variable-1, Instance variable-1,Local variable-1
C-) Static variable-1, Instance variable-2,Local variable-1
D-) Static variable-1, Instance variable-2,Local variable-2

You might also like