Welcome to C Programming Quiz, Entry Level !!

Question 1. Identify which of the following are declarations
1:   extern int x;
2:   float square ( float x ) { ... }
3:   double pow(double, double);

1

2

1 and 3

3

Question 2. How will you free the memory allocated by the following program?
#include<stdio.h>
#include<stdlib.h>
#define MAXROW 3
#define MAXCOL 4

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

memfree(int p)

dealloc(p)

malloc(p, 0)

free(p)

Question 3. Which bitwise operator is suitable for turning on a particular bit in a number?

&& operator

|| operator

& operator

| operator

Question 4. what is meant by (void*)0

representation of void pointer

representation of null pointer

both of the above

Compilation Error

Question 5. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?

rem = 3.14 % 2.1;

rem = modf(3.14, 2.1);

rem = fmod(3.14, 2.1);

Remainder cannot be obtain in floating point division.

Question 6. Is there any difference between following declarations?
1:  extern int fun();
2:  int fun();

Both are identical

No difference, except extern int fun(); is probably in another file

int fun(); is overrided with extern int fun();

None of the above

Question 7. In the following program where is the variable a getting defined and where it is getting declared?
#include<stdio.h>
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 8. Which files will get closed through the fclose() in the following program?
#include<stdio.h>

int main()
{
    FILE *fs, *ft, *fp;
    fp = fopen("A.C", "r");
    fs = fopen("B.C", "r");
    ft = fopen("C.C", "r");
    fclose(fp, fs, ft);
    return 0;
}

"A.C" "B.C" "C.C"

"B.C" "C.C"

"A.C"

error in fclose()

Question 9. Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
    printf("%f\n", log(36.0));
    return 0;
}

#include<conio.h>

#include<math.h>

#include<stdlib.h>

#include<dos.h>

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

* (asterisk)

| (pipeline)

- (hyphen)

_ (underscore)