reopened by
5,181 views
6 votes
6 votes

Find the type of error produced by the following C code.

main()

{     in/*comment t x;

      floa/*comment*/t gate;

}
  1. Lexical error
  2. syntax error
  3. both a) and b) 
  4. None of these
reopened by

7 Answers

0 votes
0 votes

You can not use comment lines in between characters of any keyword.

Ex : fl/*gateoverflow*/oat a;

This will result in error.

0 votes
0 votes
here is only semantic error as comment between the words result in space after the compilation so there will be syntatical error i.e. error in meaning of the particular identifier is not define
0 votes
0 votes
By removing the comments the code will be

main()

{

in

t

gate;

}

So in this code 9 tokens are present so not lexical error

But as in and t are treated as functions who not contains ; this are the syntax errors

Ans : b. Syntax Error
Answer:

Related questions

6 votes
6 votes
1 answer
1
junaid ahmad asked Jan 12, 2018
1,234 views
Is this line a/*b successfully generating the token's or it give lexical error ? if it is given the lexical error then why so ?I think it will give lexical error because...
7 votes
7 votes
4 answers
2
itsvkp1 asked Nov 1, 2017
3,204 views
if there is miss spelling in some keyword in a program then this misspelled keyword will be treated as lexical errors or it will be treated as a new identifier and accept...
2 votes
2 votes
1 answer
3
Manu Thakur asked Sep 26, 2017
1,537 views
This screenshot is token from the book Ullman,How can following be a lexical error? because "elipseSize" should have a token recorded as an identifier.
1 votes
1 votes
2 answers
4