Welcome to C Programming Quiz, Entry Level !!

Question 1. 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 2. Which of the following cannot be checked in a switch-case statement?

character

integer

float

enum

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

reading

writing

appending

read and write

Question 4. 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 5. A pointer is a

keyword used to create variables

variable that stores address of an instruction

variable that stores address of other variable

all of the above

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

stdio.h

stddef.h

stdio.h and stddef.h

stdlib.h

Question 7. 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 8. 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 9. What is the similarity between a structure, union and enumeration?

All of them let you define new values

All of them let you define new data types

All of them let you define new pointers

All of them let you define new structures

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

* (asterisk)

| (pipeline)

- (hyphen)

_ (underscore)