Skip to content
Basic Concepts
- Syntax and Structure
- What are the key components of a C program?
- Explain the difference between
#include<stdio.h>
and #include<math.h>
.
- Why is the
main()
function important in a C program?
- Data Types and Variables
- What is the difference between a variable and a constant in C?
- Name and explain different data types in C.
- How do you declare a pointer? Give an example.
- Operators
- Explain the difference between
=
and ==
.
- What is the difference between pre-increment (
++i
) and post-increment (i++
)?
Control Statements
- Conditional Statements
- Write a C program to find the largest of three numbers using
if-else
.
- How is a
switch
statement different from an if-else
statement?
- Loops
- Write a program to print the first 10 Fibonacci numbers using a
for
loop.
- Explain the difference between a
while
loop and a do-while
loop.
Functions
- Basics of Functions
- What is the difference between a function declaration and a function definition?
- Write a function to calculate the factorial of a number.
- Passing Parameters
- What is the difference between passing parameters by value and by reference in C?
Arrays and Strings
- Arrays
- Write a program to find the sum of all elements in an array.
- Explain the difference between a one-dimensional and a two-dimensional array.
- Strings
- Write a program to check if a given string is a palindrome.
- How are strings represented in C?
Pointers
- Basics of Pointers
- What is a NULL pointer?
- Write a program to swap two numbers using pointers.
- Pointer and Array Relationship
- Explain how pointers and arrays are related. Provide an example.
Structures and File Handling
- Structures
- What is the purpose of using structures in C?
- Write a program to create a structure for a student containing fields for name, roll number, and marks, and display the details.
- File Handling
- What is the difference between
fopen
and fclose
?
- Write a program to read data from a file and display it on the console.
Advanced Topics
- Dynamic Memory Allocation
- Explain the difference between
malloc
and calloc
.
- Write a program to allocate memory dynamically for an array of integers.
- Recursion
- What is recursion? Write a program to calculate the GCD of two numbers using recursion.
- Command-Line Arguments
- What are command-line arguments in C? Write a simple program to demonstrate their usage.