You are on page 1of 2

OCS752 – INTRODUCTION TO C PROGRAMMING

Question Bank IV
Part A

1. What are preprocessor directives in C? Give an example.


2. Write a “for” loop to print from 10 to 1 in C.
3. Write a C program to find factorial of a given number using Iteration.
4. What is the difference between “a” and ‘a’?
5. What is the difference between while loop and do…while loop?
6. What is the difference between ++a and a++?
7. Why do we include <stdio.h> in our programs?
8. What are arrays and why are they needed?
9. Write an example code to declare a two dimensional array.
10. Given an array int marks[] = {99,67,78,56,88,90,34,85}, calculate the address of array
element with value ‘88’, if the base address = 1000.
11. Differentiate insertion sort and bubble sort methods that are used with arrays.
12. What are the various search concepts used in arrays?
13. Define String with an example.
14. How to declare a pointer variable?
15. How to initialize a pointer variable?
16. What is the difference between a string and character array?
17. What is the output of the following code?

18. How to initialize a string?


19. Write a code segment to read and display the second character of a string.
20. How to read the data from a file? Give the syntax of the respective function.
Part B

1. Write a menu-driven C program to find the area of different shapes.


2. Write a C program to perform various operations of an ATM.
3. Write a C program with for loop to find the sum of odd and even numbers from a given
set of integer inputs.
4. Write a C program with for loop to get ten numbers as input and to find the biggest of
them.
5. Write a C program with for loop to get ten numbers as input and to find the smallest of
them.
6. Write a C program to print the Fibonacci series of a given number.
7. Write a program with for loop to get ten numbers as input and to print them in the screen
in ascending order.
8. Write a program with for loop to get ten numbers as input and to print them in the screen
in descending order.
9. Write a C program using arrays to fill the diagonal elements of a matrix with 0, lower
triangle with -1 and upper triangle with 1.
10. Write a C program to insert an element in an array.
11. Write a C program to sort the elements in a given array using Bubble sort concept.
12. Write a C program to sort the elements in a given array using selection sort concept.
13. Write a C program to sort the elements in a given array using insertion sort concept.
14. Write a C program to change a two dimensional array into corresponding one
dimensional array.
15. Write a C program to search an element in a given array using binary search method.
16. Write a C program to search an element in a given array using sequential search method.
17. With an example program, explain the array of pointers to strings.
18. Write a C program to sort a given set of the strings alphabetically.
19. Write a program to insert a number in an array that is already sorted in ascending order.
20. Write a program to delete a number in an array that is already sorted in ascending order.
21. Write a program to sort an array in descending order and insert a number in a suitable
position.
22. Write a program to sort an array in descending order and delete a number in a suitable
position.

You might also like