1-
|
Point out the error in the following program.
#include<stdio.h>
int main()
{
fprintf("IndiaBIX");
printf("%.ef", 2.0);
return 0;
}
|
|
A -
|
Error: unknown value in printf() statement.
|
|
B -
|
Error: in fprintf() statement.
|
|
C -
|
No error and prints "IndiaBIX"
|
|
D -
|
No error and prints "2.0"
|
2-
|
Point out the error in the following program.
#include<stdio.h>
#include<string.h>
int main()
{
char str1[] = "Learn through IndiaBIX\0.com", str2[120];
char *p;
p = (char*) memccpy(str2, str1, 'i', strlen(str1));
*p = '\0';
printf("%s", str2);
return 0;
}
|
|
A -
|
Error: in memccpy statement
|
|
B -
|
Error: invalid pointer conversion
|
|
C -
|
Error: invalid variable declaration
|
|
D -
|
No error and prints "Learn through Indi"
|
3-
|
Point out the error in the following program.
#include<stdio.h>
int main()
{
char str[] = "IndiaBIX";
printf("%.#s %2s", str, str);
return 0;
}
|
|
A -
|
Error: in Array declaration
|
|
B -
|
Error: printf statement
|
|
C -
|
Error: unspecified character in printf
|
|
D -
|
No error
|
4-
|
It is necessary that for the string functions to work safely the strings must be terminated with '\0'.
|
|
A -
|
True
|
|
B -
|
False
|
5-
|
FILE is a structure suitably typedef'd in "stdio.h".
|
|
A -
|
True
|
|
B -
|
False
|
6-
|
ftell() returns the current position of the pointer in a file stream.
|
|
A -
|
True
|
|
B -
|
False
|
7-
|
Data written into a file using fwrite() can be read back using fscanf()
|
|
A -
|
True
|
|
B -
|
False
|
8-
|
If the two strings are found to be unequal then strcmp returns difference between the first non-matching pair of characters.
|
|
A -
|
True
|
|
B -
|
False
|
9-
|
Will the program outputs "IndiaBIX.com"?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[] = "IndiaBIX.com";
char str2[20];
strncpy(str2, str1, 8);
printf("%s", str2);
return 0;
}
|
|
A -
|
Yes
|
|
B -
|
No
|
10-
|
The prototypes of all standard library string functions are declared in the file string.h.
|
|
A -
|
Yes
|
|
B -
|
No
|