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 1.
Which of the following statements correct about the below program? #include int main() { union a { int i; char ch[2]; }; union a u1 = {512}; union a u2 = {0, 2}; return 0; } 1: u2 CANNOT be initialized as shown. 2: u1 can be initialized as shown. 3: To initialize char ch[] of u2 '.' operator should be used. 4: The code causes an error 'Declaration syntax error' A. 1, 2 B. 2, 3 C. 1, 2, 3 D. 1, 3, 4.. Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function? A. Yes B. No..... Point out the correct statements are correct about the program below? #include int main() { char ch; while(x=0;x<=255;x++) printf("ASCII value of %d character %c\n", x, x); return 0; } A. The code generates an infinite loop B. The code prints all ASCII values and its characters C. Error: x undeclared identifier D. Error: while statement missing..... Which of the following is the correct usage of conditional operators used in C? A. a>b ? c=30 : c=40; B. a>b ? c=30; C. max = a>b ? a>c?a:c:b>c?b:c D. return (a>b)?(a:b).... 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..... What will be the output of the program ? int main() { FILE *ptr; char i; ptr = fopen("myfile.c", "r"); while((i=fgetc(ptr))!=NULL) printf("%c", i); return 0; } A. Print the contents of file "myfile.c" B. Print the contents of file "myfile.c" upto NULL character.... What will be the output of the program? #include int main() { int x=1, y=1; for(; y; printf("%d %d\n", x, y)) { y = x++ <= 5; } printf("\n"); return 0; } A. 2 1 3 1 4 1 5 1 6 1 7 0 B. 2 1 3 1 4 1 5 1 6 1 C. 2 1 3 1 4 1 5 1 D. 2 2 3 3 4 4 5 5....... Which of the following is the correct order of evaluation for the below expression? z = x + y * z / 4 % 2 - 1.. What will be the output of the program ? int main() { char sentence[80]; int i; printf("Enter a line of text\n"); gets(sentence); for(i=strlen(sentence)-1; i >=0; i--) putchar(sentence[i]); return 0; } A. The sentence will get printed in same order as it entered B. The sentence will get printed in reverse order C. Half of the sentence will get printed D. None of above........ Point out the error in the program? struct emp { int ecode; struct emp *e; }; A. Error: in structure declaration B. Linker Error... Which of the following cannot be checked in a switch-case statement? A. Character B. Integer C. Float D. enum....... Point out the error, if any in the program. #include int main() { int a = 10, b; a >=5 ? b=100: b=200; printf("%d\n", b); return 0; } A. 100 B. 200 C. Error: L value required for b D. Garbage value...... Which statement will you add to the following program to ensure that the program outputs "IndiaBIX" on execution? #include int main() { char s[] = "IndiaBIX"; char t[25]; char *ps, *pt; ps = s; pt = t; while(*ps) *pt++ = *ps++; /* Add a statement here */ printf("%s\n", t); return 0; } A. *pt=''; B. pt='\0'; C. pt='\n'; D. *pt='\0';.... What will be the output of the program ? int main() { char str1[20] = "Hello", str2[20] = " World"; printf("%s\n", strcpy(str2, strcat(str1, str2))); return 0;..... A short integer is at least 16 bits wide and a long integer is at least 32 bits wide. A. True B. False... 2. Which of the following correctly shows the hierarchy of arithmetic operations in C? A. / + * - B. * - / + C. + - / * D. / * + -... In which order do the following gets evaluated 1. Relational 2. Arithmetic 3. Logical 4. Assignment 2134 B. 1234 C. 4321 D. 3214...... What will be the output of the program ? #include int main() { char str1[] = "Hello"; char str2[10]; char *t, *s; s = str1; t = str2; while(*t=*s) *t++ = *s++; printf("%s\n", str2); return 0; } A. Hello B. HelloHello C. No output D. ello...... What will be the output of the program ? #include int main() { char str = "IndiaBIX"; printf("%s\n", str); return 0; } A. Error B. IndiaBIX C. Base address of str D. No output....... What will be the output of the program, if a short int is 2 bytes wide? #include int main() { short int i = 0; for(i<=5 && i>=-1; ++i; i>0) printf("%u,", i); return 0; } A. 1 ... 65535 B. Expression syntax error C. No output D. 0, 1, 2, 3, 4, 5.... What will be the output of the program? #include int main() { float a = 0.7; if(0.7 > a) printf("Hi\n"); else...... |