Explore topic-wise MCQs in C.

This section includes 1 Mcqs, each offering curated multiple-choice questions to sharpen your C knowledge and support exam preparation. Choose a topic below to get started.

1.

Suppose we have a one dimensional array, named x , which contains 10 integers. Which of the following is the correct way to allocate memory dynamically to the array x using malloc()?

A. x=(int*)malloc(10);
B. x=(int*)malloc(10,sizeof(int));
C. x=malloc(int 10,sizeof(int));
D. x=(int*)malloc(10*sizeof(int));
Answer» E.