QUIZ ON : C LANGUAGE - POINTERS

POINTERS

00:00:00

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# : 01 out of 20



Array is passed to a function using 'call by value' method.

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

Explanation :

Array is passed to a function using 'call by value' method.

Question No# : 02 out of 20



Specify the 2 library functions to dynamically allocate memory?

Option A. malloc() and memalloc()
Option B. alloc() and memalloc()
Option C. malloc() and calloc()
Option D. memalloc() and faralloc()
True Answer C

Explanation :

Specify the 2 library functions to dynamically allocate memory?

Question No# : 03 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# : 04 out of 20



How will you 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 :

How will you free the allocated memory?

Question No# : 05 out of 20



size of a pointer, which points to a structure, depends on size of a structure.

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

Explanation :

size of a pointer, which points to a structure, depends on size of a structure.

Question No# : 06 out of 20



The expression a[0] and *a[0] are same for int a[100].

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

Explanation :

The expression a[0] and *a[0] are same for int a[100].

Question No# : 07 out of 20



What is (void*)0?

Option A. Representation of NULL pointer
Option B. Representation of void pointer
Option C. Error
Option D. None of above
True Answer A

Explanation :

What is (void*)0?

Question No# : 08 out of 20



Are the expression *ptr++ and ++*ptr are same?

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

Explanation :

Are the expression *ptr++ and ++*ptr are same?

Question No# : 09 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# : 10 out of 20



The return type of malloc function is void.

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

Explanation :

The return type of malloc function is void.

Question No# : 11 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# : 12 out of 20



How many bytes are occupied by near, far and huge pointers (DOS)?

Option A. near=2 far=4 huge=4
Option B. near=4 far=8 huge=8
Option C. near=2 far=4 huge=8
Option D. near=4 far=4 huge=8
True Answer A

Explanation :
near=2, far=4 and huge=4 pointers exist only under DOS. Under windows and Linux every pointers is 4 bytes long.

How many bytes are occupied by near, far and huge pointers (DOS)?

Question No# : 13 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# : 14 out of 20



The three declarations char **apple, char *apple[], and char apple[][] are same.

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

Explanation :

The three declarations char **apple, char *apple[], and char apple[][] are same.

Question No# : 15 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# : 16 out of 20



Which of the following declaration is illegal?

Option A. char *str = “Best C programming classes by Sanfoundry”;
Option B. char str[] = “Best C programming classes by Sanfoundry”;
Option C. char str[20] = “Best C programming classes by Sanfoundry”;
Option D. char[] str = “Best C programming classes by Sanfoundry”;
True Answer D

Explanation :
char[] str is a declaration in Java, but not in C.

Which of the following declaration is illegal?

Question No# : 17 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# : 18 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# : 19 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# : 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