1. What will be the output?(1,2,1,2)
1. >>>t = (1, 2)
2. >>>2 * t
2. What will be the
output? False
1. >>>t1 = (1, 2, 4, 3)
2. >>>t2 = (1, 2, 3, 4)
3. >>>t1 <
t2
3. What is the data type of (1)? <class ‘int’>
4. If a=(1,2,3,4), output of a[1:-1] is (2,3)
5. What is the output of the following code? Error
>>> a=(1,2,3,4)
>>> del(a[2])
6. What is the output of the following code? 12
>>> a=(2,3,4)
>>> sum(a,3)
7. What is the output of the following code?__4_____
nums = set([1,1,2,3,3,3,4,4])
print(len(nums))
8.__set()___ is used to create an empty set?
9. What is the output of the following piece of code when executed in the
python shell?___True____
>>> a={5,4}
>>> b={1,2,4,5}
>>> a<b
10. If a={5,6,7}, what happens when a.add(5) is executed?__{5,6,7}__
11. What is the output of the following code?___Error____
>>> a={4,5,6}
>>> b={2,8,6}
>>> a+b
12. What is the output of the following code?__{4,5}___
>>> a={4,5,6}
>>> b={2,8,6}
>>> a-b
13. What is the output of the following piece of code?_{5,6,10,11}____
>>> a={5,6,7,8}
>>> b={7,8,10,11}
>>> a^b
14. What is the output of the following code?___Error__
>>> s={5,6}
>>> s*3
15. What is the output of the code shown?____<class ‘set’>____
s=set()
type(s)
16. Set makes use of ____set()______
Dictionary makes use of ____dict()________
17. Input order is preserved in sets. State whether this statement is true or
false.
a) True
b) False
18. What is the output of the code shown below?_Error___
>>>s={1, 2, 3}
>>>s.update(4)
>>>s
19.____{} / dict()_____ statement creates a empty dictionary?
20. What will be the output? (True / False)
1. d = {"john":40,
"peter":45}
2. "john" in d
21. What will be the output? (True / False)
1. d1 = {"john":40,
"peter":45}
2. d2 = {"john":466,
"peter":45}
3. d1 == d2
22. What will be the
output?______
1. d = {"john":40,
"peter":45}
2. print(list(d.keys()))
23. What is the output of the following code? [3]
a={}
a[2]=1
a[1]=[2,3,4]
print(a[1][1])
24. What is the output of the following snippet of code?__0:0,1:1,2:4,3:9,4:1,5:25_____
>>> a={i: i*i for i in range(6)}
>>> a
25. What is the output of the following piece of code?_____{1:”check”, 2:”check”, 3:”check”}______
>>> a={}
>>> a.fromkeys([1,2,3],"check")
26. What is the output of the following piece of code when executed in Python shell?_____ {0: 'A0', 1: 'A1', 2: 'A2', 3: 'A3', 4: 'A4'}____________
>>> a={i: 'A' + str(i) for i in range(5)}
>>> a
27. What is the output of the functions shown below?___False_____
min(max(False,-3,-4), 2,7)
28. Suppose there is a list such that: l=[2,3,4].
If we want to print this list in reverse order, ___l[::-1]______ method should be used?
29. What is the output of
the function:___4_____
len(["hello",2, 4, 6])
30. What is the output of this program?___ Received input is : Hello SRITW_____
1. str = input("Enter your input: "); #Hello
SRITW
2. print("Received
input is : ", str)
31. To delete a variable, it uses keyword __del____.
32. Python
string can be created simply by enclosing characters in the _’ ‘ (or) “ ” (or) ‘’’ ‘’’___________
33. We use
_____str[start_index:end_index]_______
for slicing along with the index or indices to obtain a substring.
34. The
method __replace(old_str,new_str)______
returns a copy of the string in which the values of old string have been
replaced with the new value.
35. _tuple____ is just like a list of a
sequence of immutable python objects.
36. To
fetch specific sets of sub-elements from tuple or list, we use this unique
function called __Slicing________
37. ____Dictionary______ is used to map or associate things you want to store the keys you need to get them.
38.
____len()_____ function gives the number of pairs in the dictionary.
39. ___in____ and ___not in____ are the membership operators that are used in Python.
40. ___is____ and __is not_____ are the identity operators that are used in Python.
41. __*____ is the repetition operator in
python
42. _elif____ keyword is used to implement
else-if in python
43.output
of range(10)?__[0,1,2,3,4,5,6,7,8,9]__
44. output of range(2,10)?__[2,3,4,5,6,7,8,9]__
45.
output of range(1,11,2)?_[1,3,5,7,9]___
46.
output of range(10,2,-1)?__[10,9,8,7,6,5,4,3]__
47.
output of range(1,20,5)?__[1,6,11,16]__
48.output
of the following code___Infinity loop
with 0______
>>>i=0
>>>while True:
>>> print(i)
49.
output of the following code__'wtirS
olleH'_______
>>>”Hello Sritw”[::-1]
50.
output of the following code___<class
‘set’>______
>>>a={2}
No comments:
Post a Comment