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

Similar to SCSJ3203 - Theory Science Computer - Midterm Paper

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
 
Student ________________________ Course-Section ______________.docx
Student  ________________________ Course-Section  ______________.docxStudent  ________________________ Course-Section  ______________.docx
Student ________________________ Course-Section ______________.docxflorriezhamphrey3065
 
0580_s14_qp_21
0580_s14_qp_210580_s14_qp_21
0580_s14_qp_21King Ali
 
Introduction to Christian Education: Final Exam 2011
Introduction to Christian Education: Final Exam 2011Introduction to Christian Education: Final Exam 2011
Introduction to Christian Education: Final Exam 2011Richard Chamberlain
 

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

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
 
Student ________________________ Course-Section ______________.docx
Student  ________________________ Course-Section  ______________.docxStudent  ________________________ Course-Section  ______________.docx
Student ________________________ Course-Section ______________.docx
 
0580_s14_qp_21
0580_s14_qp_210580_s14_qp_21
0580_s14_qp_21
 
Introduction to Christian Education: Final Exam 2011
Introduction to Christian Education: Final Exam 2011Introduction to Christian Education: Final Exam 2011
Introduction to Christian Education: Final Exam 2011
 

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

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
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
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 

Recently uploaded (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
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...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

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