Connect with a global community of knowledgeable individuals on IDNLearn.com. Join our interactive Q&A community and access a wealth of reliable answers to your most pressing questions.

Consider the following code:
Token LexicalAnalyzer: : GetToken()
input . GetChar(c);
switch (c) {
case '=':
input . GetChar(c);
if (c = = '=') {
tmp . token_type = EQEQ;
} else 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;
1. In the code, input.GetChar() gets the next character from standard input. If GetToken() is called four times, which of the following inputs will return a token whose type is ERROR?
A. ========
A. =<======
B. ===>====
C. =====<==
D. ======<=
2. If GetToken() is called four times on input <==<==, how many times is ERROR returned?
a. 0
b. 1
c. 2
d. 3


Sagot :

Answer:

return tmp;

default:

tmp . token_type = ERROR;

return tmp;

1. In the code, input.GetChar() gets the next character from standard input. If GetToken() is called four times, which of the following inputs will return a token whose type is ERROR?

A. ========

A. =<======

B. ===>====

C. =====<==

D. ======<=