SlideShare a Scribd company logo
1 of 7
Download to read offline
UNIVERSITY TEKNOLOGI MALAYSIA
MIDTERM TEST
SEMESTER I 2013/2014
CODE OF SUBJECT
: SCSJ3203
NAME OF SUBJECT
: Theory of Computer Science
YEAR/COURSE
: 3SCSJ, 3SCSR, 3SCSV, 3SCSI, 3SCSD, 3SCSB
TIME
: 10.15 am – 12.15 pm (2 hours)
DATE
: 31 October 2013
VANUE
: BK1 – BK6 (N28)
_____________________________________________________________________________________
INSTRUCTION TO THE STUDENTS
PART A
PART B

: 10 TRUE/FALSE QUESTIONS (10 MARKS)
: 10 SUBJECTIVE QUESTIONS (90 MARKS)

THIS PAPER CONSIST OF 2 PARTS. ANSWER ALL QUESTION IN THE SPACE PROVIDED IN THIS QUESTION
PAPER. THE MARKS FOR EACH QUESTION IS AS INDICATED.

ANSWER ALL QUESTION IN THE SPACES ALLOCATED IN THIS BOOKLET.

Name
IC (or matric) number
Name of lecturer
Subject code and section

SCJ3203 Section 01 / 02 / 03 / 04 / 05 / 06
(pls. circle tour section)

This examination book consists of 6 printed pages excluding this page.
Part A – True and false questions

[10 marks]

_____________________________________________________________________________________
There are 10 questions in this section. For each question, state whether it is TRUE or FALSE and write your
answer in the space given. Each question carries 1 marks.

Answer
1.

λ is always subset of every set.

___________

2.

L1L2 = {xy | x ϵ L1 and y ϵ L2}, if L1 = {a, aa} and L2 = {λ, b, ab},
thus L1L2 = {a, b, aa, ab, aab, aaab}.

___________

3.

A regular expression for set of strings over {a, b} containing
two or more b’s is (a + b)*b(a + b)*b(a + b).

___________

4.

Two example expressions that represent the same set of
strings are (0 + 1 + λ)* and (0 + 1)*.

___________

5.

R = a* + b* generates any string with the combination of a’s
and b’s.

___________

6.

The following grammar; S → aS; S → baSS; S → b over
alphabet {a, b} is regular.

___________

7.

abab is generated by S → aX; X → bX; X → a;

___________

8.

A regular grammar does not generate the empty string.

___________

9.

A regular grammar is also a context-free grammar.

___________

10.

The following grammar; S → aX; X → bY; Y → aS; X → b;
generates the language of (aba)*ab.

___________

1
PART B – SUBJECTIVE QUESTIONS
[90 MARKS]
_____________________________________________________________________________________
This part consists of 10 structured questions. Answer all questions in the space provided. The marks for
each part of the question is as indicated.

1. Consider the language S* where S = {a, ab, ba}. Write three strings that are IN and NOT IN the
language in Table 1.
[6 marks]
Table 1

IN the language

NOT IN the language

2. For the two regular expression:
[4 marks]
r1 = a* + b*
r2 = ab* + ba* + b*a + (a*b)*
a. Find two strings corresponding to r2 but not r1.
b. Find two strings corresponding to both r1 and r2.

_____________________
_____________________

3. Find a regular expression corresponding to the following languages.
a. The language of all strings over the alphabet {a, b} that do not end with ba.
[4 marks]
___________________________________________________________________
b. The language of all strings over the alphabet {a, b} that contain no more than one
occurrence of the string bb.
[4 marks]
___________________________________________________________________
c. The language of strings of even lengths over the alphabet of {a, b}.
[4 marks]
___________________________________________________________________

2
4. Describe as simply as possible in English the language corresponding to the following regular
expressions
a. (b + aa)(a + b)*

[3 marks]

_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
b. a*b(a*ba*b)*a*

[3 marks]

_________________________________________________________________
_________________________________________________________________
_________________________________________________________________
5. construct a context-free grammar that generate the following language
a. {anbm | n<m}
[4 marks]
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

b. {a3nb2n | n ≥ 0}
[4 marks]
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

c. {a3n+1b2n | n ≥ 0}
[4 marks]
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

3
6. For each of the following context-free grammar, write the equivalent regular grammar and regular
expression.
[18 marks]
Context free grammar

Regular grammar

Regular expression

S → aBa
B → bB | λ
S → abS | λ
S → Aa
A → aA | bA | λ

7. Design a CFG rules for the following regular expression.

[4 marks]

(a + b)*aa(a + b)*
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________

8. Consider the following grammar
G1:

S → aSa | aBa
B → bB | b

a. Use the set notations to define the language generated by the grammar, L(G1).
[3 marks]
___________________________________________________________________________

b. What is the shortest string that can be produced from the grammar?
[1 mark]
___________________________________________________________________________

c. Write another possible string that can be generated from the language.
[1 mark]
___________________________________________________________________________

4
9. Let G2 be the grammar
S → AB
A → aA | λ
B → bB | λ
a. Give a leftmost derivation of the string aabbb.
[3 marks]
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

b. Give the rightmost derivation of string abbbb.
[3 marks]
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________

c. Build the derivation tree for the derivations in parts (a) and (b).

[4 marks]

5
d. Give a regular expression for L(G2). _________________________

[3 marks]

10. The following is a CFG to generate a language.
S → A1B
A → 0A | λ
B → 0B | 1B | λ
a. Give leftmost derivations of the following string.

[6 marks]

i. 00101
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

ii. 10001
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

b. What is the regular expression for this CFG.

[4 marks]

___________________________________________________________________________

-END OF QUESTIONS6

More Related Content

What's hot

Comparative study of various approaches for transaction Fraud Detection using...
Comparative study of various approaches for transaction Fraud Detection using...Comparative study of various approaches for transaction Fraud Detection using...
Comparative study of various approaches for transaction Fraud Detection using...Pratibha Singh
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programmingShakil Ahmed
 
Heuristic search
Heuristic searchHeuristic search
Heuristic searchNivethaS35
 
Managing contracts
Managing contractsManaging contracts
Managing contractstumetr1
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4SIMONTHOMAS S
 

What's hot (6)

Comparative study of various approaches for transaction Fraud Detection using...
Comparative study of various approaches for transaction Fraud Detection using...Comparative study of various approaches for transaction Fraud Detection using...
Comparative study of various approaches for transaction Fraud Detection using...
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
Managing contracts
Managing contractsManaging contracts
Managing contracts
 
CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4CS8494 SOFTWARE ENGINEERING Unit-4
CS8494 SOFTWARE ENGINEERING Unit-4
 
Fagan Inspection
Fagan InspectionFagan Inspection
Fagan Inspection
 

Similar to SCSJ3203 - Theory Science Computer - Midterm Paper

0580_w14_qp_21
0580_w14_qp_210580_w14_qp_21
0580_w14_qp_21King Ali
 
0580_w13_qp_23
0580_w13_qp_230580_w13_qp_23
0580_w13_qp_23King Ali
 
0580 w13 qp_21
0580 w13 qp_210580 w13 qp_21
0580 w13 qp_21King Ali
 
0580_w13_qp_21
0580_w13_qp_210580_w13_qp_21
0580_w13_qp_21King Ali
 
Mid module 1 test review
Mid module 1 test reviewMid module 1 test review
Mid module 1 test reviewmlabuski
 
Activity 3 (answer key)
Activity 3 (answer key)Activity 3 (answer key)
Activity 3 (answer key)juljuliemer
 
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docx
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docxMath 107 Final ExaminationSpring, 20131Math 107 College Algebr.docx
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docxandreecapon
 
Fall Semester Review Part A Alg 1 B
Fall Semester Review Part A Alg 1 BFall Semester Review Part A Alg 1 B
Fall Semester Review Part A Alg 1 BSedona Red Rock HS
 
Final exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionFinal exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionKumar Subramaniam
 
Final exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionFinal exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionKumar Subramaniam
 
11-Plus-Maths.pdf
11-Plus-Maths.pdf11-Plus-Maths.pdf
11-Plus-Maths.pdfbfan2014
 
G6 m5-b-lesson 8-note sheet
G6 m5-b-lesson 8-note sheetG6 m5-b-lesson 8-note sheet
G6 m5-b-lesson 8-note sheetmlabuski
 
Mathematics Mid Year Form 4 Paper 2 2010
Mathematics Mid Year Form 4 Paper 2 2010Mathematics Mid Year Form 4 Paper 2 2010
Mathematics Mid Year Form 4 Paper 2 2010sue sha
 
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016SyinMei My
 

Similar to SCSJ3203 - Theory Science Computer - Midterm Paper (20)

Math practice
Math practiceMath practice
Math practice
 
Mama march 13
Mama march 13Mama march 13
Mama march 13
 
0580_w14_qp_21
0580_w14_qp_210580_w14_qp_21
0580_w14_qp_21
 
0580_w13_qp_23
0580_w13_qp_230580_w13_qp_23
0580_w13_qp_23
 
apostia
apostia apostia
apostia
 
0580 w13 qp_21
0580 w13 qp_210580 w13 qp_21
0580 w13 qp_21
 
0580_w13_qp_21
0580_w13_qp_210580_w13_qp_21
0580_w13_qp_21
 
Mid module 1 test review
Mid module 1 test reviewMid module 1 test review
Mid module 1 test review
 
Activity 3 (answer key)
Activity 3 (answer key)Activity 3 (answer key)
Activity 3 (answer key)
 
ใบงานที่ 5
ใบงานที่ 5 ใบงานที่ 5
ใบงานที่ 5
 
Pp1 sunieta
Pp1 sunietaPp1 sunieta
Pp1 sunieta
 
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docx
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docxMath 107 Final ExaminationSpring, 20131Math 107 College Algebr.docx
Math 107 Final ExaminationSpring, 20131Math 107 College Algebr.docx
 
Fall Semester Review Part A Alg 1 B
Fall Semester Review Part A Alg 1 BFall Semester Review Part A Alg 1 B
Fall Semester Review Part A Alg 1 B
 
Modul sept okt tahun 3
Modul sept okt tahun 3Modul sept okt tahun 3
Modul sept okt tahun 3
 
Final exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionFinal exam year 1 paper 2 revision
Final exam year 1 paper 2 revision
 
Final exam year 1 paper 2 revision
Final exam year 1 paper 2 revisionFinal exam year 1 paper 2 revision
Final exam year 1 paper 2 revision
 
11-Plus-Maths.pdf
11-Plus-Maths.pdf11-Plus-Maths.pdf
11-Plus-Maths.pdf
 
G6 m5-b-lesson 8-note sheet
G6 m5-b-lesson 8-note sheetG6 m5-b-lesson 8-note sheet
G6 m5-b-lesson 8-note sheet
 
Mathematics Mid Year Form 4 Paper 2 2010
Mathematics Mid Year Form 4 Paper 2 2010Mathematics Mid Year Form 4 Paper 2 2010
Mathematics Mid Year Form 4 Paper 2 2010
 
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016
Bahasa Inggeris Tahun 1 Kertas 1 Ogos 2016
 

More from Abdul Khaliq

UHB 3022 / ULAB 3122 - Final Exam Paper
 UHB 3022 / ULAB 3122 - Final Exam Paper UHB 3022 / ULAB 3122 - Final Exam Paper
UHB 3022 / ULAB 3122 - Final Exam PaperAbdul Khaliq
 
SCSJ3553 - Artificial Intelligence Final Exam paper - UTM
SCSJ3553 - Artificial Intelligence Final Exam paper - UTMSCSJ3553 - Artificial Intelligence Final Exam paper - UTM
SCSJ3553 - Artificial Intelligence Final Exam paper - UTMAbdul Khaliq
 
ULAB3122 / UHS3022 - Final Exam Paper
ULAB3122 / UHS3022 - Final Exam PaperULAB3122 / UHS3022 - Final Exam Paper
ULAB3122 / UHS3022 - Final Exam PaperAbdul Khaliq
 
ULAB3122 / UHS3022 - Final Exam Paper (2009)
ULAB3122 / UHS3022 - Final Exam Paper (2009)ULAB3122 / UHS3022 - Final Exam Paper (2009)
ULAB3122 / UHS3022 - Final Exam Paper (2009)Abdul Khaliq
 
UHB2422 / ULAB2112 - Final exam paper with answer sample
UHB2422 / ULAB2112 - Final exam paper with answer sampleUHB2422 / ULAB2112 - Final exam paper with answer sample
UHB2422 / ULAB2112 - Final exam paper with answer sampleAbdul Khaliq
 
UHB2422 / ULAB2112 - Final exam paper
UHB2422 / ULAB2112 - Final exam paperUHB2422 / ULAB2112 - Final exam paper
UHB2422 / ULAB2112 - Final exam paperAbdul Khaliq
 
Soalan orienteering
Soalan orienteeringSoalan orienteering
Soalan orienteeringAbdul Khaliq
 
Orienteering - titik utara
Orienteering - titik utaraOrienteering - titik utara
Orienteering - titik utaraAbdul Khaliq
 
orienteering - saling pandang
orienteering - saling pandangorienteering - saling pandang
orienteering - saling pandangAbdul Khaliq
 
orienteering - cerun
orienteering - cerunorienteering - cerun
orienteering - cerunAbdul Khaliq
 
orenteering - mengenal cerun
orenteering - mengenal cerunorenteering - mengenal cerun
orenteering - mengenal cerunAbdul Khaliq
 
Orienteering - kompas prismatik
Orienteering - kompas prismatikOrienteering - kompas prismatik
Orienteering - kompas prismatikAbdul Khaliq
 
UICI 2022 - Bab 04 teknologi dalam islam (nota)
UICI 2022 - Bab 04 teknologi dalam islam (nota)UICI 2022 - Bab 04 teknologi dalam islam (nota)
UICI 2022 - Bab 04 teknologi dalam islam (nota)Abdul Khaliq
 
UICI 2022 - Bab 03 sains dan islam (nota)
UICI 2022 - Bab 03 sains dan islam (nota)UICI 2022 - Bab 03 sains dan islam (nota)
UICI 2022 - Bab 03 sains dan islam (nota)Abdul Khaliq
 
UICI 2022 - Bab 02 perpindahan ilmu (nota)
UICI 2022 - Bab 02 perpindahan ilmu (nota)UICI 2022 - Bab 02 perpindahan ilmu (nota)
UICI 2022 - Bab 02 perpindahan ilmu (nota)Abdul Khaliq
 
UICI 2022 -Bab 01 manusia dan ilmu (nota)
UICI 2022 -Bab 01 manusia dan ilmu (nota)UICI 2022 -Bab 01 manusia dan ilmu (nota)
UICI 2022 -Bab 01 manusia dan ilmu (nota)Abdul Khaliq
 
Computational mathematic
Computational mathematicComputational mathematic
Computational mathematicAbdul Khaliq
 
A intro uici 2022 sains teknologi dan manusia
A intro uici 2022   sains teknologi dan manusiaA intro uici 2022   sains teknologi dan manusia
A intro uici 2022 sains teknologi dan manusiaAbdul Khaliq
 
UICI 2022 - sains dan islam
UICI 2022 - sains dan islamUICI 2022 - sains dan islam
UICI 2022 - sains dan islamAbdul Khaliq
 
UICI 2022 - Perpindahan ilmu
UICI 2022 - Perpindahan ilmuUICI 2022 - Perpindahan ilmu
UICI 2022 - Perpindahan ilmuAbdul Khaliq
 

More from Abdul Khaliq (20)

UHB 3022 / ULAB 3122 - Final Exam Paper
 UHB 3022 / ULAB 3122 - Final Exam Paper UHB 3022 / ULAB 3122 - Final Exam Paper
UHB 3022 / ULAB 3122 - Final Exam Paper
 
SCSJ3553 - Artificial Intelligence Final Exam paper - UTM
SCSJ3553 - Artificial Intelligence Final Exam paper - UTMSCSJ3553 - Artificial Intelligence Final Exam paper - UTM
SCSJ3553 - Artificial Intelligence Final Exam paper - UTM
 
ULAB3122 / UHS3022 - Final Exam Paper
ULAB3122 / UHS3022 - Final Exam PaperULAB3122 / UHS3022 - Final Exam Paper
ULAB3122 / UHS3022 - Final Exam Paper
 
ULAB3122 / UHS3022 - Final Exam Paper (2009)
ULAB3122 / UHS3022 - Final Exam Paper (2009)ULAB3122 / UHS3022 - Final Exam Paper (2009)
ULAB3122 / UHS3022 - Final Exam Paper (2009)
 
UHB2422 / ULAB2112 - Final exam paper with answer sample
UHB2422 / ULAB2112 - Final exam paper with answer sampleUHB2422 / ULAB2112 - Final exam paper with answer sample
UHB2422 / ULAB2112 - Final exam paper with answer sample
 
UHB2422 / ULAB2112 - Final exam paper
UHB2422 / ULAB2112 - Final exam paperUHB2422 / ULAB2112 - Final exam paper
UHB2422 / ULAB2112 - Final exam paper
 
Soalan orienteering
Soalan orienteeringSoalan orienteering
Soalan orienteering
 
Orienteering - titik utara
Orienteering - titik utaraOrienteering - titik utara
Orienteering - titik utara
 
orienteering - saling pandang
orienteering - saling pandangorienteering - saling pandang
orienteering - saling pandang
 
orienteering - cerun
orienteering - cerunorienteering - cerun
orienteering - cerun
 
orenteering - mengenal cerun
orenteering - mengenal cerunorenteering - mengenal cerun
orenteering - mengenal cerun
 
Orienteering - kompas prismatik
Orienteering - kompas prismatikOrienteering - kompas prismatik
Orienteering - kompas prismatik
 
UICI 2022 - Bab 04 teknologi dalam islam (nota)
UICI 2022 - Bab 04 teknologi dalam islam (nota)UICI 2022 - Bab 04 teknologi dalam islam (nota)
UICI 2022 - Bab 04 teknologi dalam islam (nota)
 
UICI 2022 - Bab 03 sains dan islam (nota)
UICI 2022 - Bab 03 sains dan islam (nota)UICI 2022 - Bab 03 sains dan islam (nota)
UICI 2022 - Bab 03 sains dan islam (nota)
 
UICI 2022 - Bab 02 perpindahan ilmu (nota)
UICI 2022 - Bab 02 perpindahan ilmu (nota)UICI 2022 - Bab 02 perpindahan ilmu (nota)
UICI 2022 - Bab 02 perpindahan ilmu (nota)
 
UICI 2022 -Bab 01 manusia dan ilmu (nota)
UICI 2022 -Bab 01 manusia dan ilmu (nota)UICI 2022 -Bab 01 manusia dan ilmu (nota)
UICI 2022 -Bab 01 manusia dan ilmu (nota)
 
Computational mathematic
Computational mathematicComputational mathematic
Computational mathematic
 
A intro uici 2022 sains teknologi dan manusia
A intro uici 2022   sains teknologi dan manusiaA intro uici 2022   sains teknologi dan manusia
A intro uici 2022 sains teknologi dan manusia
 
UICI 2022 - sains dan islam
UICI 2022 - sains dan islamUICI 2022 - sains dan islam
UICI 2022 - sains dan islam
 
UICI 2022 - Perpindahan ilmu
UICI 2022 - Perpindahan ilmuUICI 2022 - Perpindahan ilmu
UICI 2022 - Perpindahan ilmu
 

Recently uploaded

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

SCSJ3203 - Theory Science Computer - Midterm Paper

  • 1. UNIVERSITY TEKNOLOGI MALAYSIA MIDTERM TEST SEMESTER I 2013/2014 CODE OF SUBJECT : SCSJ3203 NAME OF SUBJECT : Theory of Computer Science YEAR/COURSE : 3SCSJ, 3SCSR, 3SCSV, 3SCSI, 3SCSD, 3SCSB TIME : 10.15 am – 12.15 pm (2 hours) DATE : 31 October 2013 VANUE : BK1 – BK6 (N28) _____________________________________________________________________________________ INSTRUCTION TO THE STUDENTS PART A PART B : 10 TRUE/FALSE QUESTIONS (10 MARKS) : 10 SUBJECTIVE QUESTIONS (90 MARKS) THIS PAPER CONSIST OF 2 PARTS. ANSWER ALL QUESTION IN THE SPACE PROVIDED IN THIS QUESTION PAPER. THE MARKS FOR EACH QUESTION IS AS INDICATED. ANSWER ALL QUESTION IN THE SPACES ALLOCATED IN THIS BOOKLET. Name IC (or matric) number Name of lecturer Subject code and section SCJ3203 Section 01 / 02 / 03 / 04 / 05 / 06 (pls. circle tour section) This examination book consists of 6 printed pages excluding this page.
  • 2. Part A – True and false questions [10 marks] _____________________________________________________________________________________ There are 10 questions in this section. For each question, state whether it is TRUE or FALSE and write your answer in the space given. Each question carries 1 marks. Answer 1. λ is always subset of every set. ___________ 2. L1L2 = {xy | x ϵ L1 and y ϵ L2}, if L1 = {a, aa} and L2 = {λ, b, ab}, thus L1L2 = {a, b, aa, ab, aab, aaab}. ___________ 3. A regular expression for set of strings over {a, b} containing two or more b’s is (a + b)*b(a + b)*b(a + b). ___________ 4. Two example expressions that represent the same set of strings are (0 + 1 + λ)* and (0 + 1)*. ___________ 5. R = a* + b* generates any string with the combination of a’s and b’s. ___________ 6. The following grammar; S → aS; S → baSS; S → b over alphabet {a, b} is regular. ___________ 7. abab is generated by S → aX; X → bX; X → a; ___________ 8. A regular grammar does not generate the empty string. ___________ 9. A regular grammar is also a context-free grammar. ___________ 10. The following grammar; S → aX; X → bY; Y → aS; X → b; generates the language of (aba)*ab. ___________ 1
  • 3. PART B – SUBJECTIVE QUESTIONS [90 MARKS] _____________________________________________________________________________________ This part consists of 10 structured questions. Answer all questions in the space provided. The marks for each part of the question is as indicated. 1. Consider the language S* where S = {a, ab, ba}. Write three strings that are IN and NOT IN the language in Table 1. [6 marks] Table 1 IN the language NOT IN the language 2. For the two regular expression: [4 marks] r1 = a* + b* r2 = ab* + ba* + b*a + (a*b)* a. Find two strings corresponding to r2 but not r1. b. Find two strings corresponding to both r1 and r2. _____________________ _____________________ 3. Find a regular expression corresponding to the following languages. a. The language of all strings over the alphabet {a, b} that do not end with ba. [4 marks] ___________________________________________________________________ b. The language of all strings over the alphabet {a, b} that contain no more than one occurrence of the string bb. [4 marks] ___________________________________________________________________ c. The language of strings of even lengths over the alphabet of {a, b}. [4 marks] ___________________________________________________________________ 2
  • 4. 4. Describe as simply as possible in English the language corresponding to the following regular expressions a. (b + aa)(a + b)* [3 marks] _________________________________________________________________ _________________________________________________________________ _________________________________________________________________ b. a*b(a*ba*b)*a* [3 marks] _________________________________________________________________ _________________________________________________________________ _________________________________________________________________ 5. construct a context-free grammar that generate the following language a. {anbm | n<m} [4 marks] ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ b. {a3nb2n | n ≥ 0} [4 marks] ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ c. {a3n+1b2n | n ≥ 0} [4 marks] ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ 3
  • 5. 6. For each of the following context-free grammar, write the equivalent regular grammar and regular expression. [18 marks] Context free grammar Regular grammar Regular expression S → aBa B → bB | λ S → abS | λ S → Aa A → aA | bA | λ 7. Design a CFG rules for the following regular expression. [4 marks] (a + b)*aa(a + b)* ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ 8. Consider the following grammar G1: S → aSa | aBa B → bB | b a. Use the set notations to define the language generated by the grammar, L(G1). [3 marks] ___________________________________________________________________________ b. What is the shortest string that can be produced from the grammar? [1 mark] ___________________________________________________________________________ c. Write another possible string that can be generated from the language. [1 mark] ___________________________________________________________________________ 4
  • 6. 9. Let G2 be the grammar S → AB A → aA | λ B → bB | λ a. Give a leftmost derivation of the string aabbb. [3 marks] ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ b. Give the rightmost derivation of string abbbb. [3 marks] ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ ___________________________________________________________________________ c. Build the derivation tree for the derivations in parts (a) and (b). [4 marks] 5
  • 7. d. Give a regular expression for L(G2). _________________________ [3 marks] 10. The following is a CFG to generate a language. S → A1B A → 0A | λ B → 0B | 1B | λ a. Give leftmost derivations of the following string. [6 marks] i. 00101 ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ii. 10001 ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ ____________________________________________________________________ b. What is the regular expression for this CFG. [4 marks] ___________________________________________________________________________ -END OF QUESTIONS6