C-Command Line Arguments
C-Command Line Arguments
11. Find the output
#include"stdio.h"
void main ( )
{
FILE *p;
char ch;
p=fopen ("raja.txt", "w");
putc (50,p);
putc (80, p);
putc (70, p);
while ((ch=getc(p))!=EOF)
putch (ch);
fclose (p);
}
#include"stdio.h"
void main ( )
{
FILE *p;
char ch;
p=fopen ("raja.txt", "w");
putc (50,p);
putc (80, p);
putc (70, p);
while ((ch=getc(p))!=EOF)
putch (ch);
fclose (p);
}
- 508070
- 2pf
- Compilation error
- No output
12. Which of the following are similar ?
- printf ("%d", x) and fprintf (stdin, "%d",x)
- scanf("%d",&x) and fscanf (stdout, "%d",&x)
- printf ("%d", x) and fprintf(stdout, "%d", x) fprintf (stdout, "%d", x)
- None of the above
13. What is the contents of the file "letter.txt"
#include"stdio.h"
void main ( )
{
FILE *p;
char m[ ] = "I \m \the \best";
p=fopen (letter.txt", "w");
fputs (m,p);
fclose (p);
}
#include"stdio.h"
void main ( )
{
FILE *p;
char m[ ] = "I \m \the \best";
p=fopen (letter.txt", "w");
fputs (m,p);
fclose (p);
}
- I am the best
- I 0m the 0est
- i \am \the \best
- None of these
15. The fclose ( ) function
- closes only one file at a time
- Closes all the files opened
- Closes only text file
- None of these
16. The fseek ( ) function
- Needs 2 arguments
- Makes the rewind function unnecessary
- Is meant for checking whether a given file exists or not.
- Both b and c
17. Find the output
#include "stdio.h"
void main ( )
{
FILE *p;
printf ("%d %d", stderr->fd, _streams[3].fd);
}
#include "stdio.h"
void main ( )
{
FILE *p;
printf ("%d %d", stderr->fd, _streams[3].fd);
}
- 2 3
- 4 4
- 1 2
- Compilation error
20. Find the output
#include "stdio.h"
void main ( )
{
FILE *p=0;
p++;
printf("%d",p);
}
#include "stdio.h"
void main ( )
{
FILE *p=0;
p++;
printf("%d",p);
}
- 8
- 16
- Compilation error
- None of these