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

Reinforcement Learning for Algorithmic Trading
Reinforcement Learning for Algorithmic TradingReinforcement Learning for Algorithmic Trading
Reinforcement Learning for Algorithmic TradingSynaptonIncorporated
 
Ueda2015 type 2 dm management dr.mesbah kamel
Ueda2015  type 2 dm management dr.mesbah kamelUeda2015  type 2 dm management dr.mesbah kamel
Ueda2015 type 2 dm management dr.mesbah kamelueda2015
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersCarlos Sierra
 
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdfDifference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdfMahbubay Rabbani Mim
 
Nori: The Official Elasticsearch Plugin for Korean Language Analysis
Nori: The Official Elasticsearch Plugin for Korean Language AnalysisNori: The Official Elasticsearch Plugin for Korean Language Analysis
Nori: The Official Elasticsearch Plugin for Korean Language AnalysisElasticsearch
 

What's hot (6)

Reinforcement Learning for Algorithmic Trading
Reinforcement Learning for Algorithmic TradingReinforcement Learning for Algorithmic Trading
Reinforcement Learning for Algorithmic Trading
 
Ueda2015 type 2 dm management dr.mesbah kamel
Ueda2015  type 2 dm management dr.mesbah kamelUeda2015  type 2 dm management dr.mesbah kamel
Ueda2015 type 2 dm management dr.mesbah kamel
 
Understanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginnersUnderstanding SQL Trace, TKPROF and Execution Plan for beginners
Understanding SQL Trace, TKPROF and Execution Plan for beginners
 
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdfDifference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdf
 
Nori: The Official Elasticsearch Plugin for Korean Language Analysis
Nori: The Official Elasticsearch Plugin for Korean Language AnalysisNori: The Official Elasticsearch Plugin for Korean Language Analysis
Nori: The Official Elasticsearch Plugin for Korean Language Analysis
 
Les 16 resource
Les 16 resourceLes 16 resource
Les 16 resource
 

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

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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
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
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
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
 

Recently uploaded (20)

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
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
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
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
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
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
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 ...
 

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