Regular Expressions - 1,2

Description

Quiz on Regular Expressions - 1,2, created by Zarina Kiyakhmetova on 20/12/2018.
Zarina Kiyakhmetova
Quiz by Zarina Kiyakhmetova , updated more than 1 year ago
Zarina Kiyakhmetova
Created by Zarina Kiyakhmetova over 5 years ago
137
2

Resource summary

Question 1

Question
PHP has long supported two regular expression implementations known as _______ and _______ i) Perl ii) PEAR iii) Pearl iv) POSIX
Answer
  • a) i) and ii)
  • b) ii) and iv)
  • c) i) and iv)
  • d) ii) and iii)

Question 2

Question
Which one of the following regular expression matches any string containing zero or one p?
Answer
  • a) p+
  • b) p*
  • c) P?
  • d) p#

Question 3

Question
[:alpha:] can also be specified as..
Answer
  • a) [A-Za-z0-9].
  • b) [A-za-z].
  • c) [A-z].
  • d) [a-z].

Question 4

Question
How many functions does PHP offer for searching strings using POSIX style regular expression?
Answer
  • a) 7
  • b) 8
  • c) 9
  • d) 10

Question 5

Question
What will be the output of the following PHP code?
Answer
  • a) Error
  • b) Username must be all lowercase!
  • c) Username is all lowercase!
  • d) No Output is returned

Question 6

Question
POSIX implementation was deprecated in which version of PHP?
Answer
  • a) PHP 4
  • b) PHP 5
  • c) PHP 5.2
  • d) PHP 5.3

Question 7

Question
POSIX stands for
Answer
  • a) Portable Operating System Interface for Unix
  • b) Portable Operating System Interface for Linux
  • c) Portative Operating System Interface for Unix
  • d) Portative Operating System Interface for Linux

Question 8

Question
What will be the output of the following PHP code?
Answer
  • a) this is some text that we might like to parse.
  • b) Array ( [0] => some text that [1] => we might like to parse. )
  • c) Array ( [0] => this is [1] => some text that [2] => we might like to parse. )
  • d) [0] => this is [1] => some text that [2] => we might like to parse.

Question 9

Question
Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ? i) fol ii) fool iii) fooool iv) fooooool
Answer
  • a) Only i)
  • b) ii) and iii)
  • c) i), iii) and iv)
  • d) i) and iv)

Question 10

Question
Which among the following is/are not a metacharacter? i) \a ii) \A iii) \b iv) \B
Answer
  • a) Only i)
  • b) i) and iii)
  • c) ii), iii) and iv)
  • d) ii) and iv)

Question 11

Question
How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.
Answer
  • a) 7
  • b) 8
  • c) 9
  • d) 10

Question 12

Question
What will be the output of the following PHP code?
Answer
  • a) Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )
  • b) Array ( [3] => potatoes )
  • c) Array ( [1] => steak )
  • d) Array ( [0] => potatoes )

Question 13

Question
Say we have two compare two strings which of the following function/functions can you use? i) strcmp() ii) strcasecmp() iii) strspn() iv) strcspn()
Answer
  • a) i) and ii)
  • b) iii) and iv)
  • c) None of the mentioned
  • d) All of the mentioned

Question 14

Question
Which one of the following functions will convert a string to all uppercase?
Answer
  • a) strtoupper()
  • b) uppercase()
  • c) str_uppercase()
  • d) struppercase()

Question 15

Question
What will be the output of the following PHP code?
Answer
  • a) O’Malley Wins The Heavyweight Championship!
  • b) O’malley Wins The Heavyweight Championship!
  • c) O’Malley wins the heavyweight championship!
  • d) o’malley wins the heavyweight championship!

Question 16

Question
What will be the output of the following PHP code?
Answer
  • a) SaladSaladSaladSaladSalad is good
  • b) is good SaladSaladSaladSaladSalad
  • c) is good Salad
  • d) Salad is good

Question 17

Question
Which one of the following functions can be used to concatenate array elements to form a single delimited string?
Answer
  • a) explode()
  • b) implode()
  • c) concat()
  • d) concatenate()

Question 18

Question
Which one of the following functions finds the last occurrence of a string, returning its numerical position?
Answer
  • a) strlastpos()
  • b) strpos()
  • c) strlast()
  • d) strrpos()

Question 19

Question
What will be the output of the following PHP code?
Answer
  • a) Contact the author of this article at nachiketh@ex@mple.com
  • b) Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com
  • c) Contact the author of this article at n@chiketh@ex@mple.com
  • d) Error

Question 20

Question
What will be the output of the following PHP code?
Answer
  • a) nachiketh@example.com
  • b) nachiketh
  • c) nachiketh@
  • d) example.com
Show full summary Hide full summary

Similar

Unit 1: Government and Politics: The Constitution
LittleLauren:)
History of Medicine: Ancient Ideas
James McConnell
Definitions in AS chemistry
Stephen Cole
Key Events, People and Terms of the French Revolution
poppwalton
GCSE Chemistry - module c4
jessmitchell
Evolution
rebeccachelsea
TOK mindmap “Without application in the world, the value of knowledge is greatly diminished.”
Gabriela Serpa
PHR and SPHR Practice Questions
Elizabeth Rogers8284
Contract Law
sherhui94
Specifc Topic 7.4 Timber (Impacts)
T Andrews
Romeo and Juliet notes
Faizaan Mohmed