Is it true that a global variable may have several declarations, but only one definition?
Answer: A
Yes, In all the global variable declarations, you need to use the keyword extern.
Enter details here
The name of the variable used in one function cannot be used in another function?
Answer: B
No answer description available for this question.
Enter details here
By default a real number is treated as a
Answer: B
No answer description available for this question.
Enter details here
Which is false ?
Answer: C
No answer description available for this question.
Enter details here
When we mention the prototype of a function?
Answer: B
No answer description available for this question.
Enter details here
Is there any difference in the following declarations?
int myfun(int arr[]);
int myfun(arr[20]);
Answer: A
Yes, we have to specify the data type of the parameter when declaring a function.
Enter details here
Which of the following declaration is not supported by C?
Answer: A
No answer description available for this question.
Enter details here
Which keyword is used to prevent any changes in the variable within a C program?
Answer: C
const is a keyword constant in C program.
Enter details here
A variable declared in a function can be used in main?
Answer: B
No answer description available for this question.
Enter details here
Does this compile without error?
int main()
{
for (int k = 0; k < 10>
return 0;
}
Answer: C
Compilers implementing C90 does not allow this but compilers implementing C99 allow it.
Output:
$ cc pgm4.c
pgm4.c: In function ‘main’:
pgm4.c:4: error: ‘for’ loop initial declarations are only allowed in C99 mode
pgm4.c:4: note: use option -std=c99 or -std=gnu99 to compile your code
Enter details here