10210CS101- PROBLEM SOLVING USING C
QUESTION BANK
UNIT –I
PART A
1. List the basic operations of computer.
2. Discuss characteristics of computer.
3. Write two characteristics of Pseudo code.
4. Define flowchart.
5. Define an algorithm.
6. Compare and contrast algorithm and flowchart.
7. List the advantages of flowchart.
8. Define Pseudocode.
9. Give the classification of computers.
10. Define Computer.
11. List the steps involved in problem solving process.
12. Define an algorithm. Mention its uses in the context of software
development.
13. List the limitation of flowchart.
14. List out the Qualities of good algorithm.
15. List the rules for writing pseudo code.
16. Write any four escape sequences in ‘C’.
17. Convert the (756)10 to Octal and Hexadecimal.
18. What are the steps involved in program development life cycle?
PART B
1. Explain the basic computer organization with the neat diagram
2. Draw a flowchart to calculate simple interest.
3. Draw a flowchart and write an algorithm to find the Fibonacci series.
4. Explain the phases in Problem Solving aspects.
5. Draw a flowchart to determine whether a given integer is prime number or
not.
6. Draw the flow chart and write an algorithm to compute area and
circumference of circle.
7. What are basic symbols and additional symbols used in flow chart and
give the rules for drawing flow chart.
8. Draw a flowchart to find the maximum among the three numbers.
9. Write an algorithm to find whether a number is even or odd.
10. Draw the flowchart to find the area of a rectangle
11. Write an algorithm to find whether the given no is positive or not
12. Plan a Algorithm and Construct a Flow Chart to calculate 1+2+3+……n
13. Sketch a Flow chart and propose a pseudo code to find whether the given
year is leap year or not.
14. Describe various generations of computers.
15. Write an algorithm to check whether the given number is Armstrong or
not.
16. Write pseudo code to find the roots of a given quadratic equation.
17. Discuss about the applications of computers.
18. Write an algorithm to check whether a given string is palindrome or not.
19. Draw a flow chart to find sum first 100 natural numbers.
20. What is mean by problem solving? What are the methods to solve the
problem? Explain.
21. Draw the flow chart and write an algorithm to compute the student details.
22. Explain in detail, the sequence of steps to be followed in writing an
algorithm for finding the sum of first ‘N’ natural numbers. Hint: Sum of
First ‘N’ natural numbers = N(N+1) / 2.
23. Draw a flowchart to find the highest marks in a set of n marks.
24. What do you mean by pseudo code? Write the pseudo code to add up all
the even numbers between 0 and 100 and print the result.
25. Write the algorithm and C program to print the prime numbers less than
500.
26. Write an algorithm for finding sum and average of n numbers. Also
state the properties of a good algorithm.
27. Draw flowchart to compute the salary of an employee in a company.
Assume that there are two types of employees in the company daily wages
and regular. Salary is calculated as number of hours worked* wages per
hour for daily wagers and basic pay + (% of DA * basic pay)/100 + HRA
+ medical allowance for regular employees. Sketch the flow of your
design for a regular employee with basic pay = 5000, % of DA = 75 % and
HRA = 500.
28. Write a C program to sort the elements of an n x n matrix and to display
the elements in the following pattern:
543
612
789
UNIT –II
PART A
1. Define keyword and token.
2. Define typecasting.
3. Define Extern storage class
4. List different data types available in c.
5. Define storage class with an example.
6. List out the various types of operators.
7. List various looping statements with an example.
8. Distinguish between while and do while loop.
9. List out the various decision making statements available in c.
10. List out the applications of C.
11. Write any four escape sequences in ‘C’.
12. Define Operator and its types.
13. Define Expression.
14. Differentiate switch and goto statements with an example.
15. Write down the structure of a C program.
16. Define identifier.
17. List down reserved words in C.
18. Write down ternary operator with an example.
19. Write a for loop statement to print numbers from 10 to 1.
20. Mention the use of ‘Sizeof’ operator.
21. Differentiate between goto, break and continue statements.
22. Mention the purpose of declaration statement.
23. Differentiate between local variable and global variable.
24. List delimiter and its uses.
25. Explain post and pre increment/decrement operators with examples.
26. Define an Operator and Operand.
27. Differentiate Logical AND and Bitwise AND.
28. Mention bytes are occupied by the int, char, float, long int and double.
29. Write a C program for the following expressions.
(i) a=5 <= 8 && 6!=5
(ii) a = b++ + ++b where b = 50
30. Write a C program for the following expression
a = 5 <= 8&&6 ! = 5.
31. Differentiate between signed and unsigned integer.
32. What will be the outputs for the following program, when the value of i is
5and 10?
void main()
{ inti;
scanf ("%d" , &i) ;
if (i = 5)
printf("Five") ;
}
33. Draw the flowchart for computing Fahrenheit to celcius.
34. what is output of following program?
int m=1,n=2;
for(j=1;j<=2:j=j+1)
{
m=m+1;
n=n*j;
printf(“%d \t %d\t” ,m,n);
}
PART B
1. Write a C program to print the Fibonacci series of a given number
2. Write the C program to find the biggest among three numbers using
multiple if-else statements.
3. Write about the need of branching statements and discuss with examples.
4. Write a program to check whether a given number is prime or not.
5. Write a C program to find sum of digits of an integer.
6. Explain in detail about the different types of operators and its precedence.
Illustrate with an example.
7. Explain the different types of storage classes in C with examples.
8. Discuss about the Input and Output statements in C.
9. Write a program to find sum and averages of given n numbers.
10. Write a C program to find sum of digits of an integer.
11. Write a program to reverse a 3 digit number.
12. Write short note on formatted and unformatted Input & Output functions
used in C.
13. Write a program to swap two values of a variable using temporary
variable.
14. Write a code segment using while statement to print numbers from 10
down to 1.
15. Define looping and explain the difference between while and do-while
loop with appropriate examples.
16. Write a C program to evaluate the following series.
17. Write the C program to perform the following expression S=1+1/2+1/3+
………+1/n.
18. Write the C program to print the following
*
* *
* * *
19. Develop a C program to find the factorial of a number with and without
recursion.
20. Write a C program to evaluate the following series.
sin(x) = x – x3/3! + x5/5! –x7/7!+….+xn/n!
21. Write a C Program to print square of all numbers 1 to 20 and print sum
squares
22. Write a C program to find vowels in the given string “veltech university”.
23. Write a C program to compute the following function: S = (x2 +x4 +...+
x2n)=n. Trace the program for the values x = 2 and n = 5
24. Write a C program to count the letters in a sequence of characters.
25. Discuss about an algorithm , flowchart and pseudo code and elaborate
their role while writing a program, write an algorithm, draw a flowchart
and write pseudo code for problem of generating the triangular number
sequence 1,3,6,10,15,21,28,36,45….[ Given value of the nth term
=n*(n+1)/2].
26. Write a C Program to compute 1+2+3+…..+20.
UNIT-III
PART A
1. Define an array and its types.
2. List function prototypes with an example.
3. Define function.
4. List string handling functions with an example.
5. Define String.
6. Define Call by value and Call by reference.
7. What is the value of b[0] in the following program?
main()
{
int a[5]={1,3,6,7,0};
int *b;
b=&a[2];
}
8. Differentiate library functions and User-defined functions.
9. List out the various dynamic allocation memory functions.
10. Difference between array and structures.
11. Define recursion.
12. Compare actual and formal parameters.
13. Difference between call by value and call by reference.
14. Define function call.
15. Mention the various String Manipulation Functions in C.
16. How will you find the length of a string and how will you compare two
strings.
17. Define an array and how array variable differs from ordinary variable.
PART B
1. Write the c program to print the sum of two matrices.
2. Write the C program to perform 2*2 matrix multiplication using array.
3. Write the C program to find the length of given string using string
function.
4. Write the C program to exchange the values of two variables using
function.
5. Write a c program to search an element in an given array
6. Write a C program to find the smallest and largest number from the given
10 numbers using functions.
7. What is recursion? Explain a recursive function with suitable example.
8. Write a c program to find the factorial of the given number using
functions.
9. Write a c program to search an element in an given array
10. Explain various string handling functions with an example program.
11. Write a c program to reverse a string.
12. Write the C program to find the factorial of the number using recursion.
13. Write a C program to calculate average of N numbers using array.
14. What is difference between call by value and call by reference? Write a C
program to swap values of two variables.
15. Write the C program to generate Fibonacci series.
16. Write a C program to sort the given set of numbers in ascending order in
an array.
17. What is a recursion? Write a C program for finding the sum of N natural
numbers using recursion.
18. Using functions write a program to (i) to read (ii) write (iii) add (iv)
multiply two given matrices.
19. Design and develop a program for generating Pascal’s Triangle using
recursive function for evaluating factorial. Implement it.
20. Write a C program using pointers to concatenate two strings.
21. Write a C program to read m x n matrix and to check whether the element
of last column of each row is the sum of the elements of the other columns
in that row.
UNIT –IV
PART A
1. Define pointer.
2. Define null and generic pointer.
3. Define structure and union.
4. Differentiate structure and union.
5. Write the dissimilarities between structure and array.
6. Differentiate structure and array.
7. List the use of typedef keyword in C.
8. State any two library functions for string handling and their purpose.
9. What are the advantages of unions over structures?
10. Determine the output for the following printf statements
11. Consider the declaration:
struct
{
char name;
intnum;
}
student;
Illustrate the application of size of operator to this structure.
PART B
1. Write the C program to swap two numbers using pointer.
2. What are structures in C.? How are they different from unions? Give an
example for structure.
3. Write a C program to read and display the information of all the students
in class using structures.
4. Write a program to create a student data record and given a student id
retrieve the student information.
5. Define union and explain with an example of generating student record.
6. Write a C program for performing matrix multiplication using pointers.
7. Write a c program to create mark sheet for students using structure.
8. Define union and explain with an example of generating student record.
9. Write the C program for order billing in a restaurant using an array of
structures.
10. Write a C program that gets and display the details of books with the
author, page number and price details using array of structures.
11. Create a structure of employees having the following information:
Employee id
Employee name
Date of joining
Salary
Write a C program to input information of 20 employees and display the
details of the specified employee given the employee id.
12. Write a C program that gets and displays the report of a student with their
personal and academic details using array of structures.
13. Write a C program to accept records. of 20 states using array of structures.
The structure should contain name of the state and number of engineering
colleges, medical colleges, management colleges, science colleges.
Calculate and display the total colleges in each state and the state which is
having the highest number of colleges.
14. Define a structure called student that would contain name, reg-no
and marks of five subjects and percentage. Write a program to read the
details of name, reg-no and marks of five subjects for 30 students,
calculate the percentage and display the name, reg-no, marks of 30
subjects and percentage of each student.
UNIT-V
PART A
1. Differentiate malloc , calloc and realloc.
2. Define Macros.
3. List input and output statements in C.
4. Write down preprocessor directives in C.
5. Define pre-processor.
6. Mention the operations on files.
7. Write down the need of fseek().
8. Define binary file.
9. Define nested macros.
10. Discuss, how a file can be opened in different modes.
11. List different types of Files in C
12. Write the syntax for opening and closing a file.
13. Write the syntax for fread() and fwrite().
14. Differentiate getc() and gets().
15. Distinguish between fprintf() and printf()
16. Explain putc and getc in brief
17. Explain the following i)rewind ii)feof
18. Distinguish between 1)fprintf() ii)fscanf()
PART B
1. Write a program to create a student data record and given a student id
retrieve the student information.
2. Write a C program to read and print text file.
3. Explain conditional inclusion with example.
4. Write the C program to count the vowels which are present in the file.
5. Describe the various functions to read data from files and write data to
files.
6. Explain in detail about pre-processor directives.
7. Write the C program to copy the contents of one file to another.
8. Write a C program to read the records stored in ‘employee.txt’ file in
binary mode.
9. Write a C program to read s line of mixed text and to display after
converting all upper case to lower case, all digits to 0 and all other special
characters to*.