Question
Instructions: Any Assignment submitted LATE , will be marked as ZERO . Any assignment found copied, will be marked as ZERO . No assignment will
Instructions:
Any Assignment submitted LATE, will be marked as ZERO.
Any assignment found copied, will be marked as ZERO.
No assignment will be accepted in hard form
Marks of Assignment are 6.
Solve the given problems carefully
Any Text Copied From Internet Will Be Marked As Zero
-----------------------------------------------------------------------------------------
1. Divide the following C++ program:
float limitedSquare(x) float x { /* returns x-squared, but never more than 100 */
return (x<=-10.0||x>=10.0)?100:x*x; }
into appropriate lexemes, using the discussion of Section 3.1.2 as a guide.
2. In a string of length n, how many of the following are there?
a) Prefixes.
b) Suffixes.
c) Proper prefixes.
d) Substrings.
e) Subsequences.
3. Write regular definitions for the following languages:
a) All strings of lowercase letters that contain the five vowels in order.
b) All strings of lowercase letters in which the letters are in ascending lexicographic order.
c) Comments, consisting of a string surrounded by /* and */, without an intervening */, unless it is inside double-quotes (").
d) All strings of digits with no repeated digits. Hint: Try this problem first with a few digits, such as {0,1,2}.
e) All strings of digits with at most one repeated digit.
f) All strings of a's and 6's with an even number of a's and an odd number of 6's.
g) The set of Chess moves, in the informal notation, such as p-k4 or kbpxqn.
h) All strings of a's and 6's that do not contain the substring a66.
i) All strings of a's and 6's that do not contain the subsequence a66.
4. Provide transition diagrams to recognize the same languages as each of the regular following expressions
a) (a|b)*a.
b) ((e|a)b*)*.
c) (a|b)*a(a|b)(a|b).
d) a*ba*ba*ba*.
e) (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started