Welcome to C Programming Quiz, Entry Level !!

Question 1. How will you free the memory allocated by the following program?
#define MAXROW 3
#define MAXCOL 4

int main()
    int **p, i, j;
    p = (int **) malloc(MAXROW * sizeof(int*));
    return 0;

memfree(int p)


malloc(p, 0)


Question 2. Which of the following special symbol allowed in a variable name?

* (asterisk)

| (pipeline)

- (hyphen)

_ (underscore)

Question 3. In the following program where is the variable a getting defined and where it is getting declared?
int main()
    extern int a;
    printf("%d\n", a);
    return 0;
int a=20;

extern int a is declaration, int a = 20 is the definition

int a = 20 is declaration, extern int a is the definition

int a = 20 is definition, a is not defined

a is declared, a is not defined

Question 4. What function should be used to free the memory allocated by calloc() ?


demalloc(variable_name, 0)


decalloc(variable_name, 0)

Question 5. What will you do to treat the constant 3.14 as a long double?

use 3.14LD

use 3.14L

use 3.14DL

use 3.14LF

Question 6. Which statement will you add in the following program to work it correctly?
int main()
    printf("%f\n", log(36.0));
    return 0;





Question 7. By default a real number is treated as a ?



long double

far double

Question 8. In which header file is the NULL macro defined?



stdio.h and stddef.h


Question 9. What are the different types of real data type in C ?

float, double

short int, double, long int

float, double, long double

double, long int, float

Question 10. What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");

open "source.txt" in binary mode for reading

open "source.txt" in binary mode for reading and writing

Create a new file "source.txt" for reading and writing

none of the above