edited by
21,584 views
80 votes
80 votes

Consider line number $3$ of the following C-program.

int main() {                /*Line 1 */
    int I, N;               /*Line 2 */
    fro (I=0, I<N, I++);	/*Line 3 */
}

Identify the compiler’s response about this line while creating the object-module:

  1. No compilation error
  2. Only a lexical error
  3. Only syntactic errors
  4. Both lexical and syntactic errors
edited by

9 Answers

1 votes
1 votes
There is no error in the above code. Actually it is a link error. Here compiler fro is a function which is not declared. Hence, it will not produce any error. It will only throw a warning in C.
0 votes
0 votes

Syntactic error- character or string incorrectly placed in a command or instruction that causes a failure in execution.

Here, for spelling is wrong.

Incorrect use of reserved word .

0 votes
0 votes

i think its an LEXICAL ERROR

because lexical analyser stores the LEXEMES in terms of    "PATTERN"

like identifiers are stored with an pattern----------- >  L(L+D)^* where L is an alphabet, D is an numerics.

it also stores QUANTIFIERS,KEYWORDS,... all  PREDEFINED  lexems in terms of PATTERN'S..

 

0 votes
0 votes

answer should be (A) 

I am not sure if this will work in other compilers or not. But my version of GCC doesn’t require an explicit extern in this case.

Answer:

Related questions

31 votes
31 votes
2 answers
1
go_editor asked Nov 27, 2016
11,519 views
Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar production.$$\begin{array}{l|l} E\rightarrow numbe...
24 votes
24 votes
2 answers
2
34 votes
34 votes
5 answers
3
0 votes
0 votes
1 answer
4
go_editor asked Mar 26, 2020
1,027 views
Which of the statements related to Compilers is wrong ?Lexical analysis is breaking the input into tokensSyntax analysis is for parsing the phraseSyntax analysis is for a...