Thomas Scott
Quiz von , erstellt am more than 1 year ago

This is a study guide for Compiler exam one.

19
0
0
Thomas Scott
Erstellt von Thomas Scott vor mehr als 5 Jahre
Schließen

Exam 1

Frage 1 von 12

1

An NFA's transition function returns

Wähle eine der folgenden:

  • A Boolean value

  • A state

  • A set of states

  • An edge

Erklärung

Frage 2 von 12

1

Can a DFA simulate NFA

Wähle eine der folgenden:

  • No

  • Yes

  • Sometimes

  • Depends on NFA

Erklärung

Frage 3 von 12

1

In Flex, which of the following specifies an exclusive start condition HELLO?

Wähle eine der folgenden:

  • %s HELLO

  • %x HELLO

  • %%x HELLO

  • %%s HELLO

Erklärung

Frage 4 von 12

1

In C++, which of the following is NOT considered as a static semantic error

Wähle eine der folgenden:

  • Variables used without declaration

  • Redefinition of variables in the same scope

  • The number of arguments in a function call doesn't match the number of parameters in the function definition

  • Types of operands of an operator are not compatible

  • None of the above

Erklärung

Frage 5 von 12

1

Which of the following files is generated by Flex?

Wähle eine der folgenden:

  • tiger.ll

  • tiger.yy

  • lex.yy.cc

  • tokens.h

  • tiger.tab.cc

Erklärung

Frage 6 von 12

1

Which one of the following is not a stage of the compilation process?

Wähle eine der folgenden:

  • Syntax Analysis

  • Semantic Analysis

  • Scanner Generator

  • Lexical Analysis

Erklärung

Frage 7 von 12

1

The lexical analyzer takes _______ as input and produces a stream of ______ as output.

Wähle eine der folgenden:

  • Token, source program

  • Either of the two

  • Source program, tokens

  • None of the mentioned

Erklärung

Frage 8 von 12

1

The scanner generator takes _______ as input and produces ______ as output.

Wähle eine der folgenden:

  • Regular expressions, tokens

  • Regular expressions, scanner

  • Lexeme, scanner

  • Token, scanner

Erklärung

Frage 9 von 12

1

Which of the following is NOT a feature of compiler?

Wähle eine der folgenden:

  • Scan the entire program first and translate into machine code

  • To detect syntax errors

  • Optimize the generated code

  • Execution time is more comparing with pure interpreter

Erklärung

Frage 10 von 12

1

Which of the following pairs of regular expressions are equivalent?

Wähle eine der folgenden:

  • 1(01)* and (10)*1

  • x(xx)* and (xx)*x

  • x+ and x+x*

  • All of the mentioned

Erklärung

Frage 11 von 12

1

The language of the regular expression (x | y)(x |y) is the set_____.

Wähle eine der folgenden:

  • {xy, xy}

  • {xx, xy, yx, yy}

  • {x,y}

  • {x, y, xy}

Erklärung

Frage 12 von 12

1

The language of the regular expression x | y is the set ______.

Wähle eine der folgenden:

  • {x, y}

  • {xy}

  • {x}

  • {y}

Erklärung