Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

BARANI INSTITUTE OF MANAGEMENT SCIENCES

Mid-Term Exam Fall Semester 2020

Course Title : Compiler Construction Course Code : CS – 636


Discipline /Program : BSCS Total Marks : 12
Time allowed : 24 hours Instructor’s Name : Quratulain Alam

Question # 1: Minimize the following DFA. Σ = {a,b}


(4)

Question # 2: Convert the following Regular Expression (RE) to Deterministic Finite


Automaton (DFA) by Subset Construction Algorithm. Σ = {a,b,c,d} (4)

Regular Expression: ((a+b)|c)* ((a+b+c+d)*c)|d|abc*|d*


Question# 3. Write down the steps that how lexical analyzer will transform the following
code into Tokens. Explain the following code through Regular expressions, Regular
expressionsto NFA, NFA to DFA and DFA minimization. (4)

// C++ Program to display all elements


// of an initialized two dimensional array

#include <iostream>
using namespace std;

int main() {
int test[3][2] = {{2, -5},
{4, 0},
{9, 1}};

// use of nested for loop


// access rows of the array
for (int i = 0; i < 3; ++i) {

// access columns of the array


for (int j = 0; j < 2; ++j) {
cout << "test[" << i << "][" << j << "] = " << test[i][j] << endl;
}
}

return 0;
}

You might also like