MCQOPTIONS
Bookmark
Saved Bookmarks
→
C Programming
→
Floating Point Issues in C Programming
→
ungetc may be used with..
1.
ungetc may be used with
A.
scanf
B.
getc
C.
getchar
D.
all of the mentioned
Answer» E.
Show Answer
Discussion
No Comment Found
Post Comment
Related MCQs
What will be the output of the program ?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ FILE *fp;_x000D_ unsigned char ch;_x000D_ /* file 'abc.c' contains "This is IndiaBIX " */_x000D_ fp=fopen("abc.c", "r");_x000D_ if(fp == NULL)_x000D_ {_x000D_ printf("Unable to open file");_x000D_ exit(1);_x000D_ }_x000D_ while((ch=getc(fp)) != EOF)_x000D_ printf("%c", ch);_x000D_ _x000D_ fclose(fp);_x000D_ printf("\n", ch);_x000D_ return 0;_x000D_ }
Which of the following statement is correct about the program?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ FILE *fp;_x000D_ char str[11], ch;_x000D_ int i=0;_x000D_ fp = fopen("INPUT.TXT", "r");_x000D_ while((ch=getc(fp))!=EOF)_x000D_ {_x000D_ if(ch == '\n' || ch == ' ')_x000D_ {_x000D_ str[i]='\0';_x000D_ strrev(str);_x000D_ printf("%s", str);_x000D_ i=0;_x000D_ }_x000D_ else_x000D_ str[i++]=ch;_x000D_ }_x000D_ fclose(fp);_x000D_ return 0;_x000D_ }
Which of the following statement is correct about the program?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ FILE *fp;_x000D_ char ch;_x000D_ int i=1;_x000D_ fp = fopen("myfile.c", "r");_x000D_ while((ch=getc(fp))!=EOF)_x000D_ {_x000D_ if(ch == '\n')_x000D_ i++;_x000D_ }_x000D_ fclose(fp);_x000D_ return 0;_x000D_ }
Point out the correct statements about the program?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ FILE *fptr;_x000D_ char str[80];_x000D_ fptr = fopen("f1.dat", "w");_x000D_ if(fptr == NULL)_x000D_ printf("Cannot open file");_x000D_ else_x000D_ {_x000D_ while(strlen(gets(str))>0)_x000D_ {_x000D_ fputs(str, fptr);_x000D_ fputs("\n", fptr);_x000D_ }_x000D_ fclose(fptr);_x000D_ }_x000D_ return 0;_x000D_ }
Point out the error in the program?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ char ch;_x000D_ int i;_x000D_ scanf("%c", &i);_x000D_ scanf("%d", &ch);_x000D_ printf("%c %d", ch, i);_x000D_ return 0;_x000D_ }
What will be the output of the program ?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ int k=1;_x000D_ printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE");_x000D_ return 0;_x000D_ }
Point out the error in the program?_x000D_ #include<stdio.h>_x000D_ #include<stdlib.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ unsigned char;_x000D_ FILE *fp;_x000D_ fp=fopen("trial", "r");_x000D_ if(!fp)_x000D_ {_x000D_ printf("Unable to open file");_x000D_ exit(1);_x000D_ }_x000D_ fclose(fp);_x000D_ return 0;_x000D_ }
What will be the output of the program ?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ float a=3.15529;_x000D_ printf("%2.1f\n", a);_x000D_ return 0;_x000D_ }
What does fp point to in the program ?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ FILE *fp;_x000D_ fp=fopen("trial", "r");_x000D_ return 0;_x000D_ }
What will be the output of the program ?_x000D_ #include<stdio.h>_x000D_ _x000D_ int main()_x000D_ {_x000D_ int a=250;_x000D_ printf("%1d \n", a);_x000D_ return 0;_x000D_ }
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply