6. Which of the following is a correct way to comment a single line in C?
a) / This is a comment
b) // This is a comment
c) /* This is a comment */
d) # This is a comment
7. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int i = 0;
for(i = 0; i < 5; i++);
printf(“%d”, i);
return 0;
}
a) 5
b) 0
c) 6
d) 1
8. What is the correct operator to perform logical AND in C?
a) &
b) &&
c) |
d) ||
9. Which of the following escape sequences represents a new line in C?
a) \n
b) \t
c) \r
d) \\
10. What is the output of the following code snippet?
#include<stdio.h>
int main()
{
int x = 5;
int y;
y = x++ + x++;
printf(“%d”, y);
return 0;
}
a) 10
b) 12
c) 11
d) 13