• Ei tuloksia

CS-C2150 Theoretical Computer ScienceSpring 2019Exam Wed 10 April 2019,

N/A
N/A
Info
Lataa
Protected

Academic year: 2022

Jaa "CS-C2150 Theoretical Computer ScienceSpring 2019Exam Wed 10 April 2019,"

Copied!
1
0
0

Kokoteksti

(1)

Aalto University, School of Science Department of Computer Science Pekka Orponen

CS-C2150 Theoretical Computer Science Spring 2019

Exam Wed 10 April 2019, 5—8 p.m.

Use of calculators is not allowed in the exam.

You are allowed to bring with you a single one-sided A4 "cheat sheet", personally handwritten by you. (NO photocopies, NO printouts, NO computer type-set text.) Please include your name and student ID at the top of the cheat sheet, and return it together with your answer sheets at the end of the exam.

Note: If you have not completed your computerised home assignments, your exam will not be graded.

1. Show that each of the following languages is regular, by describing it either in terms of a regular expression or in terms of a (deterministic or nondeterministic) finite automaton:

(a) {w e {0, 1} * I w contains three consequent zeros or three consequent ones (or both)}

(b) {w e {0, 1} * I w contains neither three consequent zeros nor three consequent ones}

(c) {w e {O, 1}* | the number of ones in w is a multiple of three (possibly zero)}

(d) {w e {0, 1}* | IWI 2 3 and the third-to-last symbol in w is a 1}

20 points 2. Consider the following context-free grammar G:

S aSB le

B — bBlb

(a) Describe the language generated by G in plain English, as simply as you can. (3 pts) (b) Show that G is ambiguous. (5 pts)

(c) Design an unambiguous grammar G/ that generates the same language as G. (5 pts) (d) Prove (precisely!) that the language generated by G is not regular. (7 pts)

20 points 3. A party walk is a sequence of consequent steps, whose direction with respect to the starting point is either forward (abbr. f), backward (b), left (l) or right (r). For instance, the sequenceflbbrrfrff describes the following walk, whose total result is to move the walker a distance of two steps forward (and concurrently two steps to the right):

b b

Design a context-free grammar that generates all party walks whose total result is to move the walker at least one step forward from the starting point (ignoring any possible sideways move- ment). Present a parse tree for the example sequence flbbrrfrff in your grammar.

10 points 4. Design a deterministic single-tape Turing machine that checks that the binary string it receives as input contains at least as many ones as zeros. (Present the machine preferably in the form of a state diagram rather than a transition table.) Show the accepting computation sequence ("run") of your machine on input 1001, and the rejecting computation sequence on input 010.

10 points

Viittaukset

LIITTYVÄT TIEDOSTOT

Each requirement man- agement step was analyzed separately (requirements step, design step, and im- plementation step). Analysis started from a requirements step. At first, the

In the work described herein, this model is employed to demonstrate that starting from claims/specifications about cooking (“culinary precisions”, see below), one may deal with

Tis Briefng Paper digests the foreign policy pri- orities of the CPC in the Party’s favoured historical narrative, the lessons learned from the collapse of the Soviet Union,

Ignoring species composition, the distribution of all trees by size is similar to the one observed in natural virgin forests that are presumably near the climax state (Fig. 68),

The starting point of the analysis is that a company is one phase in the end consumers' value creation process, and a life cycle approach to environmental issues may link

CS as a paradigm of ‘planned change’ means considering both the decisions regarding the change content and the change process together in the same change-strategic planning

One of the best-known sensors and regulators of the internal cell cycle control pathway is the tumor suppressor p53 whose upregulation after DNA-damage leads to growth arrest at

Which of the following figures (when seen from any direction) can she not get from the figure on the right side if she is.. allowed to move exactly