QUIZ ON : C LANGUAGE - POINTERS

POINTERS

00:00:00

What do the following declarations signify? void *cmp();

Option A. cmp is a pointer to an void type.
Option B. cmp is a void type pointer variable.
Option C. cmp is a function that return a void pointer.
Option D. cmp function returns nothing.
True Answer C

Explanation :

What do the following declarations signify? void *cmp();

Question No# : 01 out of 20

We can allocate a 2-Dimensional array dynamically.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

We can allocate a 2-Dimensional array dynamically.

Question No# : 02 out of 20

NULL pointer is not same as an uninitialized pointer.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :
In case, if we don't have address to be assigned to a pointer, then we can simply use NULL. NULL vs Uninitialized pointer – An uninitialized pointer stores an undefined value. A null pointer stores a defined value, but one that is defined by the environment to not be a valid address for any member or object.

NULL pointer is not same as an uninitialized pointer.

Question No# : 03 out of 20

Pointers are used in a program to allocate memory before the program execution.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Pointers are used in a program to allocate memory before the program execution.

Question No# : 04 out of 20

Which of the following functions is used to free the allocated memory?

Option A. remove(var-name);
Option B. free(var-name);
Option C. delete(var-name);
Option D. dalloc(var-name);
True Answer B

Explanation :
The function free() is used to de-allocate the memory allocated by the functions malloc ( ), calloc ( ), etc, and return it to heap so that it can be used for other purposes. The argument of the function free ( ) is the pointer to the memory which is to be freed.

Which of the following functions is used to free the allocated memory?

Question No# : 05 out of 20

If char *p = "Structured Programming", then p[5] is 'c'.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

If char *p = "Structured Programming", then p[5] is 'c'.

Question No# : 06 out of 20

In ‘C’, if you pass an array as an argument to a function, what actually gets passed?

Option A. Value of elements in array
Option B. First element of the array
Option C. Base address of the array
Option D. Address of the last element of array
True Answer C

Explanation :

In ‘C’, if you pass an array as an argument to a function, what actually gets passed?

Question No# : 07 out of 20

The operator used to get value at address stored in a pointer variable is

Option A. *
Option B. &
Option C. &&
Option D. ||
True Answer A

Explanation :

The operator used to get value at address stored in a pointer variable is

Question No# : 08 out of 20



In ‘C’, if you pass an array as an argument to a function, value of elements in array actually gets passed?

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

In ‘C’, if you pass an array as an argument to a function, value of elements in array actually gets passed?

Question No# : 09 out of 20

NULL pointer points the base address of segment.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

NULL pointer points the base address of segment.

Question No# : 10 out of 20

What function should be used to free the memory allocated by calloc() ?

Option A. dealloc();
Option B. malloc(variable_name, 0)
Option C. free();
Option D. memalloc(variable_name, 0)
True Answer C

Explanation :

What function should be used to free the memory allocated by calloc() ?

Question No# : 11 out of 20



Which of the following expression is equivalent to ++*ptr?

Option A. (*ptr)++
Option B. ++*(ptr)
Option C. (ptr)*++
Option D. (ptr)++*
True Answer A

Explanation :

Which of the following expression is equivalent to ++*ptr?

Question No# : 12 out of 20

If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable.

Option A. ‘.’
Option B. ‘&’
Option C. ‘*’
Option D. ‘->’
True Answer D

Explanation :

If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable.

Question No# : 13 out of 20

Size of the pointer variable depends on the data type that it points to.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Size of the pointer variable depends on the data type that it points to.

Question No# : 14 out of 20

Which of the following accesses a variable in a pointer to a structure, *b?

Option A. b->var;
Option B. b.var;
Option C. b-var;
Option D. b>var;
True Answer A

Explanation :
-> (Arrow) operator is used to access data member of structure using Pointer

Which of the following accesses a variable in a pointer to a structure, *b?

Question No# : 15 out of 20

Which of the following declaration is not supported by C?

Option A. String str;
Option B. char *str;
Option C. float str = 3e2;
Option D. Both String str; & float str = 3e2;
True Answer A

Explanation :
It is legal in Java, but not in C.

Which of the following declaration is not supported by C?

Question No# : 16 out of 20

Are the three declarations char **apple, char *apple[], and char apple[][] same?

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

Are the three declarations char **apple, char *apple[], and char apple[][] same?

Question No# : 17 out of 20

Are the three declarations char **apple, char *apple[], and char apple[][] same?

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer B

Explanation :

Are the three declarations char **apple, char *apple[], and char apple[][] same?

Question No# : 18 out of 20

*ptr ++ is equivalent to

Option A. ptr++
Option B. *ptr
Option C. ++ptr
Option D. ++*ptr
True Answer D

Explanation :

*ptr ++ is equivalent to

Question No# : 19 out of 20

The function free() is used to release dynamically allocated memory back to the heap for possible reuse.

Option A. TRUE
Option B. FALSE
Option C.
Option D.
True Answer A

Explanation :

The function free() is used to release dynamically allocated memory back to the heap for possible reuse.

Question No# : 20 out of 20


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad