Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

1. Is python a case sensitive language?

2. What are the supported data types in Python?


3. What is the output of print str if str = 'Hello World!'?
4. What is the output of print str[0] if str = 'Hello World!'?
5. What is the output of print str[2:5] if str = 'Hello World!'?
6. What is the output of print str[2:] if str = 'Hello World!'?
7. What is the output of print str * 2 if str = 'Hello World!'?
8. What is the output of print str + "TEST" if str = 'Hello World!'?
9. What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
10. What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
11. What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
12. What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
13. What is the output of print tinylist * 2 if tinylist = [123, 'john']?
14. What is the output of print list1 + list2, if list1 = [ 'abcd', 786 , 2.23, 'john', 70.2 ] and ist2 =
[123, 'john']?
15. What are tuples in Python?
16. What is the difference between tuples and lists in Python?
17. What is the output of print tuple if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
18. What is the output of print tuple[0] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
19. What is the output of print tuple[1:3] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
20. What is the output of print tuple[2:] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
21. What is the output of print tinytuple * 2 if tinytuple = (123, 'john')?
22. What is the output of print tuple + tinytuple if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 ) and
tinytuple = (123, 'john')?
23. What are Python's dictionaries?
24. How will you create a dictionary in python?
25. How will you get all the keys from the dictionary?
26. How will you get all the values from the dictionary?
27. How will you convert a string to an int in python?
28. How will you convert a string to a long in python?
29. How will you convert a string to a float in python?
30. How will you convert a object to a string in python?
31. How will you convert a object to a regular expression in python?
32. How will you convert a String to an object in python?
33. How will you convert a string to a tuple in python?
34. How will you convert a string to a list in python?
35. How will you convert a string to a set in python?
36. How will you create a dictionary using tuples in python?
37. How will you convert a string to a frozen set in python?
38. How will you convert an integer to a character in python?
39. How will you convert an integer to an unicode character in python?
40. How will you convert a single character to its integer value in python?
41. How will you convert an integer to hexadecimal string in python?
42. How will you convert an integer to octal string in python?
43. What is the purpose of ** operator?
44. What is the purpose of // operator?
45. What is the purpose of is operator?
46. What is the purpose of not in operator?
47. What is the purpose break statement in python?
48. What is the purpose continue statement in python?
49. What is the purpose pass statement in python?
50. How can you pick a random item from a list or tuple?
51. How can you pick a random item from a range?
52. How can you get a random number in python?
53. How will you set the starting value in generating random numbers?
54. How will you randomizes the items of a list in place?
55. How will you capitalizes first letter of string?
56. How will you check in a string that all characters are alphanumeric?
57. How will you check in a string that all characters are digits?
58. How will you check in a string that all characters are in lowercase?
59. How will you check in a string that all characters are numerics?
60. How will you check in a string that all characters are whitespaces?
61. How will you check in a string that it is properly titlecased?
62. How will you check in a string that all characters are in uppercase?
63. How will you merge elements in a sequence?
64. How will you get the length of the string?
65. How will you get a space-padded string with the original string left-justified to a total of
width columns?
66. How will you convert a string to all lowercase?
67. How will you remove all leading whitespace in string?
68. How will you get the max alphabetical character from the string?
69. How will you get the min alphabetical character from the string?
70. How will you replaces all occurrences of old substring in string with new string?
71. How will you remove all leading and trailing whitespace in string?
72. How will you change case for all letters in string?
73. How will you get titlecased version of string?
74. How will you convert a string to all uppercase?
75. How will you check in a string that all characters are decimal?
76. What is the difference between del() and remove() methods of list?
77. What is the output of len([1, 2, 3])?
78. What is the output of [1, 2, 3] + [4, 5, 6]?
79. What is the output of ['Hi!'] * 4?
80. What is the output of 3 in [1, 2, 3]?
81. What is the output of for x in [1, 2, 3]: print x?
82. What is the output of L[2] if L = [1,2,3]?
83. What is the output of L[-2] if L = [1,2,3]?
84. What is the output of L[1:] if L = [1,2,3]?
85. How will you compare two lists?
86. How will you get the length of a list?
87. How will you get the max valued item of a list?
88. How will you get the min valued item of a list?
89. How will you get the index of an object in a list?
90. How will you insert an object at given index in a list?
91. How will you remove last object from a list?
92. How will you remove an object from a list?
93. How will you reverse a list?
94. How will you sort a list?
95. What is lambda function in python?
96. Is Python platform independent?
97. Do you think Python has a complier?
98. What are the applications of Python?
99. Is String in Python are immutable? (Yes/No)
100. Can True = False be possible in Python?
101. Who invented python and when it was first released?
102. Why Python is getting popular?
103. What is f string?
104. What is the purpose of else block with loop?
105. How to use inline block?
106. Does python support ternary operator(condition)?
107. What is list comprehension?
108. How to declare global variable from function?
109. Difference between dict[key] and dict.get(key)?
110. Difference between shallow and deep copy?
111. How we implement overloading in python?
112. How to get object size?
113. Difference between list and set?
114. How to iterate multiple sequences using a loop?
115. What is Default Argument in Python?
116. What are High Order Functions?
117. What is the return type of read() in file handling?
118. How to perform typesafe operations in python?
119. Explain the usage of with block
120. What are any() and all() function?
121. Difference between == and is operators?
122. Difference between syntax error and exception?
123. Difference between raise and assert keywords?
124. What is cursor object in database programming?
125. What are Parameterized queries?
126. How to navigate cursor object?
127. What is SQL Injection Attack and how to prevent it?
128. What to find all matched strings based on a pattern?
129. What is pip?
130. Difference between function and method?
131. What is self arg?Is it possible to rename self?
132. What is the purpose of __init__() or constructor? Can it be called explictly?
133. Explain Automatic Garbage Collection?
134. Difference between instance and static variables?
135. Difference between static and class methods?
136. What is MRO?
137. What is operator overloading?
138. Difference between Iterator and Generator?
139. What is decorator?
140. What is Multithreading?
141. what is use of regex?
142. Diff bw sorted() & sort()?
143. What is seek in file io?
144. What is use of with block?
145. Diff bw Syntax error and Exception?

You might also like