C Programming Practice Questions
Note : Practice all programs from notes
Module 1 INTRODUCTIONTO ALGORITHM AND FLOWCHART
Q Write an algorithm to find sum of two numbers.
Q Differentiate between Low-Level language and High-Level language
Q Define the flowchart .Draw the flowchart “to find the given number is even or odd.”
Q Write an algorithm and draw flowchart to find factorial of a number.
Q Write an algorithm "To calculate the perimeter and area of rectangle. Given its length and width."
Q What is a flowchart? List any four symbols used in a flowchart
Q Write an algorithm “to calculate the simple interest using the formula. Simple interest = P*N* R/100.”
Q Explain with the help of flowchart how “to find the average of three numbers”.
Q Describe an algorithm “To calculate the perimeter and area of rectangle. Given its length and width. ”
Q What is pseudo code ?Give pseudo code for given program statement.
Q Write an algorithm and draw the flowchart
a. Check whether the entered number is positive or negative number.
b. To reverse a number
Module 2 FUNDAMENTALS OF C-PROGRAMMING
Q Write a C program to find the largest of three numbers using the ternary operator
Q Write a program to calculate the average of 3 numbers.
Q Write a C program to check if a given number is even or odd using the modulus operator .
Q Write a C program to take a string input using gets() and display it using puts()
Q What are Bitwise Operators in C? List all Bitwise Operators.
Q Write a program to find if a number is even or odd using ternary operator.
Q Write a program to find minimum number among two numbers using ternary operator
Q Discuss the fundamental and derived data types of the C language with examples.
Q Give output of following program (with use of different operators )
Q WAP to accept basic salary from the keyboard. Calculate the gross salary that includes basic salary, 50% DA and 40%
HRA.
Module 3 CONTROL STRUCTURES
Q What is the purpose of a switch statement? How does it differ from if-else?
Q WAP to check whether the number entered is divisible by 10 or not.
Q WAP to find number of days in a month using switch case. Explain the need of break keyword in switch case
Q Write a C program to print numbers from 1 to 10 using a for loop.
Q Write a C program to calculate the grade of a student based on marks using an if-else ladder.
Q Write a program to print Floyd’s Triangle
Q WAP to Compute i) square root of number, ii) Square of number, iii) cube of number, iv) factorial of number v) prime
factors of given number using switch statement
Q WAP to check whether the entered number is palindrome or not.
Q Compare while loop with Do while loop.
Q Write a program to check if the number entered by the user is Armstrong or not.
Q Write a program to find sum of 1 to 10 numbers using Do while loop.
Q WAP to print the following pattern.( * patterens)
Q Write a menu driven program using switch case to perform all arithmetic
operations(Add,Subtract,Multiply,Divide,Modulus) based on user choice.
Q Write a program to find sum and average of 1 to 10 numbers using For loop
Q Write a program to print week day name using switch case.
Q Write a program to input an alphabet and check whether it is vowel or consonant using switch case.
Q Write a program to display table of any number entered by user using do while loop
Q Explain continue,break and goto control structures with suitable examples.
Q WAP to calculate sum of given series x + x2 + x3 +............+ xm
Q Write a program to display following pattern
12345
1234
123
12
Q WAP to accept a number from user and display the following results
a)Number of digits b)sum of digits c)product of digits
Module 4 ARRAYS, STRING, STRUCTURE AND UNION
Q Define structure and union. Write the differences.
Q Write a C program to input and display a 2D array of size 3x3.
Q What are built-in functions in string.h? Explain any 4 with example.
Q Write a program to define a structure Student with name, roll number and marks. Accept details for 5 students and display
them.
Q Explain the following string functions with examples :
a) strcpy() b) strlen() c) strcmp() d) strcat() e) puts() f) getch().
Q Discuss the concept of an Array with examples.
Q WAP to count the number of even numbers in the array
Q WAP to display five elements of an array .
Q WAP to display addition of two matrices of size mxn
Q WAP to find transpose of a given matrix of size mxn .Also use transpose function to perform the same.
Q Write a program to search an element in an array
Q Write a C program to reverse a string with and without using built-in functions.
Q WAP to accept EMPLOYEE details (Name, Designation, Gender, DOJ and Salary). Define function members to compute
i) total number of employees in an organization ii) Employee with salary more than 20,000
Q Write a C program that takes a string as input and performs the following using built-in functions:
1 Find the length of the string. 2. Convert the string to uppercase.
3.Concatenate another string to it. 4. Copy the string to another variable.
Q WAP to accept two strings, compare them and display if they are equal or not. If they are not
equal display the one which is greater.
Q Write a program to define a structure Hockey with player name, name of country,no of matches played,no of goals
achieved. Accept details for 5 players and display them.
Module 5 FUNCTIONS AND PARAMETER
Q What are storage classes in C? Explain different types.
Q Write a recursive function to print the Fibonacci series up to N terms.
Q Write a program to find the sum of two numbers using a function.
Q Write a program to swap two numbers using call by value and call by reference.
Q WAP to calculate Factorial of Number Using Recursion.
Q WAP to check a number is prime or not using function.
Q Give Difference between call by value and call by reference.
Q What are benifits of using functions in C language .Explain predefined and user defined functions with examples.
Module 6 POINTER
Q Write a C program to demonstrate pointer arithmetic.
Q What is a pointer in C? How is it useful? Give pointer declaration with example.
Q Explain dynamic memory allocation functions (malloc ,calloc ,free )in C with examples.
Q Explain concept of pointer /pointer variable in C in detail.
Q Give the output of following program that has used pointers.
Example
#include<stdio.h>
int main()
int a,*p,**p1;
a=250;
p=&a;
p1=&p;
printf(“%d\n”,a);
printf(“%d\n”,p);
printf(“%d\n”,p1);
printf(“%d\n”,*p);
printf(“%d\n”,*p1);
return 0;
Q What is an array of pointers? Give an example where an array of pointers is useful in C programming.