Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: File Input/Output

Home > C Programming > File Input/Output > General Questions

1. What is the output of the following 'C' program ?

#include
void main()
{
FILE *ptr;
char i;
ptr=fopen("abc","r");
while((i=fgets(ptr))!=EOF)
printf("%c",i);
}

Answer: contents of abc followed by an infinite loop

Explanation:

The condition is checked against EOF, it should be checked against NULL.

Workspace

Tags:

No Tags on this question yet!

2. If the content of a file (input) is abc def. What will be the value of input and ch?.

#include
char input[100],ch;
void main(void)
{
FILE *fp;
fp = fopen("input","rb");
fscanf(fp, "%s" ,&input);
fscanf(fp, "%c" ,&ch);
printf("%s %c", input, ch);
}

Answer: abc

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

3. If a file contains the line "I am an Indian\r\n" then on reading this line into the array str using fgets().
what would str contain?

Answer: "I am an Indian\n\0"

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

4. In the following 'C' code, fp points to

#include
void main()
{
FILE* fp;
fp = fopen ("trial", "r");
}

Answer: A structure which contains a char pointer which point to the first. chs meter in th file

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

5. In the following statement, the variable fpt is

fprintf(fpt, "%n", i);

Answer: a character variable

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

6. The function fopen ("filename","r") returns

Answer: a pointer to FILE filename, if it exits

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

7. The expression ((fpt = fopen ("Samples", "w")) == NULL) would be true if

Answer: the file "sample" could not be created for writing

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

8. In mulit-list organization

Answer: Records are loaded in ordered sequence defined by collating sequence by content of the key

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!

9. Which of the following is/are advantages of cellular partitioned structure:

Answer: Simultaneous read operations can be overlapped

Explanation:

Here is no explanation for this answer

Workspace

Tags:

No Tags on this question yet!