Thomas Scott
Quiz by , created more than 1 year ago

This is a study guide for Compiler exam one.

22
0
0
Thomas Scott
Created by Thomas Scott almost 6 years ago
Close

Exam 1

Question 1 of 12

1

An NFA's transition function returns

Select one of the following:

  • A Boolean value

  • A state

  • A set of states

  • An edge

Explanation

Question 2 of 12

1

Can a DFA simulate NFA

Select one of the following:

  • No

  • Yes

  • Sometimes

  • Depends on NFA

Explanation

Question 3 of 12

1

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

Select one of the following:

  • %s HELLO

  • %x HELLO

  • %%x HELLO

  • %%s HELLO

Explanation

Question 4 of 12

1

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

Select one of the following:

  • 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

Explanation

Question 5 of 12

1

Which of the following files is generated by Flex?

Select one of the following:

  • tiger.ll

  • tiger.yy

  • lex.yy.cc

  • tokens.h

  • tiger.tab.cc

Explanation

Question 6 of 12

1

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

Select one of the following:

  • Syntax Analysis

  • Semantic Analysis

  • Scanner Generator

  • Lexical Analysis

Explanation

Question 7 of 12

1

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

Select one of the following:

  • Token, source program

  • Either of the two

  • Source program, tokens

  • None of the mentioned

Explanation

Question 8 of 12

1

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

Select one of the following:

  • Regular expressions, tokens

  • Regular expressions, scanner

  • Lexeme, scanner

  • Token, scanner

Explanation

Question 9 of 12

1

Which of the following is NOT a feature of compiler?

Select one of the following:

  • 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

Explanation

Question 10 of 12

1

Which of the following pairs of regular expressions are equivalent?

Select one of the following:

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

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

  • x+ and x+x*

  • All of the mentioned

Explanation

Question 11 of 12

1

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

Select one of the following:

  • {xy, xy}

  • {xx, xy, yx, yy}

  • {x,y}

  • {x, y, xy}

Explanation

Question 12 of 12

1

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

Select one of the following:

  • {x, y}

  • {xy}

  • {x}

  • {y}

Explanation