Practice MCQ C Language

Page 1 of 50, Total 297 results. | Shuffle Order | Flagged | Next Page
8169 What does the following declaration mean? int (*ptr)[10];
Options:ptr is array of pointers to 10 integers,    ptr is a pointer to an array of 10 integers,    ptr is an array of 10 integers,    ptr is an pointer to array

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8170 In C, if you pass an array as an argument to a function, what actually gets passed?
Options:Value of elements in array,    First element of the array,    Base address of the array,    Address of the last element of array

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8171 What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes? #include<stdio.h> int main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0}; printf("%u, %u\n", a+1, &a+1); return 0; }
Options:65474, 65476,    65480, 65496,    65480, 65488,    65474, 65488

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8172 What will be the output of the program in Turb C (under DOS)? #include<stdio.h> int main() { int arr[5], i=0; while(i<5) arr[i]=++i; for(i=0; i<5; i++) printf("%d, ", arr[i]); return 0; }
Options:1, 2, 3, 4, 5,,    Garbage value, 1, 2, 3, 4,,    0, 1, 2, 3, 4,,    2, 3, 4, 5, 6,

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8173 What will be the output of the program ? #include<stdio.h> int main() { int arr[1]={10}; printf("%d\n", 0[arr]); return 0; }
Options:1,    10,    0,    6

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8174 What will be the output of the program if the array begins at address 65486? #include<stdio.h> int main() { int arr[] = {12, 14, 15, 23, 45}; printf("%u, %u\n", arr, &arr); return 0; }
Options:65486, 65488,    65486, 65486,    65486, 65490,    65486, 65487

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8175 What will be the output of the program ? #include<stdio.h> int main() { float arr[] = {12.4, 2.3, 4.5, 6.7}; printf("%d\n", sizeof(arr)/sizeof(arr[0])); return 0; }
Options:5,    4,    6,    7

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8176 What will be the output of the program if the array begins 1200 in memory? #include<stdio.h> int main() { int arr[]={2, 3, 4, 1, 6}; printf("%u, %u, %u\n", arr, &arr[0], &arr); return 0; }
Options:1200, 1202, 1204,    1200, 1200, 1200,    1200, 1204, 1208,    1200, 1202, 1200

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8177 What will be the output of the program ? #include<stdio.h> int main() { int a[5] = {5, 1, 15, 20, 25}; int i, j, m; i = ++a[1]; j = a[1]++; m = a[i++]; printf("%d, %d, %d", i, j, m); return 0; }
Options:2, 1, 15,    1, 2, 5,    3, 2, 15,    2, 3, 20

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8178 What will be the output of the program ? #include<stdio.h> int main() { static int a[2][2] = {1, 2, 3, 4}; int i, j; static int *p[] = {(int*)a, (int*)a+1, (int*)a+2}; for(i=0; i<2; i++) { for(j=0; j<2; j++) { printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i), *(*(i+p)+j), *(*(p+j)+i)); } } return 0; }
Options:1, 1, 1, 1 2, 3, 2, 3 3, 2, 3, 2 4, 4, 4, 4,    1, 2, 1, 2 2, 3, 2, 3 3, 4, 3, 4 4, 2, 4, 2,    1, 1, 1, 1 2, 2, 2, 2 2, 2, 2, 2 3, 3, 3, 3,    1, 2, 3, 4 2, 3, 4, 1 3, 4, 1, 2 4, 1, 2, 3

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8179 What will be the output of the program ? #include<stdio.h> int main() { void fun(int, int[]); int arr[] = {1, 2, 3, 4}; int i; fun(4, arr); for(i=0; i<4; i++) printf("%d,", arr[i]); return 0; } void fun(int n, int arr[]) { int *p=0; int i=0; while(i++ < n) p = &arr[i]; *p=0; }
Options:2, 3, 4, 5,    1, 2, 3, 4,    0, 1, 2, 3,    3, 2, 1 0

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8180 What will be the output of the program ? #include<stdio.h> void fun(int **p); int main() { int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0}; int *ptr; ptr = &a[0][0]; fun(&ptr); return 0; } void fun(int **p) { printf("%d\n", **p); }
Options:1,    2,    3,    4

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8181 What will be the output of the program ? #include<stdio.h> int main() { static int arr[] = {0, 1, 2, 3, 4}; int *p[] = {arr, arr+1, arr+2, arr+3, arr+4}; int **ptr=p; ptr++; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr); *ptr++; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr); *++ptr; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr); ++*ptr; printf("%d, %d, %d\n", ptr-p, *ptr-arr, **ptr); return 0; }
Options:0, 0, 0 1, 1, 1 2, 2, 2 3, 3, 3,    1, 1, 2 2, 2, 3 3, 3, 4 4, 4, 1,    1, 1, 1 2, 2, 2 3, 3, 3 3, 4, 4,    0, 1, 2 1, 2, 3 2, 3, 4 3, 4, 5

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8182 Which of the following is correct way to define the function fun() in the below program? #include<stdio.h> int main() { int a[3][4]; fun(a); return 0; }
Options:void fun(int p[][4]) { } ,    void fun(int *p[4]) { } ,    void fun(int *p[][4]) { } ,    void fun(int *p[3][4]) { }

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8183 Which of the following statements mentioning the name of the array begins DOES NOT yield the base address? 1: When array name is used with the sizeof operator. 2: When array name is operand of the & operator. 3: When array name is passed to scanf() function. 4: When array name is passed to printf() function.
Options:A,    A, B,    B,    B, D

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8184 Which of the following statements are correct about the program below? #include<stdio.h> int main() { int size, i; scanf("%d", &size); int arr[size]; for(i=1; i<=size; i++) { scanf("%d", arr[i]); printf("%d", arr[i]); } return 0; }
Options:The code is erroneous since the subscript for array used in for loop is in the range 1 to size.,    The code is erroneous since the values of array are getting scanned through the loop.,    The code is erroneous since the statement declaring array is invalid.,    The code is correct and runs successfully.

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8185 Which of the following statements are correct about 6 used in the program? int num[6]; num[6]=21;
Options:In the first statement 6 specifies a particular element, whereas in the second statement it specifies a type.,    In the first statement 6 specifies a array size, whereas in the second statement it specifies a particular element of array.,    In the first statement 6 specifies a particular element, whereas in the second statement it specifies a array size.,    In both the statement 6 specifies array size.

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8186 Which of the following statements are correct about an array? 1: The array int num[26]; can store 26 elements. 2: The expression num[1] designates the very first element in the array. 3: It is necessary to initialize the array at the time of declaration. 4: The declaration num[SIZE] is allowed if SIZE is a macro.
Options:1,    1,4,    2,3,    2,4

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8187 In which numbering system can the binary number 1011011111000101 be easily converted to?
Options:Decimal system,    Hexadecimal system,    Octal system,    No need to convert

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8188 Which bitwise operator is suitable for turning off a particular bit in a number?
Options:&& operator,    & operator,    || operator,    ! operator

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8189 Which bitwise operator is suitable for turning on a particular bit in a number?
Options:&& operator,    & operator,    || operator,    | operator

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8190 Which bitwise operator is suitable for checking whether a particular bit is on or off?
Options:&& operator,    & operator,    || operator,    ! operator

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8191 What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile? #include<stdio.h> #define SWAP(a, b, c)(c t; t=a, a=b, b=t) int main() { int x=10, y=20; SWAP(x, y, int); printf("%d %d\n", x, y); return 0; }
Options:It compiles,    Compiles with an warning,    Not compile,    Compiles and print nothing

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8192 In which stage the following code #include<stdio.h> gets replaced by the contents of the file stdio.h
Options:During editing,    During linking,    During execution,    During preprocessing

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8193 What will be the output of the program? #include<stdio.h> #define PRINT(int) printf("int=%d, ", int); int main() { int x=2, y=3, z=4; PRINT(x); PRINT(y); PRINT(z); return 0; }
Options:int=2, int=3, int=4,    int=2, int=2, int=2,    int=3, int=3, int=3,    int=4, int=4, int=4

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8194 What will be the output of the program? #include<stdio.h> #define SWAP(a, b) int t; t=a, a=b, b=t; int main() { int a=10, b=12; SWAP(a, b); printf("a = %d, b = %d\n", a, b); return 0; }
Options:a = 10, b = 12,    a = 12, b = 10,    Error: Declaration not allowed in macro,    Error: Undefined symbol 't'

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8195 What will be the output of the program? #include<stdio.h> #define FUN(i, j) i##j int main() { int va1=10; int va12=20; printf("%d\n", FUN(va1, 2)); return 0; }
Options:10,    20,    1020,    12

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8196 What will be the output of the program? #include<stdio.h> #define FUN(arg) do\ {\ if(arg)\ printf("IndiaBIX...", "\n");\ }while(--i) int main() { int i=2; FUN(i<3); return 0; }
Options:IndiaBIX... IndiaBIX... IndiaBIX,    IndiaBIX... IndiaBIX...,    Error: cannot use control instructions in macro,    No output

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8197 What will be the output of the program? #include<stdio.h> #define MAX(a, b) (a > b ? a : b) int main() { int x; x = MAX(3+2, 2+7); printf("%d\n", x); return 0; }
Options:8,    9,    6,    5

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8198 What will be the output of the program? #include<stdio.h> #define MIN(x, y) (x<y)? x : y; int main() { int x=3, y=4, z; z = MIN(x+y/2, y-1); if(z > 0) printf("%d\n", z); return 0; }
Options:3,    4,    0,    No output

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8199 What will be the output of the program? #include<stdio.h> #define str(x) #x #define Xstr(x) str(x) #define oper multiply int main() { char *opername = Xstr(oper); printf("%s\n", opername); return 0; }
Options:Error: in macro substitution,    Error: invalid reference 'x' in macro,    print 'multiply',    No output

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8200 What will be the output of the program? #include<stdio.h> #define MESS junk int main() { printf("MESS\n"); return 0; }
Options:junk,    MESS,    Error,    Nothing will print

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8201 What will be the output of the program? #include<stdio.h> #define PRINT(i) printf("%d,",i) int main() { int x=2, y=3, z=4; PRINT(x); PRINT(y); PRINT(z); return 0; }
Options:2, 3, 4,,    2, 2, 2,,    3, 3, 3,,    4, 4, 4,

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8202 What will be the output of the program? #include<stdio.h> #define MAX(a, b, c) (a>b ? a>c ? a : c: b>c ? b : c) int main() { int x; x = MAX(3+2, 2+7, 3+7); printf("%d\n", x); return 0; }
Options:5,    9,    10,    3+7

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8203 What will be the output of the program? #include<stdio.h> #define MAN(x, y) ((x)>(y)) ? (x):(y); int main() { int i=10, j=5, k=0; k = MAN(++i, j++); printf("%d, %d, %d\n", i, j, k); return 0; }
Options:12, 6, 12,    11, 5, 11,    11, 5, Garbage,    12, 6, Garbage

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8204 What will be the output of the program? #include<stdio.h> #define SQUARE(x) x*x int main() { float s=10, u=30, t=2, a; a = 2*(s-u*t)/SQUARE(t); printf("Result = %f", a); return 0; }
Options:Result = -100.000000,    Result = -25.000000,    Result = 0.000000,    Result = 100.000000

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8205 What will be the output of the program? #include<stdio.h> #define SQR(x)(x*x) int main() { int a, b=3; a = SQR(b+2); printf("%d\n", a); return 0; }
Options:25,    11,    Error,    Garbage value

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8206 What will be the output of the program? #include<stdio.h> #define JOIN(s1, s2) printf("%s=%s %s=%s \n", #s1, s1, #s2, s2); int main() { char *str1="India"; char *str2="BIX"; JOIN(str1, str2); return 0; }
Options:str1=IndiaBIX str2=BIX,    str1=India str2=BIX,    str1=India str2=IndiaBIX,    Error: in macro substitution

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8207 What will be the output of the program? #include<stdio.h> #define CUBE(x) (x*x*x) int main() { int a, b=3; a = CUBE(b++); printf("%d, %d\n", a, b); return 0; }
Options:9, 4,    27, 4,    27, 6,    Error

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8208 Which of the following are correct preprocessor directives in C? 1: #ifdef 2: #if 3: #elif 4: #undef
Options:1, 2,    4,    1, 2, 4,    1, 2, 3, 4

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8209 Which of the following are correctly formed #define statements in C?
Options:#define CUBE (X) (X*X*X);,    #define CUBE(x) (X*X*X),    #define CUBE(X)(X*X*X),    #define CUBE(X) {X*X*X}

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8210 Point out the error in the program #include<stdio.h> #define SI(p, n, r) float si; si=p*n*r/100; int main() { float p=2500, r=3.5; int n=3; SI(p, n, r); SI(1500, 2, 2.5); return 0; }
Options:26250.00 7500.00,    Nothing will print,    Error: Multiple declaration of si,    Garbage values

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8211 Point out the error in the program #include<stdio.h> int main() { int i; #if A printf("Enter any number:"); scanf("%d", &i); #elif B printf("The number is odd"); return 0; }
Options:Error: unexpected end of file because there is no matching #endif,    The number is odd,    Garbage values,    None of above

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8212 The maximum combined length of the command-line arguments including the spaces between adjacent arguments is
Options:128 characters,    256 characters,    67 characters,    It may vary from one operating system to another

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8213 According to ANSI specifications which is the correct way of declaring main when it receives command-line arguments?
Options:int main(int argc, char *argv[]),    int main(argc, argv) int argc; char *argv; ,    int main() { int argc; char *argv; } ,    None of above

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8214 What do the 'c' and 'v' in argv stands for?
Options:'c' means argument control 'v' means argument vector,    'c' means argument count 'v' means argument vertex,    'c' means argument count 'v' means argument vector,    'c' means argument configuration 'v' means argument visibility

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8215 What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample "*.c" /* sample.c */ #include<stdio.h> int main(int argc, int *argv) { int i; for(i=1; i<argc; i++) printf("%s\n", argv[i]); return 0; }
Options:*.c,    "*.c",    sample *.c,    List of all files and folders in the current directory

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8216 What will be the output of the program if it is executed like below? cmd> sample /* sample.c */ #include<stdio.h> int main(int argc, char **argv) { printf("%s\n", argv[argc-1]); return 0; }
Options:0,    sample,    samp,    No output

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8217 What will be the output of the program (sample.c) given below if it is executed from the command line? cmd> sample friday tuesday sunday /* sample.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", **++argv); return 0; }
Options:s,    f,    sample,    friday

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
8218 What will be the output of the program (myprog.c) given below if it is executed from the command line? cmd> myprog friday tuesday sunday /* myprog.c */ #include<stdio.h> int main(int argc, char *argv[]) { printf("%c", *++argv[1]); return 0; }
Options:r,    f,    m,    y

Show Answer
Loading Facebook Comment system, Please wait...
Loading Facebook Comment system, Please wait...
www.000webhost.com