🎯 120+ Questions • Updated 2026

C Language Multiple Choice Questions

Master C programming with 120+ curated MCQs covering basics, pointers, arrays, structures, file I/O, and more. Perfect for exams, interviews, and placement preparation.

📚20 Topics
120+ Questions
🎯Exam Ready

📚Explore C Language Topics

📝C Language MCQs(120 questions)

1

Which of the following language is the predecessor to C programming language?

  • A

    A Language

  • B

    B Language

  • C

    BCPL

  • D

    C++ Language

Show Answer
B. B Language
2

C programming language was developed by whom?

  • A

    Dennis Ritchie

  • B

    Ken Thompson

  • C

    Bill Gates

  • D

    Peter Norton

Show Answer
A. Dennis Ritchie
3

In which year was C developed?

  • A

    1972

  • B

    1970

  • C

    1976

  • D

    1979

Show Answer
A. 1972
4

C is a __________ language.

  • A

    High level

  • B

    Low level

  • C

    Middle level

  • D

    Machine level

Show Answer
C. Middle level
5

C language is available for which operating systems?

  • A

    DOS

  • B

    Windows

  • C

    Unix

  • D

    All of these

Show Answer
D. All of these
6

Which symbol is used to denote a pre-processor statement in C?

  • A

    |

  • B

    #

  • C

    ^

  • D

    ;

Show Answer
B. #
7

Which of the following are tokens in C?

  • A

    Keywords

  • B

    Variables

  • C

    Constants

  • D

    All of these

Show Answer
D. All of these
8

What is the valid range of numbers for an int type in C?

  • A

    0 to 256

  • B

    -32768 to +32767

  • C

    -65536 to +65536

  • D

    None of these

Show Answer
B. -32768 to +32767
9

Which of the following is a scalar data type?

  • A

    Float

  • B

    Union

  • C

    Array

  • D

    Pointer

Show Answer
A. Float
10

Which symbol is used as a statement terminator in C?

  • A

    !

  • B

    #

  • C

    $

  • D

    ;

Show Answer
D. ;
11

A character constant should be enclosed between __________.

  • A

    Single quotes

  • B

    Double quotes

  • C

    Both A and B

  • D

    None of these

Show Answer
A. Single quotes
12

What is the maximum length of a variable name in C?

  • A

    8

  • B

    16

  • C

    32

  • D

    64 (ANSI standard)

Show Answer
D. 64 (ANSI standard)
13

What is the result of 5 % 2 in C?

  • A

    2

  • B

    1

  • C

    0

  • D

    3

Show Answer
B. 1
14

Which operator is used to access the address of a variable?

  • A

    *

  • B

    &

  • C

    %

  • D

    ->

Show Answer
B. &
15

What is the associativity of the assignment operator (=) in C?

  • A

    Left to right

  • B

    Right to left

  • C

    Both

  • D

    None

Show Answer
B. Right to left
16

Which operator is used for logical AND in C?

  • A

    &

  • B

    &&

  • C

    |

  • D

    ||

Show Answer
B. &&
17

What is the size of an int data type in C (typically on a 32-bit system)?

  • A

    2 bytes

  • B

    4 bytes

  • C

    8 bytes

  • D

    1 byte

Show Answer
B. 4 bytes
18

What does the 'sizeof' operator return?

  • A

    The size of a variable in bytes

  • B

    The address of a variable

  • C

    The value of a variable

  • D

    The type of a variable

Show Answer
A. The size of a variable in bytes
19

Which statement is used to exit a loop in C?

  • A

    break

  • B

    continue

  • C

    return

  • D

    exit

Show Answer
A. break
20

What is the output of the following code? int a = 10; if(a<10) printf('Yes'); else printf('No');

  • A

    Yes

  • B

    No

  • C

    Error

  • D

    None

Show Answer
B. No
21

Which loop is guaranteed to execute at least once?

  • A

    for

  • B

    while

  • C

    do-while

  • D

    All of these

Show Answer
C. do-while
22

What is the use of the 'switch' statement in C?

  • A

    To implement multi-way branching

  • B

    To loop until a condition is met

  • C

    To define a function

  • D

    To declare variables

Show Answer
A. To implement multi-way branching
23

What is the default case in a switch statement?

  • A

    It executes when no case matches

  • B

    It executes before all cases

  • C

    It is mandatory

  • D

    It executes after all cases

Show Answer
A. It executes when no case matches
24

What is the output of: for(i=0;i<3;i++) printf('%d',i);

  • A

    0 1 2

  • B

    0 1 2 3

  • C

    1 2 3

  • D

    No output

Show Answer
A. 0 1 2
25

Which index is used to access the first element of an array in C?

  • A

    1

  • B

    0

  • C

    -1

  • D

    Any

Show Answer
B. 0
26

What is the size of int arr[10] if each int is 4 bytes?

  • A

    20 bytes

  • B

    40 bytes

  • C

    10 bytes

  • D

    4 bytes

Show Answer
B. 40 bytes
27

Which of the following correctly declares a 2D array in C?

  • A

    int arr[3][4];

  • B

    int arr[3,4];

  • C

    int arr(3)(4);

  • D

    int arr[3] [4];

Show Answer
A. int arr[3][4];
28

What is the name of the first element of an array?

  • A

    arr[0]

  • B

    arr[1]

  • C

    arr

  • D

    arr[last]

Show Answer
A. arr[0]
29

What is the output of: int a[] = {1,2,3}; printf('%d', a[2]);

  • A

    1

  • B

    2

  • C

    3

  • D

    Error

Show Answer
C. 3
30

What is the maximum number of dimensions an array can have in C?

  • A

    1

  • B

    2

  • C

    No limit

  • D

    3

Show Answer
C. No limit (practically limited by memory and compiler)
31

What is the return type of the main() function in C?

  • A

    int

  • B

    void

  • C

    float

  • D

    char

Show Answer
A. int
32

Which keyword is used to define a function in C?

  • A

    function

  • B

    def

  • C

    void

  • D

    There is no keyword; functions are defined by their return type and name

Show Answer
D. There is no keyword; functions are defined by their return type and name
33

What is the scope of a variable declared inside a function?

  • A

    Local to the function

  • B

    Global

  • C

    File scope

  • D

    Block scope

Show Answer
A. Local to the function
34

Which of the following is a valid function prototype?

  • A

    int sum(int a, int b);

  • B

    sum(int a, int b) int;

  • C

    int sum(a,b);

  • D

    void sum(int a, b);

Show Answer
A. int sum(int a, int b);
35

What is the purpose of the 'return' statement in a function?

  • A

    To exit the function and optionally return a value

  • B

    To declare a variable

  • C

    To call another function

  • D

    To print something

Show Answer
A. To exit the function and optionally return a value
36

What is recursion in C?

  • A

    Function calling itself

  • B

    Function calling another function

  • C

    Function without a return type

  • D

    Function with multiple parameters

Show Answer
A. Function calling itself
37

What is a pointer in C?

  • A

    A variable that stores the address of another variable

  • B

    A data type

  • C

    A function

  • D

    A loop

Show Answer
A. A variable that stores the address of another variable
38

Which operator is used to get the address of a variable?

  • A

    *

  • B

    &

  • C

    %

  • D

    ->

Show Answer
B. &
39

Which operator is used to dereference a pointer?

  • A

    *

  • B

    &

  • C

    %

  • D

    ->

Show Answer
A. *
40

What is the size of a pointer in C (on a 64-bit system)?

  • A

    2 bytes

  • B

    4 bytes

  • C

    8 bytes

  • D

    1 byte

Show Answer
C. 8 bytes
41

What is a NULL pointer?

  • A

    A pointer that points to nothing

  • B

    A pointer that points to address 0

  • C

    A pointer that is not initialized

  • D

    Both A and B

Show Answer
D. Both A and B
42

What is a pointer to a function?

  • A

    A pointer that stores the address of a function

  • B

    A function that returns a pointer

  • C

    A data type

  • D

    A loop

Show Answer
A. A pointer that stores the address of a function
43

What is a structure in C?

  • A

    A collection of variables of different data types under a single name

  • B

    An array of similar data types

  • C

    A pointer

  • D

    A function

Show Answer
A. A collection of variables of different data types under a single name
44

How is a union different from a structure?

  • A

    Union members share the same memory location; structure members have separate memory

  • B

    Union can hold only one data type

  • C

    Structure members share memory

  • D

    There is no difference

Show Answer
A. Union members share the same memory location; structure members have separate memory
45

Which operator is used to access structure members via a pointer?

  • A

    .

  • B

    ->

  • C

    &

  • D

    *

Show Answer
B. ->
46

How do you define a structure in C?

  • A

    struct { int x; float y; } variable;

  • B

    structure { int x; float y; } variable;

  • C

    typedef struct { int x; float y; } variable;

  • D

    Both A and C

Show Answer
D. Both A and C
47

What is the size of a union?

  • A

    Sum of sizes of all members

  • B

    Size of the largest member

  • C

    Average of sizes

  • D

    Size of the first member

Show Answer
B. Size of the largest member
48

Can you pass a structure to a function by value in C?

  • A

    Yes

  • B

    No

  • C

    Only by reference

  • D

    Only pointers

Show Answer
A. Yes
49

Which library is used for file I/O in C?

  • A

    stdio.h

  • B

    stdlib.h

  • C

    string.h

  • D

    math.h

Show Answer
A. stdio.h
50

What is the function to open a file in C?

  • A

    fopen()

  • B

    open()

  • C

    file_open()

  • D

    create_file()

Show Answer
A. fopen()
51

Which mode is used to open a file for reading in C?

  • A

    r

  • B

    w

  • C

    a

  • D

    rw

Show Answer
A. r
52

What is the function to close a file in C?

  • A

    fclose()

  • B

    close()

  • C

    file_close()

  • D

    clos()

Show Answer
A. fclose()
53

Which function is used to read a line from a file in C?

  • A

    fgets()

  • B

    fgetline()

  • C

    gets()

  • D

    scanf()

Show Answer
A. fgets()
54

What does feof() function do?

  • A

    Checks for end-of-file

  • B

    Reads a file

  • C

    Writes to a file

  • D

    Closes a file

Show Answer
A. Checks for end-of-file
55

What is the output of #define SQUARE(x) (x*x) when SQUARE(3) is used?

  • A

    9

  • B

    6

  • C

    12

  • D

    Error

Show Answer
A. 9
56

What is the purpose of #include directive in C?

  • A

    To include header files

  • B

    To define macros

  • C

    To conditionally compile

  • D

    To declare functions

Show Answer
A. To include header files
57

Which of the following is a preprocessor directive?

  • A

    #ifdef

  • B

    #undef

  • C

    #pragma

  • D

    All of these

Show Answer
D. All of these
58

What is the use of #ifndef?

  • A

    To check if a macro is not defined

  • B

    To check if a macro is defined

  • C

    To include a file

  • D

    To define a macro

Show Answer
A. To check if a macro is not defined
59

What is the purpose of #pragma?

  • A

    To provide additional instructions to the compiler

  • B

    To define a macro

  • C

    To include a header

  • D

    To conditionally compile

Show Answer
A. To provide additional instructions to the compiler
60

What happens if we use #include <filename.h> vs #include 'filename.h'?

  • A

    <> searches in system directories, '' searches in current directory first

  • B

    Both are same

  • C

    <> searches in current directory, '' in system directories

  • D

    None

Show Answer
A. <> searches in system directories, '' searches in current directory first
61

Which function is used to allocate memory dynamically in C?

  • A

    malloc()

  • B

    calloc()

  • C

    realloc()

  • D

    All of these

Show Answer
D. All of these
62

What is the difference between malloc() and calloc()?

  • A

    malloc allocates uninitialized memory; calloc allocates zero-initialized memory

  • B

    malloc takes one argument; calloc takes two

  • C

    Both A and B

  • D

    They are identical

Show Answer
C. Both A and B
63

Which function is used to free dynamically allocated memory?

  • A

    free()

  • B

    delete()

  • C

    release()

  • D

    dealloc()

Show Answer
A. free()
64

What is the return type of malloc()?

  • A

    void*

  • B

    int*

  • C

    char*

  • D

    float*

Show Answer
A. void*
65

What does realloc() do?

  • A

    Changes the size of previously allocated memory

  • B

    Allocates new memory

  • C

    Frees memory

  • D

    Initializes memory

Show Answer
A. Changes the size of previously allocated memory
66

What is a memory leak in C?

  • A

    Memory that is allocated but never freed

  • B

    Memory that is freed twice

  • C

    Memory that is not accessible

  • D

    Memory that is corrupted

Show Answer
A. Memory that is allocated but never freed
67

Which header file is required for string functions in C?

  • A

    string.h

  • B

    stdlib.h

  • C

    stdio.h

  • D

    ctype.h

Show Answer
A. string.h
68

What is the length of the string 'Hello' in C?

  • A

    5

  • B

    6

  • C

    4

  • D

    7

Show Answer
A. 5
69

Which function copies a string in C?

  • A

    strcpy()

  • B

    strncpy()

  • C

    strdup()

  • D

    All of these

Show Answer
D. All of these
70

What is the difference between strcat() and strncat()?

  • A

    strcat concatenates full string; strncat appends a specified number of characters

  • B

    strcat is faster

  • C

    strncat is safer

  • D

    Both A and C

Show Answer
D. Both A and C
71

Which function compares two strings in C?

  • A

    strcmp()

  • B

    strncmp()

  • C

    Both A and B

  • D

    strdiff()

Show Answer
C. Both A and B
72

What is the output of strlen('Hello World')?

  • A

    11

  • B

    10

  • C

    12

  • D

    0

Show Answer
A. 11
73

What is a linked list in C?

  • A

    A dynamic data structure consisting of nodes with pointers

  • B

    An array of structures

  • C

    A type of file

  • D

    A function

Show Answer
A. A dynamic data structure consisting of nodes with pointers
74

What is a stack in C?

  • A

    A LIFO (Last In First Out) data structure

  • B

    A FIFO data structure

  • C

    An array

  • D

    A linked list

Show Answer
A. A LIFO (Last In First Out) data structure
75

What is a queue in C?

  • A

    A FIFO (First In First Out) data structure

  • B

    A LIFO data structure

  • C

    A file

  • D

    A function

Show Answer
A. A FIFO (First In First Out) data structure
76

What is the 'volatile' keyword used for in C?

  • A

    To tell the compiler that a variable's value may change unexpectedly

  • B

    To make a variable read-only

  • C

    To declare a static variable

  • D

    To initialize a variable

Show Answer
A. To tell the compiler that a variable's value may change unexpectedly
77

What is a typedef in C?

  • A

    To create an alias for a data type

  • B

    To define a function

  • C

    To declare a variable

  • D

    To create a structure

Show Answer
A. To create an alias for a data type
78

What is the purpose of 'static' keyword inside a function?

  • A

    To make the variable retain its value across function calls

  • B

    To make the variable global

  • C

    To initialize the variable to 0

  • D

    To make the function inline

Show Answer
A. To make the variable retain its value across function calls
79

What is a bit field in C?

  • A

    A structure member that occupies a specified number of bits

  • B

    An array of bits

  • C

    A pointer to bits

  • D

    A function that manipulates bits

Show Answer
A. A structure member that occupies a specified number of bits
80

What is the 'const' qualifier used for in C?

  • A

    To make a variable read-only

  • B

    To declare a constant

  • C

    To prevent modification

  • D

    All of the above

Show Answer
D. All of the above
81

What is the default return type of a function in C if not specified?

  • A

    int

  • B

    void

  • C

    float

  • D

    char

Show Answer
A. int (in older standards; modern compilers may warn)
82

Which escape sequence is used for a newline in C?

  • A

    \n

  • B

    \t

  • C

    \r

  • D

    \b

Show Answer
A. \n
83

What is the size of a char in C?

  • A

    1 byte

  • B

    2 bytes

  • C

    4 bytes

  • D

    8 bytes

Show Answer
A. 1 byte
84

Which data type is used to store a wide character in C?

  • A

    wchar_t

  • B

    char

  • C

    short

  • D

    long

Show Answer
A. wchar_t
85

What is the result of 10/3 in integer arithmetic?

  • A

    3.33

  • B

    3

  • C

    4

  • D

    0

Show Answer
B. 3
86

Which operator is used to check if two values are equal in C?

  • A

    =

  • B

    ==

  • C

    !=

  • D

    ===

Show Answer
B. ==
87

What is the output of: int i=1; switch(i) { case 1: printf('One'); break; default: printf('Default'); }

  • A

    One

  • B

    Default

  • C

    OneDefault

  • D

    Error

Show Answer
A. One
88

Which loop is most suitable when the number of iterations is known?

  • A

    for

  • B

    while

  • C

    do-while

  • D

    All

Show Answer
A. for
89

What is the output of: int a[5]={1,2}; printf('%d', a[3]);

  • A

    0

  • B

    3

  • C

    Garbage value

  • D

    Error

Show Answer
A. 0 (uninitialized elements are set to 0)
90

How can you pass an array to a function in C?

  • A

    By passing the array name

  • B

    By passing a pointer to the first element

  • C

    Both A and B

  • D

    By passing the array size

Show Answer
C. Both A and B
91

What is the default storage class of a variable declared inside a function?

  • A

    auto

  • B

    static

  • C

    register

  • D

    extern

Show Answer
A. auto
92

Which keyword is used to return a value from a function?

  • A

    return

  • B

    exit

  • C

    break

  • D

    continue

Show Answer
A. return
93

What is pointer arithmetic?

  • A

    Adding or subtracting integers to a pointer to move to other memory locations

  • B

    Multiplying pointers

  • C

    Dividing pointers

  • D

    Comparing pointers

Show Answer
A. Adding or subtracting integers to a pointer to move to other memory locations
94

What is a double pointer in C?

  • A

    A pointer to a pointer

  • B

    A pointer to a structure

  • C

    A pointer to an array

  • D

    A function pointer

Show Answer
A. A pointer to a pointer
95

What is the keyword to define a structure in C?

  • A

    struct

  • B

    union

  • C

    typedef

  • D

    class

Show Answer
A. struct
96

Can a structure contain a pointer to itself?

  • A

    Yes

  • B

    No

  • C

    Only if typedef is used

  • D

    Only in C++

Show Answer
A. Yes
97

Which function writes a character to a file in C?

  • A

    fputc()

  • B

    fprintf()

  • C

    putc()

  • D

    All of these

Show Answer
D. All of these
98

What is the file pointer type in C?

  • A

    FILE*

  • B

    file*

  • C

    FILE

  • D

    File

Show Answer
A. FILE*
99

What is the output of #define VALUE 5+5 when used as int x = VALUE * 2;

  • A

    20

  • B

    15

  • C

    10

  • D

    Error

Show Answer
B. 15 (because 5+5*2 = 15, due to macro expansion)
100

Which directive is used to define a macro in C?

  • A

    #define

  • B

    #undef

  • C

    #ifdef

  • D

    #include

Show Answer
A. #define
101

Which function is used to allocate memory for an array of elements in C?

  • A

    calloc()

  • B

    malloc()

  • C

    realloc()

  • D

    free()

Show Answer
A. calloc()
102

What is the purpose of free() function?

  • A

    To release allocated memory

  • B

    To allocate memory

  • C

    To reallocate memory

  • D

    To initialize memory

Show Answer
A. To release allocated memory
103

Which function converts a string to uppercase in C? (Standard C does not have a built-in one, but we'll ask about toupper)

  • A

    toupper()

  • B

    strupr()

  • C

    strtoupper()

  • D

    toupper() is for characters, not strings; no standard function

Show Answer
D. toupper() is for characters, not strings; no standard function
104

What is the difference between strtok() and strchr()?

  • A

    strtok splits strings, strchr finds a character

  • B

    strchr splits strings, strtok finds a character

  • C

    Both split strings

  • D

    Both find characters

Show Answer
A. strtok splits strings, strchr finds a character
105

What is a recursive function?

  • A

    A function that calls itself

  • B

    A function that calls another function

  • C

    A function that returns void

  • D

    A function that has no parameters

Show Answer
A. A function that calls itself
106

What is the use of 'extern' keyword in C?

  • A

    To declare a variable that is defined in another file

  • B

    To define a static variable

  • C

    To make a variable global

  • D

    To initialize a variable

Show Answer
A. To declare a variable that is defined in another file
107

What is the minimum number of characters in a variable name in C?

  • A

    1

  • B

    2

  • C

    3

  • D

    No minimum

Show Answer
A. 1
108

Which of the following is not a valid data type in C?

  • A

    int

  • B

    float

  • C

    string

  • D

    double

Show Answer
C. string
109

What is the precedence of the logical NOT operator (!) in C?

  • A

    Highest

  • B

    Lowest

  • C

    Same as relational

  • D

    None

Show Answer
A. Highest (among logical operators)
110

Which statement is used to skip the rest of the current iteration in a loop?

  • A

    continue

  • B

    break

  • C

    return

  • D

    goto

Show Answer
A. continue
111

What is the name of the C function to sort an array? (Standard C doesn't have one, but we ask about qsort)

  • A

    sort()

  • B

    qsort()

  • C

    bubble_sort()

  • D

    No standard sorting function

Show Answer
B. qsort() (standard function for sorting)
112

What is an inline function?

  • A

    A function that is expanded at the call site to reduce function call overhead

  • B

    A function that cannot be called

  • C

    A function that returns void

  • D

    A function with no parameters

Show Answer
A. A function that is expanded at the call site to reduce function call overhead
113

What is a void pointer?

  • A

    A pointer that can point to any data type

  • B

    A pointer that points to nothing

  • C

    A pointer that cannot be dereferenced

  • D

    Both A and C

Show Answer
D. Both A and C
114

Can you define a structure inside another structure in C?

  • A

    Yes

  • B

    No

  • C

    Only with typedef

  • D

    Only in C++

Show Answer
A. Yes
115

Which function is used to read a character from a file in C?

  • A

    fgetc()

  • B

    fread()

  • C

    getc()

  • D

    All of these

Show Answer
D. All of these
116

What is the purpose of #error directive?

  • A

    To produce a compile-time error message

  • B

    To stop preprocessing

  • C

    To include a file

  • D

    To define a macro

Show Answer
A. To produce a compile-time error message
117

What is the result of calling free() with a NULL pointer?

  • A

    Nothing happens

  • B

    Memory leak

  • C

    Segmentation fault

  • D

    Error

Show Answer
A. Nothing happens (free(NULL) is safe)
118

Which function returns the length of a string in C?

  • A

    strlen()

  • B

    size()

  • C

    length()

  • D

    strlength()

Show Answer
A. strlen()
119

What is the use of 'register' keyword in C?

  • A

    To suggest the compiler to store the variable in a CPU register

  • B

    To make a variable read-only

  • C

    To make a variable global

  • D

    To define a function

Show Answer
A. To suggest the compiler to store the variable in a CPU register
120

What is a function pointer?

  • A

    A pointer that stores the address of a function

  • B

    A function that returns a pointer

  • C

    A pointer to an array

  • D

    A data type

Show Answer
A. A pointer that stores the address of a function

Frequently Asked Questions

What is C programming language?
C is a powerful, general-purpose programming language developed by Dennis Ritchie at Bell Labs in 1972. It is widely used for system programming, embedded systems, and developing operating systems.
Why should I practice C Language MCQs?
Practicing C MCQs helps you prepare for technical interviews, competitive exams, and placement tests. It strengthens your understanding of core concepts like pointers, memory management, data structures, and control flow.
What are the key topics in C Language?
Key topics include Basics, Data Types, Operators, Control Flow, Arrays, Functions, Pointers, Structures, Unions, File I/O, Preprocessor, Dynamic Memory Allocation, Strings, and Advanced Topics.
How can I prepare for C programming interviews?
Start with basic syntax, practice MCQs, write small programs, understand pointer arithmetic, memory allocation, and data structures. Review common interview questions and practice problem-solving.
Is C still relevant in 2026?
Yes, C remains highly relevant for system programming, embedded systems, operating systems, and performance-critical applications. It is the foundation of many modern languages and is widely used in industries.
What is the best way to learn C programming?
The best way is to read a good textbook, practice writing code, solve exercises, and work on small projects. Regularly testing yourself with MCQs also helps reinforce concepts.