C Programming
MEMORY ALLOCATION MCQs
Total Questions : 10
Answer is Option A. -> Yes
Using free()
Using free()
Answer is Option B. -> No
Answer is Option A. -> Yes
Use realloc(variable_name, value);
Use realloc(variable_name, value);
Answer is Option B. -> False
Syntax: void *malloc(size_t size);
The malloc() function shall allocate unused space for an object whose size in bytes is specified by size and whose value is unspecified.
The order and contiguity of storage allocated by successive calls to malloc() is unspecified.
Syntax: void *malloc(size_t size);
The malloc() function shall allocate unused space for an object whose size in bytes is specified by size and whose value is unspecified.
The order and contiguity of storage allocated by successive calls to malloc() is unspecified.
Answer is Option B. -> False
Answer is Option A. -> True
Answer is Option A. -> True
Answer is Option D. -> void* malloc(size_t);
Question 9.
#include<stdio.h>
#include<stdlib.h>
iint main()
{
struct ex
{
int i;
float j;
char *s
};
struct ex *p;
p = (struct ex *)malloc(sizeof(struct ex));
p->s = (char*)malloc(20);
return 0;
}
Point out the correct statement which correctly free the memory pointed to by 's' and 'p' in the following program?
#include<stdio.h>
#include<stdlib.h>
iint main()
{
struct ex
{
int i;
float j;
char *s
};
struct ex *p;
p = (struct ex *)malloc(sizeof(struct ex));
p->s = (char*)malloc(20);
return 0;
}
Answer is Option B. -> free(p->s); , free(p);
Answer is Option D. -> p = (int*) malloc(3*4*sizeof(int));
Recent Questions
Q. What Are The Intrinsic Factors For The Microbial Growth?
Q. ....
Q. If V₁ Is The Jet Velocity And V₀ Is The Vehicle Velocity....
Q. ....
Q. Addition Of Tungsten To Steel Imparts
Q. Three Friends Had Dinner At A Restaurant. When The Bill Was ....
Q. 25 Pieces Of Shirt Each 125 Cm In Length Can Be Cut Fror A....
Q. ....
Q. Find Out That Word, The Spelling Of Which Is Wrong.
Q. Laser Jet Printer Speeds Are Measured In Pages Per Minute (p....
Q. A Bag Contains 25 Kg Of Rice At ₹ 20.04 Per Kg And 20....
Q. Regarding The Assertion And Reason, Choose The Correct Optio....
Q. The Increase In Entropy Of A System Represents
Q. The SI Unit Of ___ Is Named After Andre Marie Ampere.
Q. The Predominent Isotope Of The Naturally Occuring Element I....
Q. Gravity Feed Method For Solvent Delivery Is Not Used With Na....
Q. Vanita Bought A Watch With 25% Discount On The Selling Price....
Q. if A Boat Goes 7 Km Upstream In 42 Minutes And The Speed O....
Q. Scavenging Air In Diesel Engine Means
Q. The Prices Of Bonds Will Be Increased If The Interest Rates