CS402 Midterm Lecture-wise Preparation by MAS All Rounder
- Type
- Midterm past paper
- Course
- CS402 Theory of Automata
- Size
- PDF 3.3 MB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 2, 3, 4 of 90. Download the file for all 90 pages.
Introduction to the course title, Formal and In-formal languages, Alphabets, Strings, Null string, Words, Valid and In-valid alphabets, length of a string, Reverse of a string, Defining languages, Descriptive definition of languages, EQUAL, EVEN-EVEN, INTEGER, EVEN, { an bn}, { an bn an }, factorial, FACTORIAL, DOUBLEFACTORIAL, SQUARE, DOUBLESQUARE, PRIME, PALINDROME.
What does automata mean?
It is the plural of automaton, and it means “something that works automatically”
Introduction to languages There are two types of languages
Formal Languages (Syntactic languages) Informal Languages (Semantic languages)
Alphabets
A finite non-empty set of symbols (called letters), is called an alphabet. It is denoted by Σ ( Greek letter sigma).
Example Σ = {a,b} Σ = {0,1} (important as this is the language which the computer understands.) Σ = {i,j,k}
Note Certain version of language ALGOL has 113 letters.
Σ (alphabet) includes letters, digits and a variety of operators including sequential operators such as GOTO and IF
Strings
Concatenation of finite number of letters from the alphabet is called a string.
Example If Σ = {a,b} then a, abab, aaabb, ababababababababab
Note
Empty string or null string Sometimes a string with no symbol at all is used, denoted by (Small Greek letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string.
The capital lambda will mostly be used to denote the empty string, in further discussion.
Words
Words are strings belonging to some language.
Example If Σ= {x} then a language L can be defined as L={xn : n=1,2,3,…..} or L={x,xx,xxx,….}
Here x,xx,… are the words of L
Note All words are strings, but not all strings are words.
Valid/In-valid alphabets While defining an alphabet, an alphabet may contain letters consisting of group of symbols for example Σ1= {B, aB, bab, d}.
Now consider an alphabet
Σ2= {B, Ba, bab, d} and a string BababB.
This string can be tokenized in two different ways
(Ba), (bab), (B)
(B), (abab), (B)
Which shows that the second group cannot be identified as a string, defined over Σ = {a, b}.
As when this string is scanned by the compiler (Lexical Analyzer), first symbol B is identified as a letter belonging to Σ, while for the second letter the lexical analyzer would not be able to identify, so while defining an alphabet it should be kept in mind that ambiguity should not be created.
Remarks
While defining an alphabet of letters consisting of more than one symbols, no letter should be started with the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in a letter of same alphabet.
Conclusion
Σ1= {B, aB, bab, d}
Σ2= {B, Ba, bab, d}
Σ1 is a valid alphabet while Σ2 is an in-valid alphabet.
Length of Strings
The length of string s, denoted by |s|, is the number of letters in the string.
Example Σ={a,b} s=ababa
|s|=5
Example Σ= {B, aB, bab, d}
s=BaBbabBd
Tokenizing=(B), (aB), (bab), (B), (d)
|s|=5
Reverse of a String
The reverse of a string s denoted by Rev(s) or sr, is obtained by writing the letters of s in reverse order.
Example If s=abc is a string defined over Σ={a,b,c} then Rev(s) or sr = cba
Example Σ= {B, aB, bab, d} s=BaBbabBd Rev(s)=dBbabaBB
Related CS402 files
All CS402 files →- CS402 Midterm Subjective by VU Topper RM Midterm PDF 546 KB
- CS402 Midterm Solved Paper by VUBuddy Midterm PDF 6.8 MB
- CS402 Midterm Quiz 1 May 2023 by Miss Mehwish Midterm PDF 425 KB
- CS402 Midterm MCQs by VU Topper RM Midterm PDF 965 KB
- CS402 Handouts Lectures 1-45 Handout PDF 11.8 MB
- CS402 Grand Quiz Mega File by Ans Mughal Quiz PDF 1.1 MB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.