CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider the following C program:
Program 1:
#include <stdio.h>
int main( )
{
float x;
while (x 5)
Printf ("%d",x);
}
Program 2:
# include <stdio.h>
int main ( )
{
int temp,_temp2;
@_/ / Hello World
return 0;
}
Which of the above gives lexical error ?

A
Only Program 2
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
None of these
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
Only Program 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
Both Program 1 and Program 2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A Only Program 2
Only Program 2 generates lexical error.
Program 1 generates sematic error by syntax analyzer.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Encoding and Decoding
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon