Computer Science > EXAM > Arizona State UniversityCSE 340Final Exam_ Principles of Programming Languages (All)
Question 1 1 / 1 pts Consider the following code: Token LexicalAnalyzer::GetToken() { input.GetChar(c); switch (c) { case '=': input.GetChar(c); if (c == ’=') { tmp.token_type = EQEQ; } el... se if (c == ’<') { tmp.token_type = EQLT; } else if (c == ’>') { tmp.token_type = EQGT; } else tmp.token_type = ERROR; return tmp; default: tmp.token_type = ERROR; return tmp; } } In the code, input.GetChar() gets the next character from standard input. If GetToken() is called four times on input <==<==, how many times is ERROR returned 0 1 2 Correct! Correct! 3 Question 2 1 / 1 pts letter = a | b | c | d LETTER = A | B | C | D1/16/2020 Final Exam: Principles of Programming Languages https://asuce.instructure.com/courses/1344/quizzes/17553?module_item_id=119038 2/20 digit = 4 | 5 | 6 | 7 | 9 Consider the regular expression R = (LETTER | digit | !) • (letter • digit) • (letter | digit). Which of the following is correct (more than one choice or no choice can be correct)? 1 * !5aA ∈ L(R1) ?55aA ∈ L(R1 ) 555aA ∈ L(R1 ) Correct! Correct! None of the above Question 3 1 / 1 pts Consider the regular expressions: R = ( a | b )* ( 0*1* ) ( a | b )* R = ( a | b ) ( 0*1* )* ( a | b ) Which of the following is true? 1 2 a0a ∈ L(R1) and ab01a ∈ L(R2) Correct! Correct! a0a ∈ L(R1) and ab01a ∉ L(R2) a0a ∉ L(R1) and ab01a ∈ L(R2) a0a ∉ L(R1) and ab01a ∉ L(R2) Question 4 0.33 / 1 pts letter = a | b | c | d LETTER = A | B | C | D digit = 4 | 5 | 6 | 7 | 9 Consider the regular expression R = (digit | ? | !) • (letter • digit ) • (LETTER | letter). Which of the following is correct (more than one choice or no choice can be correct)? [Show More]
Last updated: 1 year ago
Preview 1 out of 20 pages
by hobbs123 · 2 years ago
Connected school, study & course
About the document
Uploaded On
Aug 29, 2021
Number of pages
20
Written in
This document has been written for:
Uploaded
Aug 29, 2021
Downloads
1
Views
188
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·