Week 4 - Day 2 - quizregularexpressions

Week 4 - Day 2 - quizregularexpressions

University

8 Qs

quiz-placeholder

Similar activities

PYTHON PROGRAMMING

PYTHON PROGRAMMING

University

10 Qs

Functions and Modules

Functions and Modules

University

10 Qs

Tutorat_8

Tutorat_8

University

8 Qs

Applet Java

Applet Java

University

10 Qs

Quiz 1

Quiz 1

University

5 Qs

Quiz 8

Quiz 8

University

10 Qs

python 19/5

python 19/5

University

7 Qs

Списки в Прологе

Списки в Прологе

University

10 Qs

Week 4 - Day 2 - quizregularexpressions

Week 4 - Day 2 - quizregularexpressions

Assessment

Quiz

Computers

University

Hard

Created by

Clinton Cunha

Used 12+ times

FREE Resource

8 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

What will the following code print?

Any line containing 'From'

Any line that starts with 'From'

Any line that starts with 'From:'

Any line containing 'From:'

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following options is the correct way to import the regex library?

import regex

import re

import Regex

import Re

3.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Which of these option(s) will match digits in a string? Select all that apply.

[0-9]

\D

\d

\w

4.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Media Image

Which of these lines will be matched when the following code is run?

It will cost you $1.00

From: stephen.marquard@uct.ac.za $a

$2.50 is your change

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

True or false? The following code will match only the first email(up to the @ sign) in the string?

True

False

6.

MULTIPLE SELECT QUESTION

2 mins • 1 pt

Which of the following options will the regular expression ^X-.*: [0-9.]+ match?

X-DSPAM-Probability: Accurate

X-DSPAM-Confidence: 0.8475

X-Wolverine-Confidence: 1

X Wolverine-Confidence: 0.53

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following regex statements will match and return any price of the form $3.45 or $23.32 or $400 found in the string ‘x’?

re.findall('\$\d+\.\d{2}', x)

re.findall('$\d+(?:\.\d{2})?', x)

re.findall('\$\D+(\.\D{2})?', x)

re.findall('\$\d+\.?\d{0,2}', x)

8.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The expression a{5} will match _____________ characters with the previous regular expression.

5 or less

exactly 5

5 or more

exactly 4