Can I increase the size of statically allocated array?
Answer: B
No answer description available for this question.
Enter details here
Which of the following is an example for non linear data type?
Answer: A
A data structure is said to be linear if its elements form a sequence or a linear list. For example array, linked list, queue, stack etc. Elements in a non linear data structure do not form a sequence. For example Trees, graphs etc
Enter details here
What will be the output of the program?
#include
#include
int main()
{
union test
{
int i;
float f;
char c;
};
union test *t;
t = (union test *)malloc(sizeof(union test));
t->f = 10.10f;
printf("%f", t->f);
return 0;
}
Answer: C
No answer description available for this question.
Enter details here
Assume integer is 2 bytes wide. How many bytes will be allocated for the following code?
#include
#include
#define MAXROW 3
#define MAXCOL 4
int main()
{
int (*p)[MAXCOL];
p = (int (*) [MAXCOL])malloc(MAXROW *sizeof(*p));
return 0;
}
Answer: C
No answer description available for this question
Enter details here
Queue data structure works on the principle of ____________
Answer: C
Queue is a linear data structure which works on the principle of first in first out. This means that the first element to be inserted in a queue will be the first one to be removed.
Enter details here
What is the output of this C code?
void main()
{
char *p = calloc(100, 1);
p = "welcome";
printf("%s\n", p);
}
Answer: D
None
Enter details here
malloc() allocates memory from the heap and not from the stack.
Answer: A
Heap area consist of hash codes .i.e. addreses while stack may or may not be that's why malloc() allocates memory from the heap
Enter details here
calloc initialises memory with all bits set to zero.
Answer: A
None
Enter details here
The size of both stack and heap remains the same during run time.
Answer: B
Memory can be allocated or de-allocated during the run time in the heap region. Memory bindings (allocation and de-allocation) are established and destroyed during the execution of the program. Hence we can see that the size of heap does not remain same during run time. However, the size of stack remains the same.
Enter details here