Tin Học >> Lập trình >> C
|| C#
C++
Visual Basic
Visual Foxpro
C
Java
Pascal
Thiết Kế Web
ASP.NET
XML
CSS
PHP
Có 115 bài trong 12 trang (10 bài/trang) và bạn đang ở trang 5.
What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)? cmd> sample Good Morning /* sample.c */ #include int main(int argc, char *argv[]) { printf("%d %s", argc, argv[1]); return 0; } A. 3 Good B. 2 Good C. Good Morning D. 3 Morning.... What will be the output of the program #include void fun(int); int main(int argc).... Will the following program work? #include int main() { int n=5; printf("n=%*d\n", n, n); return 0; } A. Yes B. No.... A file written in text mode can be read back in binary mode. A. Yes B. No... The maximum combined length of the command-line arguments including the spaces between adjacent arguments is A. 128 characters B. 256 characters C. 67 characters D. It may vary from one operating system to another.... Point out the error in the program? #include /* 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; } A. No error, No output. B. Program crashes at run time. C. Output: Unable to open file. D. None of above....... What will be the output of the program ? #include 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; } A. This is IndiaBIX B. This is C. Infinite loop D. Error....... On executing the below program what will be the contents of 'target.txt' file if the source file contains a line "To err is human"? #include int main() { int i, fss; char ch, source[20] = "source.txt", target[20]="target.txt", t; FILE *fs, *ft; fs = fopen(source, "r"); ft = fopen(target, "w"); while(1) { ch=getc(fs); if(ch==EOF) break; else { fseek(fs, 4L, SEEK_CUR); fputc(ch, ft); } } return 0; } A. r n B. Trh C. err D. None of above.... Can we have an array of bit fields? A. Yes B. No........ Will the following declaration work? typedef struct s { int a; float b; }s; A. Yes B. No...... If a char is 1 byte wide, an integer is 2 bytes wide and a long integer is 4 bytes wide then will the following structure always occupy 7 bytes? struct ex { char ch; int i; long int a; }; A. Yes B. No........ Which of the following statement is True? A. User has to explicitly define the numeric value of enumerations B. User has a control over the size of enumeration variables. C. Enumeration can have an effect local to the block, if desired D. Enumerations have a global effect throughout the file..... The '->' operator can be used to access structures elements using a pointer to a structure variable only A. True B. False.... Which of the following statements correctly assigns 12 to month using pointer variable pdt? #include struct date { int day; int month; int year; }; int main() { struct date d; struct date *pdt; pdt = &d; return 0; } A. pdt.month = 12 B. &pdt.month = 12 C. d.month = 12 D. pdt->month = 12..... Point out the error in the program? struct emp { int ecode; struct emp e; }; A. Error: in structure declaration B. Linker Error C. No Error D. None of above..... Point out the error in the program? #include int main() { struct emp { char name[20]; float sal; }; struct emp e[10]; int i; for(i=0; i<=9; i++) scanf("%s %f", e[i].name, &e[i].sal); return 0; } A. Error: invalid structure member B. Error: Floating point formats not linked.... What will be the output of the program ? #include int main() { int i=4, j=8; printf("%d, %d, %d\n", i|j&j|i, i|j&j|i, i^j); return 0; } A. 12, 12, 12 B. 112, 1, 12 C. 32, 1, 12 D. -64, 1, 12....... What will be the output of the program in Turbo C (under DOS)? #include int main() { struct emp { char *n; int age; }; struct emp e1 = {"Dravid", 23}; struct emp e2 = e1; strupr(e2.n); printf("%s\n", e1.n); return 0; } A. Error: Invalid structure assignment.... |