Search Placementyogi.com
 

File Input Output in C objective questions and Answers

  :: Topics ::

1

FILE is a structure that is defined in <stdio.h>. Hence, for using this structure including <stdio.h> is must.

A. True
B. False
See Answer & Explanation Lets Discuss
Correct answer is : A
Explanation

No explanation available. Let's Discuss

 
2

What is the output of the following program?

#include<stdio.h>
#include<string.h>
int main()
{
  char str[50];
  FILE *fp;
  fp=fopen(strcpy(str,"myfile.txt"),"w");
  fclose(fp);
}
A.

Compilation error

B.

Run time error

C.

No error. It works fine.

See Answer & Explanation Lets Discuss
Correct answer is : C
Explanation

fp has been declared as a pointer to structure called FILE which has been defined in header file <stdio.h>.For accessing any file we must open the file in the proper mode.

fopen("file name","mode")

In above question strcpy function returns the base address of string str[], into which "myfile.txt" has been copied.The same is passed to fopen(), and "myfile.txt" opened in write mode. it indicates that fopen() needs the pointer to the name of file we want it to open. How we supply the name doesn't matter.

 
 

Banner to LogicGuns.com

Hide Page Information

C File Input Output Objective Questions and Answers for Written Round Interview

Here you can find C File Input Output Objective Questions with answers and explanation. We have a vast collection of Objective Questions on File Input Output in C that will help you a lot!

Why learn C File Input Output?

File Input Output are an integral part of C and many Objective Questions in the written round are asked from this topic.In this section you can learn and practice C File Input Output (Objective Questions with Answers) to improve your skills in order to face the interview and clear campus and off-campus selection of TCS, Infosys, Wipro etc.

Where can I get C File Input Output Objective Questions and Answers with Explanation?

PlacementYogi provides you lots of fully solved C File Input Output Objective Questions and answers with explanation. Fully solved examples with detailed answer description, explanation are given and it would be easy to understand.Though we do not have pdf file for C File Input Output, We have quiz Objective Questions with answers to help you test yourself..

\n

Where can I get C File Input Output Interview Objective Questions and Answers (objective type, multiple choice)?

Here you can find objective type C File Input Output Objective Questions and answers for interview and entrance examination.Multiple Answers and true or false type Objective Questions are also provided.

How to solve C File Input Output problems?

You can easily solve all kind of Objective Questions based on C File Input Output by practicing the exercises (including shortcut File Input Output to solve problems) given below.