<<= Back Next =>>
You Are On Multi Choice Question Bank SET 184

9201. What will be the content of 'file.c' after executing the following program? #include<stdio.h> int main() { FILE fp1, fp2; fp1=fopen("file.c", "w"); fp2=fopen("file.c", "w"); fputc('A', fp1); fputc('B', fp2); fclose(fp1); fclose(fp2); return 0; }




9202. What will be the output of the program ? #include<stdio.h> int main() { int k=1; printf("%d == 1 is" "%s\n", k, k==1?"TRUE":"FALSE"); return 0; }





9203. What will be the output of the program ? #include<stdio.h> char str = "char str = %c%s%c; main(){ printf(str, 34, str, 34);}"; int main() { printf(str, 34, str, 34); return 0; }





9204. If the file 'source.txt' contains a line "Be my friend" which of the following will be the output of below program? #include<stdio.h> int main() { FILE fs, ft; char c[10]; fs = fopen("source.txt", "r"); c[0] = getc(fs); fseek(fs, 0, SEEK_END); fseek(fs, -3L, SEEK_CUR); fgets(c, 5, fs); puts(c); return 0; }





9205. What will be the output of the program ? #include<stdio.h> int main() { float a=3.15529; printf("%2.1f\n", a); return 0; }





9206. What will be the output of the program ? #include<stdio.h> int main() { printf("%c\n", ~('C'-1)); return 0; }





9207. What will be the output of the program ? #include<stdio.h> int main() { FILE fp; unsigned char ch; / file 'abc.c' contains "This is IndiaBIX " / fp=fopen("abc.c", "r"); if(fp == NULL) { printf("Unable to open file"); exit(1); } while((ch=getc(fp)) != EOF) printf("%c", ch); fclose(fp); printf("\n", ch); return 0; }





9208. What will be the output of the program ? #include<stdio.h> int main() { char p; p="%d\n"; p++; p++; printf(p-2, 23); return 0; }





9209. What will be the output of the program ? #include<stdio.h> int main() { FILE ptr; char i; ptr = fopen("myfile.c", "r"); while((i=fgetc(ptr))!=NULL) printf("%c", i); return 0; }





9210. What will be the output of the program ? #include<stdio.h> int main() { printf("%%%%\n"); return 0; }





9211. What will be the output of the program ? #include<stdio.h> int main() { int a=250; printf("%1d\n", a); return 0; }





9212. What will be the output of the program ? #include<stdio.h> int main() { FILE fp; char ch, str[7]; fp=fopen("try.c", "r"); / file 'try.c' contains "This is Nagpur" / fseek(fp, 9L, SEEK_CUR); fgets(str, 5, fp); puts(str); return 0; }





9213. What will be the output of the program if value 25 given to scanf()? #include<stdio.h> int main() { int i; printf("%d\n", scanf("%d", &i)); return 0; }





9214. Point out the error in the program? #include<stdio.h> #include<stdlib.h> int main() { unsigned char; FILE fp; fp=fopen("trial", "r"); if(!fp) { printf("Unable to open file"); exit(1); } fclose(fp); return 0; }





9215. Point out the error in the program? #include<stdio.h> int main() { char ch; int i; scanf("%c", &i); scanf("%d", &ch); printf("%c %d", ch, i); return 0; }





9216. Point out the error in the program? #include<stdio.h> int main() { FILE fp; fp=fopen("trial", "r"); fseek(fp, "20", SEEK_SET); fclose(fp); return 0; }





9217. Point out the error in the program? #include<stdio.h> / Assume there is a file called 'file.c' in c:\tc directory. / int main() { FILE fp; fp=fopen("c:\tc\file.c", "r"); if(!fp) printf("Unable to open file."); fclose(fp); return 0; }





9218. Point out the error/warning in the program? #include<stdio.h> int main() { unsigned char ch; FILE fp; fp=fopen("trial", "r"); while((ch = getc(fp))!=EOF) printf("%c", ch); fclose(fp); return 0; }





9219. Which of the following statement is correct about the program? #include<stdio.h> int main() { FILE fp; char ch; int i=1; fp = fopen("myfile.c", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n') i++; } fclose(fp); return 0; }





9220. Which of the following statement is correct about the program? #include<stdio.h> int main() { FILE fp; char str[11], ch; int i=0; fp = fopen("INPUT.TXT", "r"); while((ch=getc(fp))!=EOF) { if(ch == '\n' || ch == ' ') { str[i]='\0'; strrev(str); printf("%s", str); i=0; } else str[i++]=ch; } fclose(fp); return 0; }





9221. Point out the correct statements about the program? #include<stdio.h> int main() { FILE fptr; char str[80]; fptr = fopen("f1.dat", "w"); if(fptr == NULL) printf("Cannot open file"); else { while(strlen(gets(str))>0) { fputs(str, fptr); fputs("\n", fptr); } fclose(fptr); } return 0; }





9222. While calling the fprintf() function in the format string conversion specifier %s can be used to write a character string in capital letters.



9223. A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character.



9224. Offset used in fseek() function call can be a negative number.



9225. We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()



9226. In a call to printf() function the format specifier %b can be used to print binary equivalent of an integer.



9227. stderr, stdin, stdout are FILE pointers



9228. A file written in text mode can be read back in binary mode.



9229. Will the following program work? #include<stdio.h> int main() { int n=5; printf("n=%d\n", n, n); return 0; }



9230. Can we specify a variable filed width in a scanf() format string?



9231. In a file contains the line "I am a boy\r\n" then on reading this line into the array str using fgets(). What will str contain?





9232. What is the purpose of "rb" in fopen() function used below in the code? FILE fp; fp = fopen("source.txt", "rb");





9233. What does fp point to in the program ? #include<stdio.h> int main() { FILE fp; fp=fopen("trial", "r"); return 0; }





9234. Which of the following operations can be performed on the file "NOTES.TXT" using the below code? FILE fp; fp = fopen("NOTES.TXT", "r+");





9235. To print out a and b given below, which of the following printf() statement will you use? #include<stdio.h> float a=3.14; double b=3.14;




9236. I met him ________ year ago.





9237. The word ‘decorum’ means:





9238. Mr. Hosni Mubarak who is the recipient of the Jawaharlal Nehru Award for International nderstanding recently is the—





9239. I’ll have to buy _____ trousers.





9240. Mr. Paul Krugman whose name was in news recently is a famous—





9241. What is the purpose of fflush() function.





9242. Can you use the fprintf() to display the output on the screen?



9243. What will the function randomize() do in Turbo C under DOS?





9244. What will be the output of the program? #include<stdio.h> int main() { int i; i = printf("How r u\n"); i = printf("%d\n", i); printf("%d\n", i); return 0; }





9245. What will be the output of the program? #include<stdio.h> #include<math.h> int main() { float i = 2.5; printf("%f, %d", floor(i), ceil(i)); return 0; }





9246. What will be the output of the program? #include<stdio.h> int main() { int i; i = scanf("%d %d", &i, &i); printf("%d\n", i); return 0; }





9247. What will be the output of the program? #include<stdio.h> int main() { int i; char c; for(i=1; i<=5; i++) { scanf("%c", &c); / given input is 'b' / ungetc(c, stdout); printf("%c", c); ungetc(c, stdin); } return 0; }





9248. What will be the output of the program? #include<stdio.h> #include<stdlib.h> int main() { char i = "55.555"; int result1 = 10; float result2 = 11.111; result1 = result1+atoi(i); result2 = result2+atof(i); printf("%d, %f", result1, result2); return 0; }





9249. What will be the output of the program? #include<stdio.h> #include<string.h> int main() { char dest[] = {97, 97, 0}; char src[] = "aaa"; int i; if((i = memcmp(dest, src, 2))==0) printf("Got it"); else printf("Missed"); return 0; }





9250. What will function gcvt() do?





<<= Back Next =>>
Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use
DMCA.com Protection Status Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions