You are on page 1of 9

s = 0

for d in range(0, 5, 0.1):


… s += d
… print(s)
Which of the following function convert a String to an object in python?

def total(initial = 5, *num, **key):


count = initial
for n in num:
count+=n
for k in key:
count+=key[k]
return count
print(total(100,2,3, clouds=50, stars=100))
Which of the following function convert a String to a list in python?

What is output for −


2 * 2 **3
Which of the following is correct about tuples in python?

What is output for −


a = ['he', 'she', 'we']
' '.join(a)
Suppose you are given a set(s1={1,2,3}) then what is the output for the code −
2 * s1?
Which of the following function of dictionary gets all the keys from the dictionary?

Which of the following operator in python performs exponential (power) calculation on


operands?

What is the output for −


'python ' [-3]?
ef main():
try:
func()
print(''print this after function call'')
except ZeroDivisionError:
print('Divided By Zero! Not Possible! ')
except:
print('Its an Exception!')
def func():
print(1/0)
main()

What is the output of print str * 2 if str = 'Hello World!'?

Which of the following function of dictionary gets all the values from the dictionary?

Which of the following operator in python evaluates to true if the variables on either side
of the operator point to the same object and false otherwise?

Which of the following function convert an integer to an unicode character in python?

 Find the missing term (?) for the following output of the given code?
Code −
q = 'vwxyz'
for i in range(len(q)):
print(?)
q = ‘?’
 Which of the following function returns the max alphabetical character from the string
str?

What is the output for −


'you are doing well' [2:999]

What is output of following code −


x = 2
y = 10
x * = y * x + 1
Which of the following is more accurate for the following declaration?
x = Circle()
A - Now you can assign int value to x.
B - x contains a reference to a Circle object.
C - x actually contains an object of type Circle.
D - x contains an int value.
Q - What will be the output of the code?
z = ''Best website is Tutorials Point''
z.find(''Tutorials'')

A - 3
B - 13
C - 17
D - 16
elect the code for the following output?

A - Turtle.circle(20 , ''green '')


B - Turtle.circle(''green'')
C - Turtle.dot(20 , ''green'')
D - Turtle.dot(''green'')
- What is the output of the code?
q =( 'a', 'b')
3 * q

A - (3a, 3b)


B - (a3, b3)
C - ('a', 'b', 'a', 'b' , 'a' , 'b', 'a', 'b')
D - ('a', 'a', 'a', 'b', 'b', 'b')
 There are different basic operators in python and work according to the order of their
precedence.
Arrange the order of precedence of the following operator −
i)- Division
ii)- Multiplication
iii)- Parentheses
iv)- Exponential
v)- Addition
vi)- Subtraction
A - i, ii, iii, iv, v, vi.
B - iv, iii, ii, i, vi, v.
C - iii, iv, i, ii, v, vi.
D - iv, iii, i, ii, v, vi.
Q - What is the output of the following code?
class P:
def __init__(self):
self.__x=100
self.y=200
def print(self):
print(self.__x, self.y)
class C(P):
def __init__(self):
super().__init__()
self.__x=300
self.y=400
d = C()
d.print()

A - 300 400


B - 100 400
C - 100 200
D - 300 200
Q - Which of the following function convert an integer to a character in python?
A - set(x)
B - dict(d)
C - frozenset(s)
D - chr(x)
Q - What will be the output of the code?
q = 'TutorialsPoint'
r = 'T'
while r in q:
print('r', end= '' '')

Q - What will be the output of the code?


q = 'TutorialsPoint'
r = 'T'
while r in q:
print('r', end= '' '')

A - T T T T
B - T U T O R I A L S P O I N T
C - r r r r r r r r...
D - TutorialsPoint
Q - What is the output of 3 in [1, 2, 3]?
A - true
B - false
C - Error
D - None of the above.
Q - Which of the following operator in python evaluates to true if it does not finds a
variable in the specified sequence and false otherwise?
A - **
B - //
C - is
D - not in
Q - What is output for − max(''please help '')
A  - s
B - a blank space character
C - e
D - p
Q - Which of the following function convert an object to a string in python?
A - int(x [,base])
B - long(x [,base] )
C - float(x)
D - str(x)
Q - What is output of −
33 == 33.0
A - False
B - True
C - 33
D - None of the above
Q - Which is the special symbol used in python to add comments?
A  - $
B - //
C - /*.... */
D - #
Q - Select the correct code to create a check button under parent frame1 and it should
be bind to v1?
A - CheckButton(frame1, text=''Bold'' , command=CheckButton)
B - Checkbutton(frame1 , text=''Bold’’ ,variable=v1 ,command=processCheckbutton)
C -
Checkbutton(frame1,text=''Bold'',variable=v1.set(),command=v1.set(processCheckbut
ton)
D - Checkbutton(frame.set(f1) ,text.set(''bold'') ,command=v1.set(processCheckbutton)
Q - Which method is used to convert raw byte data to a string?
A - Encode()
B - Decode()
C - Convert()
D - tostring()
Q - Using the pack manager, how you can you put the components in a container in
the same row?
A - Component.pack(side= ''LEFT'')
B - Component.pack(''Left '')
C - Component.pack(side=LEFT)
D - Component.pack(Left-side)
Q - Which code can be used as an input dialog named ''Is this a character? ''
A - Tkinter.messagebox.showinfo(''showinfo'' , ''Is this a character? '')
B - Tkinter.messagebox.askyesno(''askyesno'' , ''Is this a character? '')
C - Tkinter.messagebox.showerror(''showerror'' , ''Is this a character? '')
D - Tkinter.messagebox.showwarning(''showwarning'' , ' 'Is this a character? '')
Q - Which of the following function checks in a string that all characters are in
uppercase?
A - isupper()
B - join(seq)
C - len(string)
D - ljust(width[, fillchar])
Q - What is the following function compares elements of both dictionaries dict1, dict2?
A - max(dict)
B - min(dict)
C - len(dict)
D - None of the above.
Q - What is output for −
a = ['hat', 'mat', 'rat']
'rhyme'.join(a)
A - [‘hat’,’mat’,’rat’,’rhyme’]
B - ‘hatmatratrhyme’
C - [‘hat mat rat rhyme’]
D - ‘hatrhymematrhyme rat’
Q - Which among them is correct(s) about Recursive Function?
A - They are much faster than the normal functions.
B - They take more space then the non-recursive functions.
C - They can always be replaced by non-recursive functions.
D - Using recursive functions however also gives a natural and straight  forward simple
solution for the program.
Q - What is output of following code −
s = ''mnopqr ''
i = ''m ''
while i in s:
print('i', end= '' '')

A - i i i i i i i i……..
B - m m m m m …..
C - m n o p q r
D - no output
Q - How can we generate random numbers in python using methods?
A - random.uniform ()
B - random.randint()
C - random.random()
D - All of the above
Q - What will be the output of the following code?
def f():
pass
print(type(f()))

A - <type 'function '>


B - <type 'tuple '>
C - <type 'NoneType '>
D - <type 'pass '>
Q - In python we don’t need to define the data type. So our objective is to make sure
that ‘a’ has an integer value? Select the valid option
A - a = 19 / 2
B - a = 19.0 / 2.0
C - a = 19.0 // 2.0
D - a = float(19/2)
Q - What is the following function returns item from the list with min value?
A - cmp(list)
B - len(list)
C - max(list)
D - min(list)
Q - What is the following function compares elements of both dictionaries dict1, dict2?
A - dict1.cmp(dict2)
B - dict1.sort(dict2)
C - cmp(dict1, dict2)
D - None of the above.

You might also like