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 2.
Point out the error in the program?
#include
int main()
{
struct a
{
float category:5;
char scheme:4;
};
printf("size=%d", sizeof(struct a));
return 0;
}
A.
Error: invalid structure member in printf
B.
Error in this float category:5; statement
C.
No error
D.
None of above....... Point out the error in the program?
#include The modulus operator cannot be used with a long double. A. True B. False......... What will be the output of the program? #include int main() { int i=-3, j=2, k=0, m; m = ++i && ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0; } A. -2, 3, 1, 1 B. 2, 3, 1, 2 C. 1, 2, 3, 1 D. 3, 3, 1, 2...... It is necessary that a header files should have a .h extension? 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...... Point out the error/warning in the program? #include int main() { unsigned char ch; FILE *fp; fp=fopen("trial", "r"); while((ch = getc(fp))!=EOF) printf("%c", ch); fclose(fp); return 0; } A. Error: in unsigned char declaration B. Error: while statement........ How many times "IndiaBIX" is get printed? #include int main() { int x; for(x=-1; x<=10; x++) { if(x < 5) continue; else break; printf("IndiaBIX"); } return 0; } A. Infinite times B. 11 times C. 0 times D. 10 times...... What will be the output of the program? #include int main() { int i=-3, j=2, k=0, m; m = ++i && ++j || ++k; printf("%d, %d, %d, %d\n", i, j, k, m); return 0;..... What will be the output of the program if value 25 given to scanf()? #include int main() { int i; printf("%d\n", scanf("%d", &i)); return 0; } A. 25 B. 2 C. 1 D. 5....... Point out the error in the program? int main() { unsigned char; FILE *fp; fp=fopen("trial", "r"); if(!fp) { printf("Unable to open file"); exit(1); } fclose(fp); return 0; } A. Error: in unsigned char statement B. Error: unknown file pointer..... What will be the output of the program? #include #define PRINT(i) printf("%d,",i) int main() { int x=2, y=3, z=4; PRINT(x); PRINT(y); PRINT(z); return 0; } A. 2, 3, 4, B. 2, 2, 2, C. 3, 3, 3, D. 4, 4, 4,.... What will be the output of the program assuming that the array begins at the location 1002 and size of an integer is 4 bytes? #include int main() { int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1)); return 0;..... How will you free the allocated memory ? A. remove(var-name); B. free(var-name); C. delete(var-name); D. dalloc(var-name);....... 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? A. "I am a boy\r\n\0" B. "I am a boy\r\0" C. "I am a boy\n\0" D. "I am a boy".... How many times the while loop will get executed if a short int is 2 byte wide? #include int main() { int j=1; while(j <= 255) { printf("%c %d\n", j, j); j++; } return 0; } A. Infinite times B. 255 times C. 256 times D. 254 times........ Which of the following errors would be reported by the compiler on compiling the program given below? #include int main() { int a = 5; switch(a) { case 1: printf("First"); case 2: printf("Second"); case 3 + 2: printf("Third");....... What will be the output of the program ? #include int main() { char str[] = "Nagpur"; str[0]='K'; printf("%s, ", str); str = "Kanpur"; printf("%s", str+1); return 0; } A. Kagpur, Kanpur B. Nagpur, Kanpur C. Kagpur, anpur D. Error...... 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;.... Which of the following statements are correct about the below C-program? #include int main() { int x = 10, y = 100%90, i; for(i=1; i<10; i++) if(x != y); printf("x = %d y = %d\n", x, y); return 0; } 1 : The printf() function is called 10 times. 2 : The program will produce the output x = 10 y = 10 3 : The ; after the if(x!=y) will NOT produce an error. 4 : The program will not produce output. A. 1 B. 2, 3 C. 3, 4 D. 4....... What will be the output of the program? #include int main() { int k, num=30; k = (num>5 ? (num <=10 ? 100 : 200): 500); printf("%d\n", num); return 0;..... |