malloc()calloc()realloc()free() function in C?
malloc()calloc()realloc()free()free() on a pointer that is already NULL?
calloc() differ from malloc()?
malloc() initializes memory to zero; calloc() does notcalloc() initializes memory to zero; malloc() does notcalloc() takes one argument; malloc() takes twomalloc() is faster than calloc()int *fptr(int a);int (*fptr)(int a);int fptr(*)(int a);int (*fptr)(int*);func(callback_function);callback_function(func);callback(&func);func() -> callback();stdlib.h is used to generate random numbers?
rand()random()rand_range()randomize()exit() in stdlib.h do?
time.h returns the current system time?
clock()time()gettime()system_time()alloc()malloc()calloc()realloc()strcmp() function from string.h do?
malloc() and free()?
stdio.hstdlib.htime.hmath.hlocaltime() function in time.h do?
rand_range()rand() % rangerandomize()generate_random()int **ptr;int *ptr;int ptr**;int ptr[];int a = 10; int *ptr = &a; int **dptr = &ptr;
*dptr**dptrdptr**ptrint arr[5];int *arr[5];int *arr;int arr[] = {1, 2, 3, 4};int a = 5; int *p = &a; printf("%d", *p);
aAnswers Table:
| Qno | Answer |
|---|---|
| 1 | C) It allows efficient insertion and deletion at both ends |
| 2 | C) Data and a pointer to the next node |
| 3 | B) LIFO (Last In, First Out) access |
| 4 | D) Dequeue |
| 5 | D) Both B and C |
| 6 | A) O(1) |
| 7 | B) Allocating memory at runtime |
| 8 | B) Linked Lists |
| 9 | A) malloc() |
| 10 | B) To deallocate dynamically allocated memory |
| 11 | C) realloc() |
| 12 | B) No effect |
| 13 | C) Memory that is allocated but never freed |
| 14 | B) calloc() initializes memory to zero; malloc() does not |
| 15 | B) Memory leak |
| 16 | B) A pointer that points to a function |
| 17 | B) int (*fptr)(int a); |
| 18 | B) A function that gets passed as an argument to another function |
| 19 | A) They allow dynamic function calls |
| 20 | A) func(callback_function); |
| 21 | A) Functions with a fixed signature |
| 22 | A) It executes the function to which it points |
| 23 | A) rand() |
| 24 | B) Terminates the program with a specified status code |
| 25 | B) time() |
| 26 | B) malloc() |
| 27 | B) Compares two strings |
| 28 | B) stdlib.h |
| 29 | C) Converts the time to local time representation |
| 30 | B) rand() % range |
| 31 | A) A pointer that points to another pointer |
| 32 | A) int **ptr; |
| 33 | C) When passing a pointer to a function and modifying the pointer value |
| 34 | A) It creates a pointer to a pointer to an integer |
| 35 | B) **dptr |
| 36 | B) It allows random access to array elements |
| 37 | B) int *arr[5]; |
| 38 | B) To store pointers to strings or arrays |
| 39 | A) 5 |
| 40 | B) Double pointer |