How many number of pointer (*) does C have against a pointer variable declaration?
1.7
2.127
3.255
4.No limits
Posted Date:-2022-03-20 09:51:51
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); }
1.11 11
2.Undefined behaviour
3. Compile time erro
4.Segmentation fault/code-crash
Posted Date:-2022-03-20 09:43:39
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; }
1.10
2.Compile time error
3.Segmentation fault/runtime crash since pointer to local variable is returned
4.Undefined behaviour
Posted Date:-2022-03-20 08:36:17
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 "); }
1. nullp nullq
2.Depends on the compiler
3. x nullq where x can be p or nullp depending on the value of NULL
4. p q
Posted Date:-2022-03-20 08:18:10
What is the output of this C code? int main() { int i = 10; void *p = &i; printf("%f ", *(float*)p); return 0; }
1.Compile time error
2.Undefined behaviour
3.10
4.0.000000
Posted Date:-2022-03-20 08:34:45
What is the output of this C code? int main() { printf("Hello World! %d ", x); return 0; }
1.Hello World! x;
2. Hello World! followed by a junk value
3. Compile time error
4.Hello World!
Posted Date:-2022-03-20 10:59:20
What is the output of this C code? void main() { int k = 4; float k = 4; printf("%d", k) }
1.Compile time error
2.4
3.4.0000000
4.4.4
Posted Date:-2022-03-20 08:12:12
Which one is used during memory deallocation in C?
1. remove(p);
2. delete(p);
3.free(p);
4.terminate(p);
Posted Date:-2022-03-20 10:26:10
. C99 standard guarantess uniqueness of _____ characters for external names.
1.31
2.6
3.12
4.14
Posted Date:-2022-03-20 10:31:26
A variable declared in a function can be used in main?
1.True
2.False
3.True if it is declared static
4.None of the mentioned
Posted Date:-2022-03-20 08:15:03
All keywords in C are in?
1. Lower Case letters
2.Upper Case letters
3. Camel Case letters
4.None
Posted Date:-2022-03-20 10:54:03
C99 standard guarantees uniqueness of ____ characters for internal names.
1.31
2.63
3.12
4.14
Posted Date:-2022-03-20 10:30:52
calloc initialises memory with all bits set to zero.
1.True
2.False
3.Depends on the compiler
4.Depends on the standard
Posted Date:-2022-03-20 10:29:11
calloc() returns a storage that is initialized to.
1.Zero
2.Null
3.Nothing
4.One
Posted Date:-2022-03-20 10:18:13
Comment on the following? const int *ptr;
1.You cannot change the value pointed by ptr
2.You cannot change the pointer ptr itselfC.
3.Both (a) and (b)
4.You can change the pointer as well as the value pointed by it
Posted Date:-2022-03-20 09:04:12
Comment on the output of this C code? int main() { const int i = 10; int *ptr = &i; *ptr = 20; printf("%d ", i); return 0; }
1.Compile time errorB. C. D. 10
2.Compile time warning and printf displays 20
3.Undefined behaviour
4.10
Posted Date:-2022-03-20 07:59:14
Comment on the output of this C code? int main() { int a = 10; int **c -= &&a; }
1.You cannot apply any arithmetic operand to a pointer.
2.We don't have address of an address operator
3.Both (a) and (b)
4.None of the mentioned
Posted Date:-2022-03-20 09:59:36
Does this compile without error? int main() { for (int k = 0; k < 10; k++); return 0; }
1.Yes
2.No
3.Depends on the C standard implemented by compilers
4.None of the mentioned
Posted Date:-2022-03-20 08:01:53
Does this compile without error? int main() { int k; { int k; for (k = 0; k < 10; k++); } }
1.Yes
2.no
3.Depends on the compiler
4.Depends on the C standard implemented by compilers
Posted Date:-2022-03-20 08:05:49
In function free(p), p is a:
1.int
2. Pointer returned by malloc()
3.Pointer returned by calloc()
4.Both b & c
Posted Date:-2022-03-20 10:19:27
Memory allocation using malloc() is done in?
1.Static area
2.Stack area
3.Heap area
4.Both b & c
Posted Date:-2022-03-20 10:23:11
On freeing a dynamic memory, if the pointer value is not modified, then the pointer points to?
1.NULL
2.Other dynamically allocated memory
3.The same deallocated memory location
4.It points back to location it was initialized with
Posted Date:-2022-03-20 10:28:18
The function ____ obtains block of memory dynamically.
1.calloc
2.malloc
3.Both a & b
4.free
Posted Date:-2022-03-20 10:15:49
The name of the variable used in one function cannot be used in another function?
1.True
2.False
3.May be
4.None of the mentioned
Posted Date:-2022-03-20 08:15:58
Variable name resolving (number of significant characters for uniqueness of variable) depends on?
1.Compiler and linker implementations
2.Assemblers and loaders implementations
3.C Language
4.None
Posted Date:-2022-03-20 10:55:01
Variable names beginning with underscore is not encouraged. Why?
1. It is not standardized
2.To avoid conflicts since assemblers and loaders use such names
3.To avoid conflicts since library routines use such names
4.To avoid conflicts with environment variables of an operating system
Posted Date:-2022-03-20 10:51:34
void * malloc(size_t n) returns:
1.Pointer to n bytes of uninitialized storage
2.NULL if the request cannot be satisfied
3.Nothing
4.Both a & b are true
Posted Date:-2022-03-20 10:16:46
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; }
1.10
2.Compile time error
3.Segmentation fault/runtime crash
4.Undefined behaviour
Posted Date:-2022-03-20 08:58:50
What is the output of this C code? int main() { int *ptr, a = 10; ptr = &a; *ptr += 1; printf("%d,%d/n", *ptr, a); }
1.10,10
2.10,11
3.11,10
4.11,11
Posted Date:-2022-03-20 09:02:07
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; }
1.ptr1 points to aB. ptr1 points to bC. sptr points to ptr2D. None of the mentioned.
2.ptr1 points to b
3.sptr points to ptr2
4.None of the mentioned.
Posted Date:-2022-03-20 09:53:26
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); }
1.11 11 11
2.11 11 Undefined-value
3.Compile time error
4.Segmentation fault/code-crash
Posted Date:-2022-03-20 09:31:27
What is the output of this C code? int main() { int i = 10; void *p = &i; printf("%d ", (int)*p); return 0; }
1. Compile time error
2.Segmentation fault/runtime crash
3.10
4.Undefined behaviour
Posted Date:-2022-03-20 08:19:28
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); }
1.2 97
2.2 2
3.Compile time error
4.Segmentation fault/code crash
Posted Date:-2022-03-20 09:19:34
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); }
1.2 2
2.2 97
3. Undefined behaviour
4.Segmentation fault/code crash
Posted Date:-2022-03-20 09:23:44
What is the output of this C code? int main() { int y = 10000; int y = 34; printf("Hello World! %d ", y); return 0;
1.Compile time error
2.Hello World!
3.True
4.None of the mentioned
Posted Date:-2022-03-20 11:03:42
What is the output of this C code? int main() { j = 10; printf("%d ", j++); return 0; }
1.10
2.11
3.Compile time error
4.0
Posted Date:-2022-03-20 08:00:29
What is the output of this C code? int x = 0; void main() { int *const ptr = &x; printf("%p ", ptr); ptr++; printf("%p ", ptr); }
1.0 1
2.Compile time error
3.0xbfd605e8 0xbfd605ec
4.0xbfd605e8 0xbfd605e8
Posted Date:-2022-03-20 09:09:56
What is the output of this C code? int x = 0; void main() { int *ptr = &x; printf("%p ", ptr); x++; printf("%p ", ptr); }
1.Same address
2.Different address
3.Compile time error
4.Varies
Posted Date:-2022-03-20 09:08:46
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; }
1.Compile time error
2.10 20
3.Undefined value
4.10
Posted Date:-2022-03-20 07:55:42
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); }
1.10.000000
2.0.000000
3.Compile time error
4.Undefined behaviour
Posted Date:-2022-03-20 09:18:21
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); }
1.10
2.Some garbage value
3.Compile time error
4.Segmentation fault
Posted Date:-2022-03-20 09:17:01
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); }
1.10
2.Some garbage value
3.Compile time error
4.Segmentation fault/code crash
Posted Date:-2022-03-20 09:15:51
What is the output of this C code? void main() { char *p = calloc(100, 1); p = "welcome"; printf("%s ", p); }
1.Segmentation fault
2.garbage
3.Error
4.welcome
Posted Date:-2022-03-20 10:21:58
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); }
1.Different address is printed
2.1
3.Same address is printed
4.1 1
Posted Date:-2022-03-20 09:51:04
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));
1.1
2.Compile time error
3.Address of a
4. Junk value
Posted Date:-2022-03-20 09:50:12
What is the output of this C code? void main() { int k = 5; int *p = &k; int **m = &p; **m = 6; printf("%d ", k); }
1.5
2.Compile time error
3.6
4.Junk
Posted Date:-2022-03-20 09:48:50
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); }
1.5 5 5
2.5 5 junk value
3.5 junk value
4.Run time error
Posted Date:-2022-03-20 09:46:20
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); }
1.5 5 5
2. 5 5 junk value
3. 5 junk value
4.Compile time error
Posted Date:-2022-03-20 09:47:31
What is the output of this C code? void main() { int x = 0; int *ptr = &5; printf("%p ", ptr); }
1.5
2. Address of 5
3.Nothing
4.Compile time error
Posted Date:-2022-03-20 09:13:52
What is the output of this C code? void main() { int x = 0; int *ptr = &x; printf("%d ", *ptr); }
1.Address of x
2.Junk value
3.0
4.Run time error
Posted Date:-2022-03-20 09:14:53
What is the output of this C code? void main() { int x = 0; int *ptr = &x; printf("%p ", ptr); ptr++; printf("%p ", ptr); }
1. 0xbfd605e8 0xbfd605ec
2.0xbfd605e8 0cbfd60520
3.0xbfd605e8 0xbfd605e9
4.Run time error
Posted Date:-2022-03-20 09:12:54
What is the problem in following variable declaration? float 3Bedroom-Hall-Kitchen?;
1.The variable name begins with an integer
2.The special character '-'
3.The special character '?'
4.All of the mentioned
Posted Date:-2022-03-20 11:09:12
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 }
1.*sptr = &c;
2. **sptr = &c;
3.*ptr1 = &c;
4.None of the mentioned
Posted Date:-2022-03-20 09:56:03
What will happen if the below program is executed? int main() { int main = 3; printf("%d", main); return 0; }
1.It will cause a compile-time error
2. It will cause a run-time error
3.It will run without any error and prints 3
4.It will experience infinite looping
Posted Date:-2022-03-20 11:04:39
Which is an indirection operator among the following?
1.&
2.*
3.->
4. .
Posted Date:-2022-03-20 09:05:18
Which is false ?
1.A variable defined once can be defined again with different scope
2. A single variable cannot be defined with two different types in the same scope
3.A variable must be declared and defined at the same time
4.A variable refers to a location in memory
Posted Date:-2022-03-20 08:13:55
Which is valid C expression?
1.int my_num = 100,000;
2.int my_num = 100000;
3. int my num = 1000;
4. int $my_num = 10000;
Posted Date:-2022-03-20 10:58:23
Which of the following are correct syntaxes to send an array as a parameter to function: A. func(&array);
1.func(array);
2.func(array);
3. func(*array);
4.func(array[size]);
Posted Date:-2022-03-20 09:45:08
Which of the following cannot be a variable name in C?
1.Volatile
2.True
3.friend
4.export
Posted Date:-2022-03-20 11:10:57
Which of the following cannot be a variable name in C?
1.Volatile
2.True
3.friend
4.export
Posted Date:-2022-03-20 11:12:05
Which of the following declaration is not supported by C?
1.String str
2.char *str;
3.float str = 3e2
4.Both (a) and (c)
Posted Date:-2022-03-20 08:07:01
Which of the following declaration throw run-time error?
1.int **c = &c;
2.int **c = &*c;
3. int **c = **c
4.None of the mentioned
Posted Date:-2022-03-20 09:57:31
Which of the following does not initialize ptr to null (assuming variable declaration of a as int a=0)?
1.int *ptr = &a;
2. int *ptr = &a "“ &a;
3. int *ptr = a "“ a;
4.All of the mentioned
Posted Date:-2022-03-20 09:07:48
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"; }
1.%f
2.%d
3.%c
4. %s
Posted Date:-2022-03-20 08:08:21
Which of the following is not a pointer declaration?
1.char a[10];
2.char a[] = {'1', '2', '3', '4'};
3.char *str;
4.char a;
Posted Date:-2022-03-20 08:10:37
Which of the following is not a valid C variable name?
1.int number;
2.float rate;
3.int variable_count;
4.int $main;
Posted Date:-2022-03-20 10:56:15
Which of the following is not a valid variable name declaration?
1.int __a3;
2.int __3a;
3.int __A3;
4.None of the mentioned
Posted Date:-2022-03-20 10:50:44
Which of the following is true for variable names in C?
1.They can contain alphanumeric characters as well as special characters
2.It is not an error to declare a variable to be one of the keywords(like goto, static)
3.Variable names cannot start with a digit.
4.Variable can be of any length.
Posted Date:-2022-03-20 10:57:15
Which of the following will return a result most quickly for searching a given key?
1.Unsorted Array
2.Sorted Array
3.Sorted linked list
4.Binary Search Tree
Posted Date:-2022-03-20 10:27:05
Why do we write (int *) before malloc? int *ip = (int *)malloc(sizeof(int));
1.It is for the syntax correctness
2.It is for the type-casting
3. It is to inform malloc function about the data-type expected
4.None of the mentioned
Posted Date:-2022-03-20 10:24:09