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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!