--:--









Quiz for Dynamic memory allocation malloc

Course: C Language | Subject: Unit 6 | Topic: Pointers



Logo

Q1: Which header file is required for using malloc() in C?

Logo

Q2: What does malloc() return when it fails to allocate memory?

Logo

Q3: The malloc() function allocates memory from which area?

Logo

Q4: What is the correct syntax to allocate memory for an array of 10 integers using malloc()?

Logo

Q5: Which function is used to free memory allocated by malloc()?

Logo

Q6: What happens if you access memory after calling free()?

Logo

Q7: What is the default value of memory allocated using malloc()?

Logo

Q8: How can you initialize memory allocated by malloc to zero?

Logo

Q9: Which of the following is true about malloc()?

Logo

Q10: What should be done after using malloc allocated memory?

Logo

Q11: What is the time complexity of malloc() allocation?

Logo

Q12: Which type of pointer should store the return value of malloc()?

Logo

Q13: What happens if malloc() is used without freeing in a loop?

Logo

Q14: How can malloc() allocation size be changed?

Logo

Q15: If malloc(0) is called, what happens?

Logo

Q16: Which of the following is the safest way to check malloc success?

Logo

Q17: Which function can help detect memory leaks in C?

Logo

Q18: What will happen if you free() the same pointer twice?

Logo

Q19: What should be included to avoid casting malloc result in C?

Logo

Q20: Which of the following is an alternative to malloc() for allocating memory?

Are you ready to start test? Set your time limit