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 4.
Assume integer is 2 bytes wide. How many bytes will be allocated for the following code? #include #include #define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL]; p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p)); return 0; } A. 56 bytes B. 128 bytes C. 24 bytes D. 12 bytes..... Assume integer is 2 bytes wide. What will be the output of the following code? #define MAXROW 3 #define MAXCOL 4 int main() { int (*p)[MAXCOL]; p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p)); printf("%d, %d\n", sizeof(p), sizeof(*p)); return 0; } A. 2, 8 B. 4, 16 C. 8, 24 D. 16, 32.... Point out the error in the program. #include #define MAX 128 int main() { char mybuf[] = "India"; char yourbuf[] = "BIX"; char const *ptr = mybuf; *ptr = 'a'; ptr = yourbuf; return 0; } A. Error: cannot convert ptr const value B. Error: unknown pointer conversion C. No error D. None of above..... Point out the error in the program. #include const char *fun(); int main() { *fun() = 'A'; return 0; } const char *fun() { return "Hello"; } A. Error: RValue required B. Error: Lvalue required C. Error: fun() returns a pointer const character which cannot be modified D. No error.... What will be the output of the program? #include int get(); int main() { const int x = get(); printf("%d", x); return 0; } int get() { return 20; } A. Garbage value B. Error C. 20 D. 0..... What will be the output of the program (in Turbo C)? #include int fun(int *f) { *f = 10; return 0; } int main() { const int arr[5] = {1, 2, 3, 4, 5}; printf("Before modification arr[3] = %d", arr[3]); fun(&arr[3]); printf("\nAfter modification arr[3] = %d", arr[3]); return 0;.... Is the following declaration acceptable? typedef long no, *ptrtono; no n; ptrtono p; A. Yes B. No..... Is there any difference in the #define and typedef in the following code? typedef char * string_t; #define string_d char *; string_t s1, s2; string_d s3, s4; A. Yes B. No.... Are the properties of i, j and x, y in the following program same? typedef unsigned long int uli; uli i, j; unsigned long int x, y; .... In the following code, the P2 is Integer Pointer or Integer? typedef int *ptr; ptr p1, p2; A. Integer B. Integer pointer C. Error in declaration D. None of above.... In the following code what is 'P'? typedef char *charp; const charp P; A. P is a constant B. P is a character constant C. P is character type D. None of above.... Bitwise & can be used to check if a bit in number is set or not. A. True B. False.... Bitwise & can be used to divide a number by powers of 2 A. True B. False.... On left shifting, the bits from the left are rotated and brought to the right and accommodated where there is empty space on the right? A. True B. False.... What will be the output of the program? #include int main() { unsigned int res; res = (64 >>(2+1-2)) & (~(1<<2)); printf("%d\n", res); return 0; } A. 32 B. 64 C. 0 D. 128..... 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. 4, 8, 0 B. 1, 2, 1 C. 12, 1, 12 D. 0, 0, 0.... Assunming, integer is 2 byte, What will be the output of the program? #include int main() { printf("%x\n", -1>>1); return 0; } A. ffff B. 0fff C. 0000 D. fff0..... If an unsigned int is 2 bytes wide then, What will be the output of the program ? #include int main() { unsigned int m = 32; printf("%x\n", ~m); return 0; } A. ffff B. 0000 C. ffdf D. ddfd..... Every time we supply new set of values to the program at command prompt, we need to recompile the program. A. True B. False.... Even if integer/float arguments are supplied at command prompt they are treated as strings. A. True B. False.... The first argument to be supplied at command-line must always be count of total arguments. A. True B. False.... In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision? A. Yes B. No... If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell? /* myproc.c */ #include int main(int argc, char *argv[]) { printf("%s", argv[0]); return 0; } A. SAMPLE.C B. C:\TC\MYPROC.EXE C. C:\TC D. Error.... What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog one two three /* myprog.c */ #include int main(int argc, char *argv[]).... |