Open In App

GATE | GATE-CS-2005 | Question 61

Last Updated : 01 Sep, 2021
Like Article
Like
Save
Share
Report

Consider line number 3 of the following C- program. 

C




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

(A)

No compilation error

(B)

Only a lexical error

(C)

Only syntactic errors

(D)

Both lexical and syntactic errors



Answer: (D)

Explanation:

Lexical errors refer to errors related to the lexemes or tokens in the program, such as misspelled keywords or identifiers that are not recognized by the language. Here, “fro” instead of “for”.
Syntactic errors occur when the code violates the grammar or syntax rules of the programming language. Here, inside  for loop there is coma instead of semicolomn


Quiz of this Question
Please comment below if you find anything wrong in the above post


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads