ExamVeda
Login
Home
71
What will be the output of the following Python code?
import re
s = "A new day"
m = re.match(r'(.*)(.*?)', s)
print(m.group(2))
 
print(m.group(0))
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
72
What will be the output of the following Python code?
s = 'welcome home'
m = re.match(r'(.*)(.*?)', s)
print(m.group())
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
73
What is the output of the following code:
import re
pattern = re.compile(r'(d+)s(w+)')
result = pattern.findall('There are 5 apples and 3 oranges.')
print(result)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
74
The following Python code snippet results in an error.
c=re.compile(r'(\d+)(\[A-Z]+)([a-z]+)')
c.groupindex
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
75
What will be the output of the following Python code?
a = re.compile('0-9')
a.findall('3 trees')
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
76
The output of the following two Python codes are the same.
p = re.compile('hello')
r = p.match('hello everyone')
print(r.group(0))
 
r = re.match('hello', 'hello everyone')
print(r.group(0))
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
77
Which of the following functions creates a Python object?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
78
Which of the following special characters represents a comment (that is, the contents of the parenthesis are simply ignores)?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
79
What will be the output of the following Python code?
sentence = 'we are humans'
matched = re.match(r'(.*) (.*?) (.*)', sentence)
print(matched.groups())
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
80
Which of the following special characters matches a pattern only at the end of the string?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board