C-Command Line Arguments
C-Command Line Arguments
41. State the correct statement
- fclose() don't flush any unwritten data for the associated file.
- it is good practice to explicity use fclose() to close files that you have opened.
- fopen() automatically creates the bufer area in memory.
- Both b & c.
42. fclose () don't flush any unwritten data for the associated file.
- 13
- 26
- 27
- None of these
43. Find the output
#include"stdio.h"
void main ( )
{
FILE *p;
char *ch;
ch="Welcome to puri";
p=fopen(raja.txt",'w");
fprintf(p, "%s",ch);
fclose(p);
p=fopen("raja.txt","r");
fflush(p);
fscanf(p,"%s",ch);
printf("%s",ch);
}
#include"stdio.h"
void main ( )
{
FILE *p;
char *ch;
ch="Welcome to puri";
p=fopen(raja.txt",'w");
fprintf(p, "%s",ch);
fclose(p);
p=fopen("raja.txt","r");
fflush(p);
fscanf(p,"%s",ch);
printf("%s",ch);
}
- Welcome
- Welcome to puri
- Compilation error
- No output
44. If the file name is aaa and type from the command prompt aaa xxx yyy zzz then the following program prints xxx yyy and zzz. Which of the following option is true.
#jinclude <stdio.h>
int main (int argc, char *argv[])
{
int x;
printf(%d\n", argc);
for (x=; x<argc; x++)
printf(%s\n", argv[x]);
return 0;
}
#jinclude <stdio.h>
int main (int argc, char *argv[])
{
int x;
printf(%d\n", argc);
for (x=; x<argc; x++)
printf(%s\n", argv[x]);
return 0;
}
- xxx is the 1st command line argument and yyy would be the second command line argument
- aaa is the 1st command line argument
- aaa xx yyy zzz is the 1st command line argument
- None of the above
45. Tthe contents of a file will be lost if it is opened in
- a mode
- a- mode
- w+ mode
- a+ mode
46. Which of the following command is used to access file randomly ?
- ftell()
- fseek()
- fgets()
- None of these
47. A stream can be thougght of as
- A system call
- A library function
- Both a and b
- A source or sink of data associated with disk or their devicesd
48. State the correct statement.
- fgets() read a line of string from a keyboard.
- gets () read a line of string from a file.
- fgets() takes two arguments.
- None of these
49. The function ftell(fp) returns
- the beginning position of the file represented by fp.
- the end position o the file represented by fp.
- The current position of the file represented by fp.
- None of these
50. The function ftell(fp) returns
- The beginning position of the file reresented by fp.
- The end position of the file represented by fp
- the current position of the file represented by fp.
- None of these