Assume integer is 2 bytes wide. What will be the output of the following code?
#include
#include
#define MAXROW 3
#define MAXCOL 4
int main()
{
int (*p)[MAXCOL];
p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p));
printf("%d, %d\n", sizeof(p), sizeof(*p));
return 0;
}
Answer: A
No answer description available for this question
Enter details here
What is the output of this program?
#include
#include
int main()
{
int *p;
p = (int *)malloc(40);
printf("%d", sizeof(p));
free(p);
return 0;
}
Answer: C
Since p is the pointer variable of integer type, thus the size of integer type is 4.
Enter details here
Can we increase the size of statically allocated array?
Answer: B
Yes we increase the size of statically allocated array
Enter details here
What function should be used to free the memory allocated by calloc() ?
Answer: C
No answer description available for this question
Enter details here
Point out the error in the following program.
#include
#include
int main()
{
char *ptr;
*ptr = (char)malloc(30);
strcpy(ptr, "RAM");
printf("%s", ptr);
free(ptr);
return 0;
}
Answer: B
ptr = (char*)malloc(30);
Enter details here
Specify the 2 library functions to dynamically allocate memory?
Answer: C
No answer description available for this question
Enter details here
Array is preferred over linked list for the implementation of ________
Answer: C
When we try to implement binary search using linked list, the traversal steps per element increases in order to find the middle element. Thus, this process is slow and inefficient. This process is much faster using an array, hence it is preferable to use an array for the implementation of binary search.
Enter details here
Which of the following statement is correct prototype of the malloc() function in c ?
Answer: D
By defalut for malloc() function return type is void.
Enter details here
The type of linked list in which the node does not contain any pointer or reference to the previous node:
Answer: B
A singly linked list is one in which each node has two fields, namely data field and pointer field. Data field stores the data and the pointer field points to the address of the next node.
Enter details here
malloc() returns a NULL if it fails to allocate the requested memory.
Answer: A
No Explanation
Enter details here