Thomas Scott
Quiz por , criado more than 1 year ago

This is a study guide for Compiler exam one.

19
0
0
Thomas Scott
Criado por Thomas Scott mais de 5 anos atrás
Fechar

Exam 1

Questão 1 de 12

1

An NFA's transition function returns

Selecione uma das seguintes:

  • A Boolean value

  • A state

  • A set of states

  • An edge

Explicação

Questão 2 de 12

1

Can a DFA simulate NFA

Selecione uma das seguintes:

  • No

  • Yes

  • Sometimes

  • Depends on NFA

Explicação

Questão 3 de 12

1

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

Selecione uma das seguintes:

  • %s HELLO

  • %x HELLO

  • %%x HELLO

  • %%s HELLO

Explicação

Questão 4 de 12

1

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

Selecione uma das seguintes:

  • 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

Explicação

Questão 5 de 12

1

Which of the following files is generated by Flex?

Selecione uma das seguintes:

  • tiger.ll

  • tiger.yy

  • lex.yy.cc

  • tokens.h

  • tiger.tab.cc

Explicação

Questão 6 de 12

1

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

Selecione uma das seguintes:

  • Syntax Analysis

  • Semantic Analysis

  • Scanner Generator

  • Lexical Analysis

Explicação

Questão 7 de 12

1

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

Selecione uma das seguintes:

  • Token, source program

  • Either of the two

  • Source program, tokens

  • None of the mentioned

Explicação

Questão 8 de 12

1

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

Selecione uma das seguintes:

  • Regular expressions, tokens

  • Regular expressions, scanner

  • Lexeme, scanner

  • Token, scanner

Explicação

Questão 9 de 12

1

Which of the following is NOT a feature of compiler?

Selecione uma das seguintes:

  • 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

Explicação

Questão 10 de 12

1

Which of the following pairs of regular expressions are equivalent?

Selecione uma das seguintes:

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

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

  • x+ and x+x*

  • All of the mentioned

Explicação

Questão 11 de 12

1

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

Selecione uma das seguintes:

  • {xy, xy}

  • {xx, xy, yx, yy}

  • {x,y}

  • {x, y, xy}

Explicação

Questão 12 de 12

1

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

Selecione uma das seguintes:

  • {x, y}

  • {xy}

  • {x}

  • {y}

Explicação