Choose a topic to test your knowledge and improve your C/C skills
What is the output of this C code? void foo(const int *); int main() { const int i = 10; printf("%d ", i); foo(&i); printf("%d", i); } void foo(const int *i) { *i = 20; }
Comment on the output of this C code? int main() { const int i = 10; int *ptr = &i; *ptr = 20; printf("%d ", i); return 0; }
What is the output of this C code? int main() { j = 10; printf("%d ", j++); return 0; }
Does this compile without error? int main() { for (int k = 0; k < 10; k++); return 0; }
Does this compile without error? int main() { int k; { int k; for (k = 0; k < 10; k++); } }
Which of the following declaration is not supported by C?
Which of the following format identifier can never be used for the variable var? int main() { char *var = "Advanced Training in C by AllIndiaExams.com"; }
Which of the following is not a pointer declaration?
What is the output of this C code? void main() { int k = 4; float k = 4; printf("%d", k) }
Which is false ?
A variable declared in a function can be used in main?
The name of the variable used in one function cannot be used in another function?
What is the output of this C code? int main() { char *p = NULL; char *q = 0; if (p) printf(" p "); else printf("nullp"); if (q) printf("q "); else printf(" nullq "); }
What is the output of this C code? int main() { int i = 10; void *p = &i; printf("%d ", (int)*p); return 0; }
What is the output of this C code? int main() { int i = 10; void *p = &i; printf("%f ", *(float*)p); return 0; }
What is the output of this C code? int *f(); int main() { int *p = f(); printf("%d ", *p); } int *f() { int *j = (int*)malloc(sizeof(int)); *j = 10; return j; }
What is the output of this C code? int *f(); int main() { int *p = f(); printf("%d ", *p); } int *f() { int j = 10; return &j; }
What is the output of this C code? int main() { int *ptr, a = 10; ptr = &a; *ptr += 1; printf("%d,%d/n", *ptr, a); }
Comment on the following? const int *ptr;
Which is an indirection operator among the following?
Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0)?
What is the output of this C code? int x = 0; void main() { int *ptr = &x; printf("%p ", ptr); x++; printf("%p ", ptr); }
What is the output of this C code? int x = 0; void main() { int *const ptr = &x; printf("%p ", ptr); ptr++; printf("%p ", ptr); }
What is the output of this C code? void main() { int x = 0; int *ptr = &x; printf("%p ", ptr); ptr++; printf("%p ", ptr); }
What is the output of this C code? void main() { int x = 0; int *ptr = &5; printf("%p ", ptr); }
What is the output of this C code? void main() { int x = 0; int *ptr = &x; printf("%d ", *ptr); }
What is the output of this C code? void foo(int*); int main() { int i = 10; foo((&i)++); } void foo(int *p) { printf("%d ", *p); }
What is the output of this C code? void foo(int*); int main() { int i = 10, *p = &i; foo(p++); } void foo(int *p) { printf("%d ", *p); }
What is the output of this C code? void foo(float *); int main() { int i = 10, *p = &i; foo(&i); } void foo(float *p) { printf("%f ", *p); }
What is the output of this C code? int main() { int i = 97, *p = &i; foo(&i); printf("%d ", *p); } void foo(int *p) { int j = 2; p = &j; printf("%d ", *p); }
What is the output of this C code? int main() { int i = 97, *p = &i; foo(&p); printf("%d ", *p); return 0; } void foo(int **p) { int j = 2; *p = &j; printf("%d ", **p); }
What is the output of this C code? int main() { int i = 10; int *p = &i; foo(&p); printf("%d ", *p); printf("%d ", *p); } void foo(int **const p) { int j = 11; *p = &j; printf("%d ", **p); }
What is the output of the code below? int main() { int i = 10; int *const p = &i; foo(&p); printf("%d ", *p); } void foo(int **p) { int j = 11; *p = &j; printf("%d ", **p); }
Which of the following are correct syntaxes to send an array as a parameter to function: A. func(&array);
What is the output of this C code? void main() { int k = 5; int *p = &k; int **m = &p; printf("%d%d%d ", k, *p, **m); }
What is the output of this C code? void main() { int k = 5; int *p = &k; int **m = &p; printf("%d%d%d ", k, *p, **p); }
What is the output of this C code? void main() { int k = 5; int *p = &k; int **m = &p; **m = 6; printf("%d ", k); }
What is the output of this C code? void main() { int a[3] = {1, 2, 3}; int *p = a; int *r = &p; printf("%d", (**r));
What is the output of this C code? void main() { int a[3] = {1, 2, 3}; int *p = a; int **r = &p; printf("%p %p", *r, a); }
How many number of pointer (*) does C have against a pointer variable declaration?
What is the output of this C code? int main() { int a = 1, b = 2, c = 3; int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c; int **sptr = &ptr1; //-Ref *sptr = ptr2; }
What substitution should be made to //-Ref such that ptr1 points to variable C? int main() { int a = 1, b = 2, c = 3; int *ptr1 = &a; int **sptr = &ptr1; //-Ref }
Which of the following declaration throw run-time error?
Comment on the output of this C code? int main() { int a = 10; int **c -= &&a; }
The function ____ obtains block of memory dynamically.
void * malloc(size_t n) returns:
calloc() returns a storage that is initialized to.
In function free(p), p is a:
What is the output of this C code? void main() { char *p = calloc(100, 1); p = "welcome"; printf("%s ", p); }
Memory allocation using malloc() is done in?
Why do we write (int *) before malloc? int *ip = (int *)malloc(sizeof(int));
Which one is used during memory deallocation in C?
Which of the following will return a result most quickly for searching a given key?
On freeing a dynamic memory, if the pointer value is not modified, then the pointer points to?
calloc initialises memory with all bits set to zero.
C99 standard guarantees uniqueness of ____ characters for internal names.
. C99 standard guarantess uniqueness of _____ characters for external names.
Which of the following is not a valid variable name declaration?
Variable names beginning with underscore is not encouraged. Why?
All keywords in C are in?
Variable name resolving (number of significant characters for uniqueness of variable) depends on?
Which of the following is not a valid C variable name?
Which of the following is true for variable names in C?
Which is valid C expression?
What is the output of this C code? int main() { printf("Hello World! %d ", x); return 0; }
What is the output of this C code? int main() { int y = 10000; int y = 34; printf("Hello World! %d ", y); return 0;
What will happen if the below program is executed? int main() { int main = 3; printf("%d", main); return 0; }
What is the problem in following variable declaration? float 3Bedroom-Hall-Kitchen?;
Which of the following cannot be a variable name in C?
Which of the following cannot be a variable name in C?