MCQ Questions
1. Data Types
2. Operators
3. Pointers
4. Array
5. Preprocessor
6. Structures
7. Control Structures
8. Switch Case
9. Printf
10. Variables
11. File Handling
12. Strings
13. Command Line Arguments
C Star Pattern Codes
C Programming Codes:
C hello world program
C program to take input from user using scanf
C Program using if else control instructions
C program looping
C program for prime number
C program for command line arguments
Array C Programs
Mathematical Operations on an Array
Simple C array program
C Program to Calculate Sum and Average of an Array
C Program to Calculate the Sum of the Array Elements using Pointer
C Program to Calculate Sum of all Elements of an Array using Pointers as Arguments
C Program to Compute the Sum of two One-Dimensional Arrays using Malloc
C Program to Find the Sum of Contiguous Subarray within a 1 – D Array of Numbers which has the Largest Sum
Finding the Largest and Smallest numbers in an array
C Program to Find the Largest Two Numbers in a given Array
C Program to Find the Second Largest & Smallest Elements in an Array
C Program to Find the Largest Number in an Array
Inserting and deleting elements to and from an Array
C Program to Put Even & Odd Elements of an Array in 2 Separate Arrays
C Program to Insert an Element in a Specified Position in a given Array
C Program to Delete the Specified Integer from an Array
C Program to Cyclically permute the elements of an array
Sort and Merge Operations on an Array
C Program to sort array in ascending order
C program to sort a one dimensional array in descending order.
C Program to Sort set of strings in alphabetical order
C Program to Merge and Sort Elements of 2 different arrays
C Program to Merge the Elements of 2 Sorted Array
C Program to Sort N Numbers in Ascending Order using Bubble Sort
C Program to Split an Array from Specified Position & Add First Part to the End
C Program to Accept an Array & Swap Elements using Pointers
Search operation on an Array
C Program to Read an Array and Search for an Element
C Program to accept Sorted Array and do Search using Binary Search
C Program to Find the Biggest Number in an Array of Numbers using Recursion
Queue and Stack Implementation of an Array
C Program to Implement a Queue using an Array
C Program to Implement two Stacks using a Single Array & Check for Overflow & Underflow
Printing the elements of an Array
C Program to Generate Pascal Triangle 1 D Array
C Program to Implement two Stacks using a Single Array & Check for Overflow & Underflow
Operations on Individual elements of an Array
C Program to Generate Pascal Triangle 1 D Array
C Program to Print the Number of Odd & Even Numbers in an Array
C Program to Print all the Repeated Numbers with Frequency in an Array
Mathematical Functions and their applications on Arrays
C Program to Find the Number of Elements in an Array
C Program to Check Array bounds while Inputing Elements into the Array
C Program to Print the Alternate Elements in an Array
C Program to Find the Odd Element given an Array with only two Different Element
C Program to Increment every Element of the Array by one & Print Incremented Array
C Program to Find the Number of Non Repeated Elements in an Array
C Program to identify missing Numbers in a given Array
C Program to Segregate 0s on Left Side & 1s on right side of the Array
C Program to Find 2 Elements in the Array such that Difference between them is Largest
C Program to Input a String & Store their Ascii Values in an Integer Array & Print the Array
C Program to Input an Array, Store the Squares of these Elements in an Array & Print it
C Program to Find the two Elements such that their Sum is Closest to Zero
C Program to Find if a given Integer X appears more than N/2 times in a Sorted Array of N Integers
C Program to Find the Median of the Elements after Merging these 2 Sorted Arrays with Same Size
C Program to Find Union & Intersection of 2 Arrays
C Program to Find Ceiling & Floor of X given a Sorted Array & a value X
C Program to Find the Summation of Node values at Row or Level
Matrix C Programs:
Matrix Operations
C Program to Calculate the Addition or Subtraction & Trace of 2 Matrices
C Program to Find the Transpose of a given Matrix
C Program to Compute the Product of Two Matrices
C Program to Calculate the Sum & Difference of the Matrices
C Program to Perform Matrix Multiplication using Recursion
Matrix Types
C program to check whether two matrices are equal or not
C Program to Check if a given Matrix is an Identity Matrix
C Program to Determine if a given Matrix is a Sparse Matrix
Matrix Rows and Columns
C Program to Interchange any two Rows & Columns in the given Matrix
C Program to Sort Rows of the Matrix in Ascending & Columns in Descendng Order
Matrix Diagonals
C Program to Calculate the Sum of the Elements of each Row & Column
C Program to Find the Frequency of Odd & Even Numbers in the given Matrix
C Program to Accept a Matrix of Order MxN & Interchange the Diagonals
C Program to Find the Sum of each Row & each Column of a MxN Matrix
C Program to do the Sum of the Main & Opposite Diagonal Elements of a MxN Matrix
C Program to Find the Trace & Normal of a given Matrix
C program to find upper triangular matrix
C Program to Display Lower Triangular Matrix
Strings C Programs:
Palindrome
C Program to Check if a given String is Palindrome
C Program to Check if a String is a Palindrome without using the Built-in Function
C Program to Check whether a given String is Palindrome or not using Recursion
C Program To Print Smallest and Biggest possible Word which is Palindrome in a given String
C Program to Find the Largest & Smallest Word in a String
String Operations
C Program to read two Strings & Concatenate the Strings
C Program to Concatenate two Strings Lexically
C Program to Check if the Substring is present in the given String
C Program to Accepts two Strings & Compare them
C Program to Find the Length of a String without using the Built-in Function
Replace, Remove and Reverse Functions
C Program to Replace Lowercase Characters by Uppercase & Vice-Versa
C Program to Remove given Word from a String
C Program to Replace all the Characters by Lowercase
C Program to Reverse the String using Recursion
C Program to Reverse every Word of given String
C Program to Count the Number of Vowels & Consonants in a Sentence
C Program to Delete All Repeated Words in String
C Program to Reverse the String using Both Recursion and Iteration
C Program to Count Number of Words in a given Text or Sentence
Finding the Frequency of Occurrences of Characters in a String
C Program to Find the Frequency of the Word ‘the’ in a given Sentence
C Program to Read a String and find the Sum of all Digits in the String
C Program to Copy One String to Another using Recursion
C Program to find the First Capital Letter in a String using Recursion
C Program to find the First Capital Letter in a String without using Recursion
C Program to Find the Length of the String using Recursion
C Program to find Longer Repeating Sequence
C Program to Find the Frequency of Substring in the given String
C Program to Find the Frequency of Every Word in a given String
Displaying, Inserting and Printing the characters in a String
C Program to Find Highest Frequency Character in a String
C Program to Find the Length of the Longest Repeating Sequence in a String
C Program to find the possible subsets of the String
C Program to Check whether two Strings are Anagrams
C Program to Display every possible Combination of two Words or Strings from the input Strings without Repeated Combinations
C Program to List All Lines containing a given String
C Program to Print the Words Ending with Letter S
C Program to Insert Character/Word in any Desired Location in a String
Implementation of Functions and Algorithms
C Program to Implement Regular Expression Matching
C Program to Implement strpbrk() Function
C Program to Implement the KMP Pattern Searching Algorithm
C Program to Sort Word in String
C Program to Sort String Ignoring Whitespaces and Repeating Characters Only Once
C Program to Sort the String and Repeated Characters should be present only Once
C Program to Sort the String and Repeated Characters should be present only Once
Usage of Count Function and Search Method
C Program to Count the Number of Unique Words
C Program to Search a Word & Replace it with the Specified Word
C Program to Display the Characters in Prime Position a given String
C Program to Count Number of Words in a given Text or Sentence
C Program to Print Combination of two Words of two given Strings without any Repetition
C Program to Display Every Possible Combination of Two Words from the given 2 String without Displaying Repeated Combinations
Demonstrating the Occurrences in a given String
C Program to Accept 2 String & check whether all Characters in first String is Present in second String & Print
C Program to Count the Number of Occurrence of each Character Ignoring the Case of Alphabets & Display them
C Program to Count the Occurrences of each C Keyword using Array Structure
C Program to Find the First Occurence of the any Character of String2 in String1
C Program to find First and Last Occurrence of given Character in a String
C Program to Find the Most/Least Repeated Character in the String
C Program To Count the Occurence of a Substring in String
Demonstrating Simple Mathematical Operations on Strings
C Program to Determine if One String is a Circular Permutation of Another String
C Program to Find the Consecutive Occurrence of any Vowel in a String
C Program to Input 2 Binary Strings and Print their Binary Sum
C Program to Input a String with atleast one Number, Print the Square of all the Numbers in a String
C Program which Converts an Integer to String & vice-versa
C Program that Takes Input as 2323 and Gives Output as 2332 that means the new number should be greater than the previous number but should have the same digits
C Program to Find the Sum of ASCII values of All Characters in a given String
Bitwise C programs:
Mathematical Applications using Bitwise Operations
C Program to Check whether the given Integer has an Alternate Pattern
C Program to round Floor of integer to next Lower Power of 2
C Program that uses Function to return MSB position of unsigned Integer
C Program to use Bitwise Operations to Round(floor of) an Integer to next Lower Multiple of 2
C Program to Print the Range of Fundamental Data Types
Integer Bits
C Program to Check if All the Bits of a given Integer is One(1)
C Program to find Next higher Value of N with same 1’s
C Program to Count the Number of Trailing Zeroes in Integer
C Program to Use Bitwise Operations to Count the Number of Leading Zero’s in a Number x
C Program to find the Highest Bit Set for any given Integer
C Program to Count Number of bits set to 0 in an Integer
Swapping and Replacing Integers
C Program to Replace Bits in Integer from Specified Positions from Another Integer
C Program to Replace Bits in Integer x from Bit Position a to b from another Integer y
C Program takes Byte as Input and returns all the Bits between given Positions
C Program to Swap the ith and jth Bits for a 32-Bit Integer
C Program to Check if a given Integer is Power of 2 using Bitwise Operators
C Program to Swap two Integers without using Temporary Variables and Bitwise Operations
String Positions
C Program to Find the Position of String of 1-bits in a Number for a given Length
C Program to Check if nth Bit in a 32-bit Integer is Set or not
C Program to Check if a given Bit Position is set to One or not
Binary Addition and Reversal of Bits
C Program to Perform Binary Addition of Strings and Print it
C Program to Reverse all the Bits of an 32-bit Integer using Bitwise
Counting and Swapping the contents of strings using Bitwise Operations
C Program to Count the Number of Bits needed to be Flipped to Integer X to Generate Integer Y
C Program to Count the Number of Bits set to One using Bitwise Operations
C Program To Identify the Missing Number in an Integer Array of Size N-1 with Numbers[1,N]
C Program to Check whether the given Number is Palindrome or not using Bitwise Operator
C Program to Swap two Numbers using Bitwise Operators
Linked List C Programs:
Creating and Displaying the elements of a Linked List
C Program to Create a Linked List & Display the Elements in the List
C Program to Read a Linked List in Reverse
Search and Display Functions of a Linked List
C Program to Search for an Element in the Linked List using Recursion
C Program to Search for an Element in the Linked List without using Recursion
C Program to Display the Nodes of a Linked List in Reverse using Recursion
C Program to Display all the Nodes in a Linked List using Recursion
C Program to Display all the Nodes in a Linked List without using Recursion
C Program to Display the Nodes of a Linked List in Reverse without using Recursion
Implementation of Count, Length and Print Operations on a Linked List
C Program Count the Number of Occurrences of an Element in the Linked List using Recursion
C Program Count the Occurrences of an Element in the Linked List without using Recursion
C Program Find the Length of the Linked List using Recursion
C Program Find the Length of the Linked List without using Recursion
C Program to Print the Alternate Nodes in a Linked List using Recursion
C Program to Print the Alternate Nodes in a Linked List without using Recursion
Implementation of other Data Structures using Linked List
C Program to Implement a Stack using Linked List
C Program to Implement Queue Data Structure using Linked List
C Program to Implement a Doubly Linked List & provide Insertion, Deletion & Display Operations
C Program Find the Length of the Linked List without using Recursion
C Program to Print the Alternate Nodes in a Linked List using Recursion
C Program to Print the Alternate Nodes in a Linked List without using Recursion
Implementation of other Data Structures using Linked List
C Program to Implement Queue Data Structure using Linked List
C Program to Implement a Doubly Linked List & provide Insertion, Deletion & Display Operations
C Program to Implement Binary Tree using Linked List
C Program to Implement Circular Doubly Linked List
C Program to Illustrate the Operations of Singly Linked List
C Program to Implement Doubly Linked List using Singly Linked List
C Program to Demonstrate Circular Single Linked List
Dealing with the Operations on the elements of a Linked List
C Program to Add Corresponding Positioned Elements of 2 Linked Lists
C Program to Check whether 2 Lists are Same
C Program to Check whether a Singly Linked List is a Palindrome
C Program to Detect the Cycle in a Linked List
C Program to Find Number of Occurrences of All Elements in a Linked List
C Program to Find the first Common Element between the 2 given Linked Lists
C Program to Find the Largest Element in a Doubly Linked List
Print, Reverse and Read Operations
C Program to Print Middle Most Node of a Linked List
C Program to Read a Linked List in Reverse
C Program to Remove Duplicates from a Linked List
C Program to Reverse a Linked List
C Program to Reverse only First N Elements of a Linked List
Binary Tree Implementation using Linked List
C Program that takes an Ordered Binary tree & Rearranges the Internal Pointers to make a Circular Doubly Linked List out of the Tree Nodes
C Program to Construct a Balanced Binary Search Tree which has same data members as the given Doubly Linked List
C Program to Convert a Binary Tree into a Singly Linked List by Traversing Level by Level
C Program to Convert a given Singly Linked List to a Circular List
C Program to Find Intersection & Union of 2 Linked Lists
Interchange and Modify Operations
C Program to Interchange the two Adjacent Nodes given a circular Linked List
C Program to Interchange two Elements of the List without touching the Key Field
C Program to Modify the Linked List such that All Even Numbers appear before all the Odd Numbers in the Modified Linked List
C Program to Print Nth Node from the last of a Linked List
C Program to Solve Josephus Problem using Linked List
C Program to Support Infinite Precision Arithmetic & Store a Number as a List of Digits
Stacks and Queues C Programs:
Stack Implementation
C Program to Implement a Stack
C Program to Reverse a Stack using Recursion
C Program to Reverse a Stack without using Recursion
C Program to Implement two Stacks using a Single Array & Check for Overflow & Underflow
C Program to Implement a Stack using Linked List
Queue Implementation
C Program to Implement a Queue using an Array
C Program to Implement Queue Data Structure using Linked List
C Program to Implement Priority Queue to Add and Delete Elements
String Implementation
C Program to Check String is Palindrome using Stack
C Program to Check if Expression is correctly Parenthesized
C Program to Identify whether the String is Palindrome or not using Stack
Queue Implementation using Other Data Structures
C Program to Implement various Queue Functions using Dynamic Memory Allocation
C Program to Implement Queue Functions Using Arrays and Macros
C Program to Implement Queues using Stacks
Other Stack Implementations
C Program to Illustrate Stack Operations using MACROS
C Program to Implement Stack Operations using Dynamic Memory Allocation
Searching and Sorting C Programs:
Basic Sorting Algorithms
C Program to Sort N Numbers in Ascending Order using Bubble Sort
C Program to Sort the Array in an Ascending Order
C Program to Sort the N Names in an Alphabetical Order
C Program to Implement Selection Sort Recursively
C Program to Implement Selection Sort Method using Functions
C Program to Input Few Numbers & Perform Merge Sort on them using Recursion
C Program to Perform Quick Sort on a set of Entries from a File using Recursion
Searching Algorithms
C Program to Read an Array and Search for an Element
C Program to accept Sorted Array and do Search using Binary Search
C Program using Recursion to Search an Element in Array
C Program to Perform Binary Search using Recursion
C Program to Implement Linear Search
Special Sorting Algorithms
C Program to Implement Insertion Sort
C Program to Implement Postman Sort Algorithm
C Program to Sort an Integer Array using LSDRadix Sort Algorithm
C Program to Sort an Array based on Heap Sort Algorithm
C Program to Sort the Array Elements using Gnome Sort
Special Sorting Algorithms
C Program to Implement qsort using function pointers
C Program to Implement Pigeonhole Sort
C Program to Implement Cyclesort
C Program to Implement Oddeven Sort
C Program to Implement CockTail Sort
C Program to Implement Bitonic sort
C Program to Perform Comb Sort on Array of Integers
C Program to Implement Stooge Sort
Pancake Sort, Bogo Sort and Shell Sort
C Program to Implement Pancake Sort on Array of Integers
C Program to Implement BogoSort in an Integer Array
C Program to Perform Shell Sort without using Recursion
Trees C Programs:
Tree Traversals
C Program for Depth First Binary Tree Search using Recursion
C Program to Traverse the Tree Recursively
C Program to Search an Element in a Tree Recursively
C Program to Traverse the Tree Non-Recursively
C Program to Traverse the Tree Non-Recursively
C Program for Depth First Binary Tree Search without using Recursion
C Program to Find Nth Node in the Inorder Traversal of a Tree
C Program to Find the Largest value in a Tree using Inorder Traversal
C Program to Implement Depth First Search Traversal using Post Order
C Program to Find the Largest value in a Tree using Inorder Traversal
C Program to Create a Mirror Copy of a Tree and Display using BFS Traversal
C Program to Build Binary Tree if Inorder or Postorder Traversal as Input
Heap and Binary Tree Implementation
C Program to Implement Binary Tree using Linked List
C Program to Implement a Heap & provide Insertion & Deletion Operation
C Program to Construct a B Tree
C Program to Construct a Binary Search Tree and perform deletion and inorder traversal
C Program To Find the Smallest and Largest Elements in the Binary Search Tree
C Program to Find the Common Ancestor and Print the Path
C Program to Construct a Balanced Binary Tree using Sorted Array
Dealing with the Nodes of a Tree
C Program to Count Number of Leaf Nodes in a Tree
C Program to Find Nodes which are at Maximum Distance in Binary Tree
C Program to Find the Number of Nodes in a Binary Tree
C Program to Print Border of given Tree in Anticlockwise Direction
C Program to Print Height and Depth of given Binary Tree
C Program to Count Number of Non Leaf Nodes of a given Tree
Special Properties of Binary Trees
C Program to Check whether a Tree and its Mirror Image are same
C Program to Create a Mirror Copy of a Tree and Display using BFS Traversal
C Program to Find the Nearest Common Ancestor in the Given set of Nodes
C Program to Print all the Elements of Nth Level in Single Line
C Program to Convert Binary Tree to Binary Search Tree
C Program to find the Total Columns/Vertical Lines of a given Binary Search Tree
C Program to Find the Sum of all Nodes in a Tree
BFS and DFS Traversals
C Program to Construct a Tree & Perform Insertion, Deletion, Display
C Program to Check whether a Tree is a Binary Search Tree
C Program to Construct a Tree & Perform Insertion, Deletion, Display
C Program to Print all the Paths from the Root to the Leaf in a Tree
C Program to Print only Nodes in Left SubTree
C Program to Find 2 Nodes with Longest Distance and Display using Inorder Traversal
C Program to Display the Nodes of a Tree using BFS Traversal
Inorder Traversal of a Binary Tree
C Program to Search for a Particular Value in a Binary Tree
C Program to Find the Sum of All Nodes in a Binary Tree
C Program to Construct a Binary Search Tree and perform deletion and inorder traversal
C Program to Count Number of Leaf Nodes in a Tree
C Program to Find Nodes which are at Maximum Distance in Binary Tree
File Handling C Programs:
File Creations:
C Program to Create a File & Store Information
C Program to Illustrate Reading of Data from a File
File Content Deletion
C Program Delete a specific Line from a Text File
C Program to Replace a specified Line in a Text File
C Program to Find the Number of Lines in a Text File
Appending and Merging the Contents of Files
C Program to Append the Content of File at the end of Another
C Program that Merges Lines Alternatively from 2 Files & Print Result
C Program to List Files in Directory
C Program to Find Sum of Numbers given in Command Line Arguments Recursively
C program to Display the Function Names defined in C Source File
C Program to Find the Size of File using File Handling Function
Create, Copy, Comparison and Printing the Contents of the File
C Program to Capitalize First Letter of every Word in a File
C Program to Print Environment Variables
C Program to Copy File into Another File
C Program to Create Employee Record and Update it
C Program to Compare two Binary Files, Printing the First Byte Position where they Differ
Convert, Replace, Count and Reverse Operations on the Contents of a File
C Program to Convert the Content of File to UpperCase
C Program to Replace First Letter of every Word with Capital Letter
C Program to Count No of Lines, Blank Lines, Comments in a given Program
C Program to Reverse the Contents of a File and Print it
C Program to Convert the Content of File to LowerCase
Creation and Updating Operations on the Contents of the File
C Program to Update Details of Employee using Files
C Program to Create Employee File Name Record that is taken from the Command-Line Argument
C Program to Join Lines of Two given Files and Store them in a New file
C Program to Collect Statistics of a Source File like Total Lines, Total no. of Blank Lines, Total no. of Lines ending with Semicolon
Mathematical Functions C Programs:
Mathematical Calculations
C Program to Calculate the Simple Interest
C Program to Find out the Roots of a Quadratic Equation
C Program to Simulate a Simple Calculator
Fibonacci Numbers
C Program to Generate Fibonacci Series
C Program to Find the Nth Fibonacci Number using Recursion
C Program to Find First N Fibonacci Numbers
GCD and LCM of Numbers
C Program to Find the GCD and LCM of Two Integers
C Program to find HCF of a given Number using Recursion
C Program to Find LCM of a Number using Recursion
C Program to Find GCD of given Numbers using Recursion
C Program to find HCF of a given Number without using Recursion
C Program to Calculate the Value of sin(x)
C Program to Calculate the Value of cos(x)
C Program to Calculate the Sum of cos(x) Series
Statistical Properties
C Program to Find the Sum of First N Natural Numbers
C Program to Check if a given Number is Prime number
C Program to Find Prime Numbers in a given Range
C Program to Calculate the Mean, Variance & Standard Deviation
C Program to Evaluate the given Polynomial Equation
C Program to Read a Coordinate Point in a XY Coordinate System and Determine its Quadrant
Power and Factorial of a Number
C Program to find Power of a Number using Recursion
C Program to Find the Factorial of a Number using Recursion
C Program to Compute the Value of X ^ N
C Program to Print the Factorial of a given Number
C program to Calculate the value of nCr
C Program to Find & Display Multiplication table
Summation of a Series
C Program to find the sum of series 1^2 + 2^2 + …. + n^2.
C Program to find the Sum of Series 1 + 1/2 + 1/3 + 1/4 + … + 1/N
C Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + ……1/N!
C Program to Find the Sum of A.P Series
C Program to Find the Sum of G.P Series
C Program to Find the Sum of H.P Series
Area of Geometrical Figures
C Program to Calculate the Area of a Triangle
C Program to Calculate the Area of a Circle
C Program to Find Area of a Right Angled Triangle
C Program to Find Area of Trapezium
C Program to Find Area of Rhombus
C Program to Find Area of Parallelogram
Finding the Volume and Surface Area of Geometrical Figures
C Program to Compute the Surface Area & Volume of a Cube
C Program to Find the Areas of Different Geometrical Figures
C Program to Find the Volume and Surface Area of cylinder
C Program to Find the Volume and Surface Area of Cuboids
C Program to Find the volume and surface area of cone
C Program to Find Volume and Surface Area of Sphere
C Program to Find the Perimeter of a Circle, Rectangle and Triangle
Floyd and Pascal’s Triangle
C Program to Display Floyd’s triangle
C Program to Display Pascal triangle
C program to Calculate the Value of nPr
C Program to Solve Tower-of-Hanoi Problem using Recursion
C Program to Solve the Magic Squares Puzzle without using Recursion
More Languages Programs: