Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

GATE | GATE-CS-2005 | Question 61

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

My Personal Notes arrow_drop_up
Last Updated : 01 Sep, 2021
Like Article
Save Article
Similar Reads