1. Which of these in not a core data type?
a) Lists
b) Dictionary
c) Tuples
d) Class
2. Given a function that does not return any value, What value is thrown by
default when executed in shell.
a) int
b) bool
c) void
d) None
3. Following set of commands are executed in shell, what will be the output?
1. >>>str="hello"
2. >>>str[:2]
3. >>>
a) he
b) lo
c) olleh
d) hello
4. What data type is the object below ?
L = [1, 23, ‘hello’, 1].
a) list
b) dictionary
c) array
d) tuple
5. In order to store
values in terms of key and value we use what core data type.
a) list
b) tuple
c) class
d) dictionary
6. Which is the correct operator for power(xy)?
a) X^y
b) X**y
c) X^^y
d) None of the mentioned
7. Which one of these is floor division?
a) /
b) //
c) %
d) None of the mentioned
8. What is the order of precedence in python?
i) Parentheses
ii) Exponential
iii) Multiplication
iv) Division
v) Addition
vi) Subtraction
a) i,ii,iii,iv,v,vi
b) ii,i,iii,iv,v,vi
c) ii,i,iv,iii,v,vi
d) i,ii,iii,iv,vi,v
9. What is the answer to this expression, 22 % 3 is?
a) 7
b) 1
c) 0
d) 5
10. What is the output of this expression, 3*1**3?
a) 27
b) 9
c) 3
d) 1
11. Which of the following is not a complex number?
a) k = 2 + 3j
b) k = complex(2, 3)
c) k = 2 + 3l
d) k = 2 + 3J
12. What does 3 ^ 4 evaluate to?
a) 81
b) 12
c) 0.75
d) 7
13. What is the output
of the code snippet shown below?
X=”hi”
print(“05d”%X)
a) 00000hi
b) 000hi
c) hi000
d) error
14. What is the output of the following expression if x=456?
print("%-06d"%x)
a) 000456
b) 456000
c) 456
d) error
15. What is the output
of the following expression if X=345?
print(“%06d”%X)
a) 345000
b) 000345
c) 000000345
d) 345000000
16. What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
a) 56.00
b) 56.24
c) 56.23
d) 0056.236
17. The output of the code
shown below is:
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
a) ‘hello good and morning’
b) ‘hello, good,
morning’
c) ‘hello, good, and morning’
d) Error
18. What is the output of the code shown?
s='%s, %s & %s'
s%('mumbai', 'kolkata',
'delhi')
a) mumbai kolkata & delhi
b) Error
c) No output
d) ‘mumbai, kolkata & delhi’
19. What is the output of the following?
x = ['ab',
'cd']
for i in x:
x.append(i.upper())
print(x)
a) [‘AB’, ‘CD’].
b) [‘ab’, ‘cd’, ‘AB’, ‘CD’].
c) [‘ab’, ‘cd’].
d) none of the mentioned
20. What is the output of the following?
i = 1
while True:
if
i%3 == 0:
break
print(i,end=’ ‘)
i + = 1
a) 1 2
b) 1 2 3
c) error
d) none of the mentioned
21. What is the output
of the following?
i = 1
while True:
if
i%2 == 0:
break
print(i)
i += 2
a) 1
b) 1 2
c) 1 2 3 4 5 6 …
d) 1 3 5 7 9 11 …
22. What is the output
when following statement is executed ?
1. >>>"abcd"[2:]
a) a
b) ab
c) cd
d) dc
23. What is the output
when following code is executed ?
1. >>> str1 = 'hello'
2. >>> str1[-1:]
a) olleh
b) hello
c) h
d) o
24. What arithmetic
operators cannot be used with strings ?
a) +
b) *
c) –
d) All of the mentioned
25. What is the output when following code is executed ?
1. >>>str1="helloworld"
2. >>>str1[::-1]
a) dlrowolleh
b) hello
c) world
d) helloworld
26. What is the output of the following?
print("ccdcddcd".find("c"))
a) 4
b) 0
c) Error
d) True
27. What is the output of the following?
print("Hello {0} and {1}".format('foo',
'bin'))
a) Hello foo and bin
b) Hello {0} and {1} foo
bin
c) Error
d) Hello 0 and 1
28. What is the output
of the following?
print('abc'.islower())
a) True
b) False
c) None
d) Error
29. Which of the
following commands will create a list?
a) list1 = list()
b) list1 = [].
c) list1 = list([1, 2, 3])
d) all of the mentioned
30. What is the output when we execute list(“hello”)?
a) [‘h’, ‘e’, ‘l’, ‘l’, ‘o’].
b) [‘hello’].
c) [‘llo’].
d) [‘olleh’].
31. Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
a) 5
b) 4
c) None
d) Error
32. Suppose list1 is
[2445,133,12454,123], what is max(list1) ?
a) 2445
b) 133
c) 12454
d) 123
33. Suppose list1 is [1, 5, 9], what is sum(list1) ?
a) 1
b) 9
c) 15
d) Error
34. Suppose list1 is [2,
33, 222, 14, 25], What is list1[-1] ?
a) Error
b) None
c) 25
d) 2
35. What is the output
of the following code?
a=[1,2,3]
b=a.append(4)
print(a)
print(b)
a) [1,2,3,4].
[1,2,3,4].
b) [1, 2, 3, 4].
None
c) Syntax error
d) [1,2,3].
[1,2,3,4].
36. What will be the output when executed in python shell?
>>> a=[14,52,7]
>>>> b=a.copy()
>>> b is a
a) True
b) False
37. What is the output of the following code?
a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)
a) [13, 56, 17, [87], 45,
67].
b) [13, 56, 17, 87, 45, 67].
c) [13, 56, 17, 87,[ 45, 67]].
d) [13, 56, 17, [87], [45, 67]].
38. What is the output of the following piece of code?
a=list((45,)*4)
print((45)*4)
print(a)
a) 180
[(45),(45),(45),(45)].
b) (45,45,45,45).
[45,45,45,45].
c) 180
[45,45,45,45].
d) Syntax error
39. What is the output of the following code?
lst=[[1,2],[3,4]]
print(sum(lst,[]))
a) [[3],[7]].
b) [1,2,3,4].
c) Error
d) [10].
40. What is the output of the following code?
word1="Apple"
word2="Apple"
list1=[1,2,3]
list2=[1,2,3]
print(word1 is word2)
print(list1 is list2)
a) True
True
b) False
True
c) False
False
d) True
False
41. What is the output
of the following piece of code?
x=[[1],[2]]
print(" ".join(list(map(str,x))))
a) [1] [2].
b) [49] [50].
c) Syntax error
d) [[1]] [[2]].
42. What is the output of the following code?
a=165
b=sum(list(map(int,str(a))))
print(b)
a) 561
b) 5
c) 12
d) Syntax error
43. What is the output of the following code?
a= [1, 2, 3, 4, 5]
for i in range(1, 5):
a[i-1] = a[i]
for i in range(0, 5):
print(a[i],end = " ")
a) 5 5 1 2 3
b) 5 1 2 3 4
c) 2 3 4 5 1
d) 2 3 4 5 5
44. What is the output of the following code?
num = ['One',
'Two', 'Three']
for i, x in
enumerate(num):
print('{}: {}'.format(i, x),end=" ")
a) 1: 2: 3:
b) Exception is thrown
c) One Two Three
d) 0: One 1: Two 2: Three
45. Which of the
following is a Python tuple?
a) [1, 2, 3].
b) (1, 2, 3)
c) {1, 2, 3}
d) {}
46. Suppose t = (1, 2, 4, 3), which of the following is incorrect?
a) print(t[3])
b) t[3] = 45
c) print(max(t))
d) print(len(t))
47. What will be the output?
1. >>>t=(1,2,4,3)
2. >>>t[1:3]
a) (1, 2)
b) (1, 2, 4)
c) (2, 4)
d) (2, 4, 3)
48. What will be the
output?
1. >>>t=(1,2,4,3)
2. >>>t[1:-1]
a) (1, 2)
b) (1, 2, 4)
c) (2, 4)
d) (2, 4, 3)
49. What will be the output?
1. >>>t = (1, 2, 4, 3, 8, 9)
2. >>>[t[i] for i
in range(0, len(t), 2)]
a) [2, 3, 9].
b) [1, 2, 4, 3, 8, 9].
c) [1, 4, 8].
d) (1, 4, 8)
50. What will be the output?
1. d = {"john":40,
"peter":45}
2. d["john"]
b) 45
c) “john”
d) “peter”
x=3.3456789
'%s' %x, str(x)
b) (‘3.3456789’, ‘3.3456789’)
c) (3.3456789, 3.3456789)
d) (‘3.3456789’, 3.3456789)
'%(qty)d more %(food)s' %{'qty':1, 'food': 'spam'}
b) No output
c) ‘1 more foods’
d) ‘1 more spam’
a='hello'
q=10
vars()
b) {……Built in names set by Python……}
c) {‘a’ : ‘hello’, ‘q’ : 10}
d) Error
s='{0}, {1}, and {2}'
s.format('hello', 'good', 'morning')
b) ‘hello, good, morning’
c) ‘hello, good, and morning’
d) Error
s='%s, %s & %s'
s%('mumbai', 'kolkata', 'delhi')
b) Error
c) No output
d) ‘mumbai, kolkata & delhi’
t = '%(a)s, %(b)s, %(c)s'
t % dict(a='hello', b='world', c='universe')
b) ‘hellos, worlds, universes’
c) Error
d) hellos, world, universe
'{a}, {0}, {abc}'.format(10, a=2.5, abc=[1, 2])
b) ‘2.5, 10, [1, 2]’
c) 2.5, 10, 1, 2
d) ’10, 2.5, [1, 2]’
'{0:.2f}'.format(1.234)
b) ‘1.234’
c) ‘1.23’
d) ‘1.2’
'%x %d' %(255, 255)
b) ‘255, 255’
c) ‘15f, 15f’
d) Error
'{0:.2f}'.format(1/3.0)
'%.2f'%(1/3.0)
b) False
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
b) [‘AB’, ‘CD’].
c) [None, None].
d) none of the mentioned
x = ['ab', 'cd']
for i in x:
x.append(i.upper())
print(x)
b) [‘ab’, ‘cd’, ‘AB’, ‘CD’].
c) [‘ab’, ‘cd’].
d) none of the mentioned
i = 1
while True:
if i%3 == 0:
break
print(i)
i + = 1
b) 1 2 3
c) error
d) none of the mentioned
i = 1
while True:
if i%0O7 == 0:
break
print(i)
i += 1
b) 1 2 3 4 5 6 7
c) error
d) none of the mentioned
i = 5
while True:
if i%0O11 == 0:
break
print(i)
i += 1
b) 5 6 7 8
c) 5 6
d) error
i = 5
while True:
if i%0O9 == 0:
break
print(i)
i += 1
b) 5 6 7 8 9
c) 5 6 7 8 9 10 11 12 13 14 15 ….
d) error
i = 1
while True:
if i%2 == 0:
break
print(i)
i += 2
b) 1 2
c) 1 2 3 4 5 6 …
d) 1 3 5 7 9 11 …
i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
b) 2 4
c) 2 3
d) error
i = 1
while False:
if i%2 == 0:
break
print(i)
i += 2
b) 1 3 5 7 …
c) 1 2 3 4 …
d) none of the mentioned
True = False
while True:
print(True)
break
b) False
c) None
d) none of the mentioned
1. >>>"a"+"bc"
b) bc
c) bca
d) abc
1. >>>"abcd"[2:]
b) ab
c) cd
d) dc
a) string.ascii_lowercase_string.digits
b) string.ascii_lowercase+string.ascii_upercase
c) string.letters
d) string.lowercase_string.upercase
1. >>> str1 = 'hello'
2. >>> str2 = ','
3. >>> str3 = 'world'
4. >>> str1[-1:]
b) hello
c) h
d) o
a) +
b) *
c) –
d) All of the mentioned
1. >>>print (r"\nhello")
b) \nhello
c) the letter r and then hello
d) error
1. >>>print('new' 'line')
b) Output equivalent to print ‘new\nline’
c) newline
d) new line
>>> print(‘x\97\x98’)
a) Error
b) 97
98
c) x\97
d) \x97\x98
1. >>>str1="helloworld"
2. >>>str1[::-1]
b) hello
c) world
d) helloworld
a) 0xA0xB0xC
b) Error
c) 0x22
d) 33
print("ab\tcd\tef".expandtabs())
b) abcdef
c) ab\tcd\tef
d) ab cd ef
print("ab\tcd\tef".expandtabs(4))
b) abcdef
c) ab\tcd\tef
d) ab cd ef
print("ab\tcd\tef".expandtabs('+'))
b) ab++++++++cd++++++++ef
c) ab cd ef
d) none of the mentioned
print("abcdef".find("cd") == "cd" in "abcdef")
b) False
c) Error
d) None of the mentioned
print("abcdef".find("cd"))
b) 2
c) 3
d) None of the mentioned
print("ccdcddcd".find("c"))
b) 0
c) Error
d) True
print("Hello {0} and {1}".format('foo', 'bin'))
b) Hello {0} and {1} foo bin
c) Error
d) Hello 0 and 1
print("Hello {1} and {0}".format('bin', 'foo'))
b) Hello bin and foo
c) Error
d) None of the mentioned
print("Hello {} and {}".format('foo', 'bin'))
b) Hello {} and {}
c) Error
d) Hello and
print("Hello {name1} and {name2}".format('foo', 'bin'))
b) Hello {name1} and {name2}
c) Error
d) Hello and
print('for'.isidentifier())
b) False
c) None
d) Error
print('abc'.islower())
b) False
c) None
d) Error
print('a@ 1,'.islower())
b) False
c) None
d) Error
print('11'.isnumeric())
b) False
c) None
d) Error
print('1.1'.isnumeric())
b) False
c) None
d) Error
print('1@ a'.isprintable())
b) False
c) None
d) Error
print(''''''.isspace())
b) False
c) None
d) Error
print('\t'.isspace())
b) False
c) None
d) Error
print('HelloWorld'.istitle())
b) False
c) None
d) Error
print('Hello World'.istitle())
b) False
c) None
d) Error
a) list1 = list()
b) list1 = [].
c) list1 = list([1, 2, 3])
d) all of the mentioned
Top soccer bet of 2021 for korean players
ReplyDeleteTop soccer worrione bet of งานออนไลน์ 2021 for korean players · 10% of the wagers are on the Premier League · Only one sports team and one team 1xbet korean from the