Question
$string1 = "Hello World\n";
if ($string1 =~ m/(H..).(l..)/) {
print "We matched '$1' and '$2'.\n";
}
a.
We matched ‘Hel’ and ‘ld’
b.
We matched ‘Hel’ and ‘lld’
c.
We matched ‘Hel’ and ‘lo ‘
d.
None of the mentioned
Posted under Formal Languages and Automata Theory
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What does the following segment of code output?
Similar Questions
Discover Related MCQs
Q. Conversion of a regular expression into its corresponding NFA :
View solution
Q. Which among the following is not a UNIX command for regular expressions?
View solution
Q. What is the significance of $ used in regular expression in UNIX?
View solution
Q. Generate the regular expression to match blank lines
View solution
Q. For the given syntax of sed, which among the following is not a correct option?
General syntax of sed: /pattern/action
View solution
Q. What does grep do in UNIX?
View solution
Q. State true or false:
Statement: A regular expression is a sequence of characters that represent a pattern.
View solution
Q. Which of the following options support the given statement?
Statement: A regular expression could be a fixed word or describe something like more general.
View solution
Q. What does the following segment of code does?
grep -i man heroes.txt
View solution
Q. What does “X?” do regular expression operator?
View solution
Q. Which of the following does not support regular expressions?
View solution
Q. Lexemes can be referred to as:
View solution
Q. If the lexical analyser finds a lexeme with the same name as that of a reserved word,it _________
View solution
Q. The methodology to show an error when the analyzer faces a keyword over an user’s input is based on:
View solution
Q. State true or false:
Statement: A lexical analyzer reads the source code line by line.
View solution
Q. The scanner outputs:
View solution
Q. The phase of compilation which involves type checking is:
View solution
Q. Which among the following is not a tool to construct lexical analyzer from a regular expression?
View solution
Q. A program that performs lexical analysis is termed as:
View solution
Q. Lexers and parsers are not found in which of the following?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Formal Languages and Automata Theory? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!