Exam 1

Description

This is a study guide for Compiler exam one.
Thomas Scott
Quiz by Thomas Scott, updated more than 1 year ago
Thomas Scott
Created by Thomas Scott over 5 years ago
18
0

Resource summary

Question 1

Question
An NFA's transition function returns
Answer
  • A Boolean value
  • A state
  • A set of states
  • An edge

Question 2

Question
Can a DFA simulate NFA
Answer
  • No
  • Yes
  • Sometimes
  • Depends on NFA

Question 3

Question
In Flex, which of the following specifies an exclusive start condition HELLO?
Answer
  • %s HELLO
  • %x HELLO
  • %%x HELLO
  • %%s HELLO

Question 4

Question
In C++, which of the following is NOT considered as a static semantic error
Answer
  • 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

Question 5

Question
Which of the following files is generated by Flex?
Answer
  • tiger.ll
  • tiger.yy
  • lex.yy.cc
  • tokens.h
  • tiger.tab.cc

Question 6

Question
Which one of the following is not a stage of the compilation process?
Answer
  • Syntax Analysis
  • Semantic Analysis
  • Scanner Generator
  • Lexical Analysis

Question 7

Question
The lexical analyzer takes _______ as input and produces a stream of ______ as output.
Answer
  • Token, source program
  • Either of the two
  • Source program, tokens
  • None of the mentioned

Question 8

Question
The scanner generator takes _______ as input and produces ______ as output.
Answer
  • Regular expressions, tokens
  • Regular expressions, scanner
  • Lexeme, scanner
  • Token, scanner

Question 9

Question
Which of the following is NOT a feature of compiler?
Answer
  • 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

Question 10

Question
Which of the following pairs of regular expressions are equivalent?
Answer
  • 1(01)* and (10)*1
  • x(xx)* and (xx)*x
  • x+ and x+x*
  • All of the mentioned

Question 11

Question
The language of the regular expression (x | y)(x |y) is the set_____.
Answer
  • {xy, xy}
  • {xx, xy, yx, yy}
  • {x,y}
  • {x, y, xy}

Question 12

Question
The language of the regular expression x | y is the set ______.
Answer
  • {x, y}
  • {xy}
  • {x}
  • {y}
Show full summary Hide full summary

Similar

Computing Hardware - CPU and Memory
ollietablet123
SFDC App Builder 2
Parker Webb-Mitchell
Data Types
Jacob Sedore
Intake7 BIM L1
Stanley Chia
Software Processes
Nurul Aiman Abdu
Design Patterns
Erica Solum
CCNA Answers – CCNA Exam
Abdul Demir
Abstraction
Shannon Anderson-Rush
Spyware
Sam2
HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Data Analytics
anelvr