Welcome to C Programming Quiz, Randomly Selected !!

Question 1. Which bitwise operator is suitable for checking whether a particular bit is on or off?

&& operator

& operator

|| operator

! operator

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


demalloc(variable_name, 0)


decalloc(variable_name, 0)

Question 3. 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 4. What does x mean in this code sample ?
typedef char (*(*arrfptr[3])())[10];
arrfptr x;

x is a pointer

x is an array of three pointer

x is an array of three function pointers

error in declaration of x

Question 5. What number will z in the following code sample
int z,x=5,y=-10,a=4,b=2;
z = x++ - --y * b / a;





Question 6. Which of the following operations can be performed on the file "NOTES.TXT" using the below code?
FILE *fp;
fp = fopen("NOTES.TXT", "r+");




read and write

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



1 and 3


Question 8. What will be the output of the program?
int main(void) {

                int i=3, j;
                i++ + i++ + i++;
                printf("%d", j);
                return 0;



compilation error

undefined behavior

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



long double

far double

Question 10. The function crash(), defined below, triggers a fault in the memory management hardware for many architectures. Which one of the following explains why "got here" may NOT be printed before the crash?
void crash (void) 
 printf("got here"); 
 *((char *) 0) = 0; 

The C standard says that dereferencing a null pointer causes undefined behavior. This may explain why printf() apparently fails.

printf() always buffers output until a newline character appears in the buffer. Since no newline was present in the format string, nothing is printed.

If the standard output stream is buffered, the library buffers may not be flushed before the crash occurs.

printf() expects more than a single argument. Since only one argument is given, the crash may actually occur inside printf(), which explains why the string is not printed. puts() should be used instead.