
Compiler Brain Teasers: Lexical Edition

Quiz
•
Computers
•
University
•
Hard
DEVA I.
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main role of a lexical analyzer in a compiler?
Optimize intermediate code
Parse the syntax of the program
Translate code to machine language
Convert source code into tokens
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is used by Lex to describe patterns for tokens?
Assembly instructions
Regular expressions
Context-free grammar
DFA transition tables
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In Lex, which variable stores the matched lexeme?
yytok
yylval
yytext
yyparse
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What function is called to start the scanning process in a Lex program?
main()
yylex()
yytext()
scanf()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following regular expressions matches a valid identifier in C?
[0-9][a-zA-Z_]*
[a-zA-Z_][a-zA-Z0-9_]*
[A-Z_][0-9a-z]*
[a-z][A-Z]*
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the use of the %% symbol in a Lex file?
Starts the C code section
Denotes the end of file
Separates sections (definitions, rules, C code)
Comments out code
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of Lex after processing input?
Syntax tree
Assembly code
Intermediate code
Token stream
Create a free account and access millions of resources
Similar Resources on Wayground
11 questions
Pointers

Quiz
•
University
10 questions
C Programming Quiz-1

Quiz
•
University
10 questions
Python Dictionaries

Quiz
•
University
10 questions
Database Fundamentals

Quiz
•
KG - University
15 questions
PMW QUIZ

Quiz
•
University
9 questions
CD S8 3-2-23

Quiz
•
University
11 questions
Java Quiz 3 - Array

Quiz
•
University
10 questions
Mastering String Operations in Python

Quiz
•
9th Grade - University
Popular Resources on Wayground
12 questions
Unit Zero lesson 2 cafeteria

Lesson
•
9th - 12th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
20 questions
Lab Safety and Equipment

Quiz
•
8th Grade
13 questions
25-26 Behavior Expectations Matrix

Quiz
•
9th - 12th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
15 questions
Let's Take a Poll...

Quiz
•
9th Grade - University
2 questions
Pronouncing Names Correctly

Quiz
•
University
12 questions
Civil War

Quiz
•
8th Grade - University
18 questions
Parent Functions

Quiz
•
9th Grade - University
21 questions
Mapa países hispanohablantes

Quiz
•
1st Grade - University
19 questions
Primary v. Secondary Sources

Quiz
•
6th Grade - University
25 questions
Identifying Parts of Speech

Quiz
•
8th Grade - University
20 questions
Disney Trivia

Quiz
•
University