Python
Python
Python
given below.
A. Identifiers are used for identifying entities in a
program.
B. We can use any special character
like @,#,$ as part of identifiers.
C. 1st_string is a valid identifier.
D. string_1 is valid identifier.
E. Identifiers can be of any length.
Select all the correct statements given
below.
A. Python version 3.5 has 33 keywords.
B. true is a valid keyword in Python.
C. Python is a case sensitive language. In Python True is a
keyword and not true.
D. The keyword nonlocal does not exist in Python 2.
E. Interpreter raises an error when you try to use keyword
as a name of an entity.
F. A programmer can easily modify the keywords.
G. Programmers can't modify the keywords as they are
built into the language.
What will be the output of the following code:
print type(type(int))
A. type 'int'
B. type 'type'
C.Error
D. 0
What is the output of the following code :
L = ['a','b','c','d']
print "".join(L)
A. Error
B. None
C. abcd
D. [‘a’,’b’,’c’,’d’]
What is the output of the following segment :
chr(ord('A'))
A. A
B. B
C. a
D. Error
What is the output of the following program :
y=8
z = lambda x : x * y
print z(6)
A. 48
B. 14
C. 64
A. dlroW olleH
B. Hello Worl
C. d
D. Error
What is the output of the following program :
print 0.1 + 0.2 == 0.3
Run on IDE
A. True
B. False
C. Machine dependent
D. Error
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
What does ~~~~~~5 evaluate to?
A. +5
B. -11
C. +11
D. -5
Given a string s = “Welcome”, which of the
following code is incorrect?
A. print s[0]
B. print s.lower()
C. s[1] = ‘r’
D. print s.strip()
What is the output of the following program :
import re
sentence = 'horses are fast'
regex = re.compile('(?P<animal>w+) (?P<verb>w+) (?P<adjective>w+)')
matched = re.search(regex, sentence)
print(matched.groupdict())
D. ‘are’
Which of the following is correct about Python?