Skip to main content

MCQ Questions | Advanced C programming

MCQ on Advanced C programming

Explore most important multiple choice Questions on advanced c programming. Here is the chapterwise MCQ for study.

Table of contents
MCQ on Preprocessors
MCQ on pointers
MCQ on strings
MCQ on structure
MCQ on advanced c features
MCQ on file handling
MCQ type Questions on Preprocessors in C

Q1 : What are the types of C Preprocessor Directives ?

  1. Macros
  2. Conditional Compilation
  3. File Inclusion
  4. All the above

Answer : All of the above

Q2 : Processor Directive in C language starts with?

  1. $
  2. @
  3. &
  4. #

Answer : #

Q3 : What is the keyword used to define a C macro ?

  1. def
  2. definition
  3. define
  4. defy

Answer : define

Q4 : What is the C keyword used to create global Constants?

  1. const
  2. definition
  3. def
  4. define

Answer : const

Q5 : What does #include stdio.h in c language ?

  1. It includes stdio.h into existing C program.
  2. #include increases the size of C program by including the specified file contents like functions, constants etc.
  3. #include includes specified file before compilation.
  4. All the above

Answer : All the above

Q6 : #include is called

  1. Preprocessor directive
  2. Inclusion directive
  3. File inclusion directive
  4. All of the mentioned

Answer : Preprocessor directive

Q7 : The preprocessor provides the ability for _______________.

  1. The inclusion of header files
  2. The inclusion of macro expansions
  3. Conditional compilation and line control.
  4. All of the mentioned

Answer : All of the mentioned

Q8 : The purpose of the preprocessor directive #error is that ____________

  1. It rectifies any error present in the code
  2. It rectifies only the first error which occurs in the code
  3. It causes the preprocessor to report a fatal error
  4. It causes the preprocessor to ignore an error

Answer : It causes the preprocessor to report a fatal error

Q9 : Which of the following is not a preprocessor directive?

  1. #error
  2. #pragma
  3. #if
  4. #ifelse

Answer : #ifelse

MCQ type questions on pointers

Q1 : The reason for using pointers in a C program is ?

  1. Pointers allow different functions to share and modify their local variables.
  2. To pass large structures so that complete copy of the structure can be avoided.
  3. Pointers enable complex “linked” data structures like linked lists and binary trees.
  4. All of the above

Answer : All of the above

Q2 : If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?

  1. .
  2. &
  3. ->
  4. *

Answer : ->

Q3 : A pointer is____

  1. A keyword used to create variables
  2. A variable that stores address of an instruction
  3. A variable that stores address of other variable
  4. All of the above

Answer : A variable that stores address of other variable

Q4 : The operator used to get value at address stored in a pointer variable is___

  1. *
  2. &
  3. &&
  4. ||

Answer : *

Q5 : What is wild pointer?

  1. Pointer which is wild in nature
  2. Pointer which has no value.
  3. Pointer which is not initialized
  4. None

Answer : Pointer which is not initialized

Q6 : Address stored in the pointer variable is of type __________.

  1. Integer
  2. Float
  3. Array
  4. Character

Answer : Integer

Q7 : In order to fetch the address of the variable we write preceding _________ sign before variable

  1. %
  2. ,
  3. &
  4. *

Answer : &

Q8 : Comment on this: const int *ptr;

  1. You cannot change the value pointed by ptr
  2. You cannot change the pointer ptr itself
  3. Both (a) and (b)
  4. You can change the pointer as well as the value pointed by it

Answer : You cannot change the value pointed by ptr

Q9 : “*” is called as ________.

  1. Address operator
  2. Value at operator
  3. Scope resolution operator
  4. None of these

Answer : Value at operator

MCQ questions on strings

Q1 : What is the Format specifier used to print a String or Character array in C printf or scanf function?

  1. %c
  2. %d
  3. %s
  4. %w

Answer : %s

Q2 : What is a String in C Language?

  1. String is a new Data Type in C
  2. String is an array of Characters with null character as the last element of array.
  3. String is an array of Characters with null character as the first element of array
  4. String is an array of Integers with 0 as the last element of array.

Answer : String is an array of characters with null character as the last element of array

Q3 : What is the maximum length of a C String?

  1. 32 characters
  2. 64 characters
  3. 256 characters
  4. None of the above

Answer : None of the above

Q4 : How do you accept a Multi Word Input in C Language?

  1. scanf()
  2. gets()
  3. getc()
  4. finds()

Answer : gets()

Q5 : Which function will you choose to join two words?

  1. strcat()
  2. strcpy()
  3. strncon()
  4. memcon()

Answer : strcat()

Q6 : The______ function returns the number of characters that are present before the terminating null character.

  1. strlength()
  2. strlen()
  3. strlent()
  4. strchr()

Answer : strlen()

Q7 : Which of the following function sets first n characters of a string to a given character?

  1. strinit()
  2. strnset()
  3. strset()
  4. strcset()

Answer : strnset()

Q8 : If the two strings are identical, then strcmp() function returns

  1. -1
  2. 1
  3. 0
  4. Yes

Answer : 0

Q9 : Length of the string "lets find course" is

  1. 14
  2. 15
  3. 16
  4. 17

Answer : 16

Q10 : The ______ character is used to indicate end of string in C programming.

  1. '\0'
  2. \\
  3. "
  4. none of these

Answer : '\0'

Q11 : The string processing related functions are stored in ____________ header file.

  1. stdio.h
  2. conio.h
  3. string.h
  4. none of these

Answer : string.h

Q12 : ______ C string function can be used to search string into given string.

  1. strlen()
  2. strcat()
  3. strstr()
  4. none of these

Answer : strstr()

MCQ questions on structure

Q1 : What is a structure in C language?

  1. A structure is a collection of elements that can be of same data type.
  2. A structure is a collection of elements that can be of different data type.
  3. Elements of a structure are called members.
  4. All the above

Answer : All of the above

Q2 : What is the size of a C structure?

  1. C structure is always 128 bytes.
  2. Size of C structure is the total bytes of all elements of structure.
  3. Size of C structure is the size of largest element.
  4. None of the above

Answer : size of c structure is the total bytes of all elements of structure.

Q3 : Choose a correct statement about C structure elements?

  1. Structure elements are stored on random free memory locations
  2. structure elements are stored in register memory locations
  3. structure elements are stored in contiguous memory locations
  4. None of the above

Answer : structure elements are stored in contiguous memory locations.

Q4 : What are the uses of C Structures?

  1. structure is used to implement Linked Lists, Stack and Queue data structures
  2. Structures are used in Operating System functionality like Display and Input taking.
  3. Structure are used to exchange information with peripherals of PC
  4. All of the above

Answer : All of the above

Q5 : Choose a correct statement about C structures.

  1. A structure can contain same structure type member.
  2. A structure size is limited by only physical memory of that PC.
  3. You can define an unlimited number of members inside a structure.
  4. All of the above

Answer : All of the above

Q6 : Which of the following operation is illegal in structures?

  1. Typecasting of structure
  2. Pointer to a variable of the same structure
  3. Dynamic allocation of memory for structure
  4. All of the mentioned

Typecasting of structure.

Q7 : The correct syntax to access the member of the its structure in the array of structures is? Assuming: struct temp { int b; } s[50];

  1. s.b.[i];
  2. s.[i].b;
  3. s.b[i];
  4. s[i].b;

Answer : s[i].b

Q8 : What is the correct syntax to declare a function foo() which receives an array of structure in function?

  1. void foo(struct *var);
  2. void foo(struct *var[]);
  3. void foo(struct var);
  4. none of the mentioned

Answer : void foo(struct *var);

Q9 : Which of the following are themselves a collection of different data types?

  1. string
  2. structures
  3. char
  4. All of the above

Answer : Structures

Q10 : User-defined data type can be derived by___________

  1. struct
  2. enum
  3. typedef
  4. All of the above

Answer : All of the above

Q11 : Which operator connects the structure name to its member name?

  1. -
  2. <-
  3. .
  4. both 1 and 3

Answer : .

Q12 : Which of the following cannot be a structure member?

  1. Another structure
  2. Function
  3. Array
  4. None of the above

Answer : None of the above

MCQ questions of c advanced features

Q1 : Size of a union is determined by size of the.

  1. First member in the union
  2. Last member in the union
  3. Biggest member in the union
  4. Sum of the sizes of all members

Answer : Biggest member in the union

Q2 : Members of a union are accessed as________________.

  1. union-name.member
  2. union-pointer->member
  3. Both a & b
  4. None of the mentioned

Answer : Both a & b

Q3 : Which of the following share a similarity in syntax? 1. Union, 2. Structure, 3. Arrays and 4. Pointers

  1. 3 and 4
  2. 1 and 2
  3. 1 and 3
  4. 1,3 and 4

Answer : 1 and 2

Q4 : Bit fields can only be declared as part of a structure.

  1. false
  2. true
  3. nothing
  4. varies

Answer : true

Q5 : What is the similarity between a structure, union and enumeration?

  1. All of them let you define new values
  2. All of them let you define new data types
  3. All of them let you define new pointers
  4. All of them let you define new structures

Answer : All of them let you define new data types.

Q6 : Which of the following operators can be applied on structure variables?

  1. Equality comparison ( == )
  2. Assignment ( = )
  3. Both of the above
  4. None of the above

Answer : Assignment ( = )

Q7 : Which of the following reduces the size of a structure?

  1. union
  2. bit-fields
  3. malloc
  4. none of the mentioned

Answer : bit-fields

Q8 : Bit field___

  1. is a field having many sub-fields
  2. is a structure declaring the sizes of the members in terms of bits
  3. is a member of a structure whose size is specified in terms of bits
  4. None of the above

Answer : is a structure of declaring the sizes of the members in terms of bits.

Q9 : The declaration int x : 4; means

  1. x is a four digit integer
  2. x cannot be greater than a four digit integer
  3. x is a four-bit integer
  4. none of the above

Answer : x is four-bit integer

File Handling

Q1 : Which of the following true about FILE *fp

  1. FILE is a keyword in C for representing files and fp is a variable of FILE type.
  2. FILE is a stream
  3. FILE is a buffered stream
  4. FILE is a structure and fp is a pointer to the structure of FILE type

Answer : FILE is a keyword in C for representing files and fp is a variable of FILE type.

Q2 : The first and second arguments of fopen() are

  1. A character string containing the name of the file & the second argument is the mode
  2. A character string containing the name of the user & the second argument is the mode
  3. A character string containing file pointer & the second argument is the mode
  4. None of the mentioned

Answer : A character string containing the name of the file & the second argument is the mode

Q3 : Which type of files can’t be opened using fopen()?

  1. .txt
  2. .bin
  3. .c
  4. None of the above

Answer : None of the above

Q4 : If there is any error while opening a file, fopen will return?

  1. Nothing
  2. EOF
  3. NULL
  4. Depends on compiler

Answer : NULL

Q5 : Select a function which is used to write a string to a file…

  1. pits()
  2. putc()
  3. fputs()
  4. fgets()

Answer : fputs()

Q6 : Which function will return the current file position for stream?

  1. fgetpos()
  2. fseek()
  3. ftell()
  4. fsetpos()

Answer : ftell()

Q7 : What is the need for a File when you can store anything in memory?

  1. Memory (RAM) is limited in any computer.
  2. A file is stored on Hard Disk which can store Gigabytes of data.
  3. File stored on Hard Disk is safe even if PC is switched off. But Memory or RAM contents are cleared when PC is off.
  4. All of the above

Answer : All of the above

Q8 : Where is a file temporarily stored before read or write operation in C language?

  1. Notepad
  2. RAM
  3. Hard disk
  4. Buffer

Answer : Hard disk

Q9 : What are the C functions used to read or write a file in Text Mode?

  1. fprintf(), fscanf()
  2. fread(),fwrite()
  3. fprint(),fscan()
  4. read(),write()

Answer : fprintf(),fscanf()

Comments

Trending⚡

Pointer const and Constant Pointer

A constant pointer is a pointer that cannot change the address which it stores.   Syntax: datatype *const pointer_name;  Example:  int a=10,b=20;  int *const ptr;  ptr=&a;  ptr=&b; //here the address in ptr cannot be changed so not allowed . Pointer to constant  Address in the pointer can be changed but the value of the data element which the pointer points cannot be changed.  Syntax: const datatype * pointer_name;  Example:  int a=10,b=20;  const int *ptr=&a;  *ptr=100; //here the value which ptr points to cannot changed so not allowed ptr=&b; //allowed Pointers and Const  The previous two can be combined to form a constant pointer to constant  Syntax: const datatype *const pointer_name; Example:  const int * const ptr;  int a=10,b=20;  const int * const ptr=&a;  *ptr=100; //not allowed  ptr=&b;//not allowed  Here the value which ptr points to cannot be changed an...

India’s Landmark Era of Research, Innovation & Deep-Tech Growth

India’s research and development (R&D) ecosystem is undergoing a historic transformation. The country is shifting from a primarily public-funded research model to a private-sector-driven, innovation-led economy , backed by massive strategic investments. This transformation directly supports the national vision of Viksit Bharat @ 2047 , with Investment and Innovation identified as two of the four core growth engines in the 2025–26 Union Budget . The focus is clear: ➡ Build global innovation leadership ➡ Strengthen deep-tech infrastructure ➡ Attract private capital into strategic sectors ➡ Create a strong research-to-commercialisation pipeline 🧠 Strategic Institutional Foundations Anusandhan National Research Foundation (ANRF) Operational since 2024 Target: ₹50,000 crore mobilisation over 5 years Purpose: Bridge academia–industry collaboration Provide strategic national direction in science & technology Enable interdisciplinary research to solve complex societal challenges R...

Policy vs Innovation Matrix - India

Policy vs Innovation Matrix Policy vs Innovation Matrix that shows the structural difference between policy intent and actual innovation output — and how India’s model is transforming to match global innovation systems . From Paper Policies to Product Power 🧱 Traditional Indian Model (Old System) Policy Layer Reality Innovation Outcome Policy Vision Strong national policies Vision without execution pipelines Funding Govt-dominated funding Limited capital availability Risk Culture Risk-averse systems No deep-tech experimentation Research Academic publications Low commercialization Industry Role Minimal R&D involvement Weak private innovation Infrastructure Limited labs & compute Research bottlenecks Talent High-quality brains Brain drain Commercialisation Weak tech transfer Research stays in journals Scale Fragmented schemes No national scale impact Speed Slow approvals Innovation delays Result: ➡ Policy existed ➡ Innovation did not scale ➡ Research stayed inside institutions ...

Understanding link.click() in JavaScript

Hey! Today i am going to share with you how to use link.click() function in javascript As a JavaScript developer, you may come across the need to programmatically click a link on a web page. The link.click() method is a commonly used way to do this, and it is important to understand how it works and when to use it. What is link.click()? link.click() is a method that can be used to simulate a click on a link element in JavaScript. It is typically used when you want to trigger a link click event programmatically, rather than requiring the user to physically click the link. How to use link.click() Using link.click() is relatively straightforward. First, you need to select the link element you want to click using a DOM selector such as getElementById() or querySelector(). Then, you can call the click() method on the link element to simulate a click. Here is an example: // select the link element const myLink = document.getElementById('my-link'); // simulate a cl...

Basics of Decoder

Basics of Decoder  Decoder is a combinational logic circuit that converts abinary code into the desired output signals. It is called decoder because it performs the reverse process of encoder. The process of converting binaryinput code into desirable output is known as decoding.  Figure 1 is the logic symbol of decoder with ‘n’ inputs and ‘m’ outputs. In short, it is multiple inputs and multiple outputs device with proper conversion system.  Note that decoder performs the reverse operation of the encoder. A decoder has ‘n’ number of input lines and ‘m’ number of output lines. There are 2n possible input combinations and the number of outputs (m) are less than or equal to 2n. Decoder converts an n bit code to single active output. The information present in one code is obtained back into the desired code. In general Decoder is circuit which convert specific code into more general form of code. A decoder is a logic circuit that accepts a set of inputs that represents a bina...

Quiz tells you what type of wife you want

What Type of Wife are You Looking For? Attend this quiz and know your wife expections Quiz reveals type of wife you expect, lets answer carefully... Personality Questions: 1. What type of personality are you looking for in a wife? Quiet and reserved Outgoing and social Intelligent and witty 2. What type of sense of humor are you looking for in a wife? Dry and sarcastic Witty and clever Playful and silly 3. What type of interests are you looking for in a wife? Intellectual and educational Creative and artistic Athletic and outdoorsy Values Questions: 4. What type of family values are you looking for in a wife? Traditional and conservative Open-minded and progressive Balanced and equal 5. What type of political views...