Programming Language

Libraries and Frameworks MCQ

Random: Off 1. What is the purpose of including the <stdio.h> header file in a C program? ⓐ. For mathematical functions ⓑ. For input and output operations ⓒ. For string handling functions ⓓ. For memory allocation functions Explanation: The <stdio.h> header file in C provides functions like printf() and scanf() for input and output operations. […]

Libraries and Frameworks MCQ Read More »

Preprocessor Directives MCQ

Random: Off 1. What is the purpose of a preprocessor directive in C programming? ⓐ. To declare variables ⓑ. To control compilation process ⓒ. To define functions ⓓ. To handle exceptions Explanation: Preprocessor directives in C are used to instruct the compiler to preprocess the information before actual compilation starts, such as including header files,

Preprocessor Directives MCQ Read More »

File Handling MCQ

Random: Off 1. Which function is used to open a file in C? ⓐ. fopen() ⓑ. open() ⓒ. file_open() ⓓ. fop() Explanation: The `fopen()` function is used to open a file in C. It requires two parameters: the name of the file and the mode in which to open the file (e.g., “r” for reading,

File Handling MCQ Read More »

Enumeratios MCQ

Random: Off 1. What is an enumeration in C? ⓐ. A way to define constants ⓑ. A user-defined data type ⓒ. A function ⓓ. A type of loop Explanation: An enumeration is a user-defined data type in C that consists of integral constants, each of which is given a name. 2. How do you define

Enumeratios MCQ Read More »

Unions MCQ

Random: Off 1. How is memory allocated for a union in C? ⓐ. Memory is allocated sequentially for each member of the union ⓑ. Memory is allocated based on the largest member of the union ⓒ. Memory is allocated dynamically during runtime ⓓ. Memory is allocated based on the smallest member of the union Explanation:

Unions MCQ Read More »

Structures MCQ

Random: Off 1. What is a structure in C programming? ⓐ. A type of array ⓑ. A collection of variables of different types ⓒ. A function ⓓ. A pointer Explanation: A structure in C is a user-defined data type that allows the grouping of variables of different types under a single name for easier handling.

Structures MCQ Read More »

Dynamic Memory Allocation MCQ

Random: Off 1. Which function is used to allocate memory dynamically in C? ⓐ. malloc() ⓑ. calloc() ⓒ. realloc() ⓓ. free() Explanation: The `malloc()` function is used to allocate a specified number of bytes of memory during the execution of a program. 2. Which function is used to allocate and initialize memory in C? ⓐ.

Dynamic Memory Allocation MCQ Read More »

Pointers MCQ

Random: Off 1. What is a pointer in C programming? ⓐ. A variable that stores the address of another variable ⓑ. A variable that stores a fixed value ⓒ. A variable that stores a string ⓓ. A variable that stores only integers Explanation: A pointer in C is a variable that stores the memory address

Pointers MCQ Read More »

Strings MCQ

Random: Off 1. Which of the following correctly represents a string termination in C? ⓐ. \t ⓑ. \0 ⓒ. \n ⓓ. \r Explanation: In C, strings are terminated by the null character ‘\0’, which signifies the end of the string. 2. What is the output of the following code snippet?

Strings MCQ Read More »

Arrays MCQ

Random: Off 1. What is an array in C? ⓐ. A single variable that holds multiple values of different types ⓑ. A data structure that can hold multiple values of the same type ⓒ. A function that can return multiple values ⓓ. A collection of strings Explanation: An array in C is a data structure

Arrays MCQ Read More »

Scroll to Top