You are on page 1of 6

Chapter - 1

C Preprocessor, Conditional Compilation Directives and Bitwise Operators

1. What is preprocessor? Explain its working.


2. What is preprocessor? Compare it with compiler.
3. Explain the stages of compilation of a C compiler.
4. Explain the meaning of following preprocessor directives and also give an example to demonstrate
use of - #define, #undef, #if, #ifdef, #ifndef, #elif, #else, #pragma, #error
5. What are symbolic constants? Write a program to demonstrate use of symbolic constant.
6. What are macros? Write a program to demonstrate working of macro.
7. How to define parameterized macros? Write a program to demonstrate.
8. How does a parameterized macro execute? Explain with a suitable example program.
9. Compare macros with functions.
10. Write a program to check whether a symbolic constant FLAG is defined or not, if the constant is
not defined then define it and assign value 0 to it. Use #ifndef directive.
11. Write a program to demonstrate use of #if directive.
12. What is conditional compilation? Explain.
13. Explain use of preprocessor directives in file inclusion.
14. Write a program to display file name, line no. and date and time of creation of a c program using
predefined preprocessor names.
15. Explain the use of following bitwise operators with suitable example – bitwise AND, bitwise OR,
bitwise XOR, bitwise NOT, Left shift, Right shift.
16. Write a program to demonstrate use of bitwise AND operator.
17. Write a program to demonstrate use of bitwise OR operator.
18. Write a program to find area of rectangle using MACRO.
19. Write a program for swapping of two numbers using XOR operator.
20. Write a program to count the number of trailing zeros in an integer using AND and Right Shift
operators.
21. Explain the use of #pragma warning with example.

Chapter - 2
Storage classes of variables, Functions

1. Write a program to calculate sum of digits in a given number using function with argument as well as
return value.
2. Write a program to check whether the given number is even or odd using function.
3. Explain recursive function with suitable example.
4. Define the term:
a. Function prototype
b. Function call
c. Function definition
d. Actual parameter
e. Formal parameter
f. Function Recursion
5. Explain call by value method of parameter transmission with example.
6. Explain call by reference method of parameter transmission.
7. What is function? Explain different types of function.
8. What is library function? Illustrate with example.
9. What is user defined function? Illustrate with example.
10. Explain following storage classes of variables.
i. Static
ii. Register
11. Explain following storage classes of variables.
i. Extern
ii. Auto
12. Write a program to find factorial of a given number using function with argument and no return value.

13. Write a program to swap two numbers using function call by reference.

14. Write a recursive function to find factorial of a given number.


15. Write a program to calculate sum of prime numbers from 1 to 50 using function without argument but
with a return value.
16. Write a program to swap two strings using function with arguments but without return value.
17. Differentiate between Call by value and Call by reference.
18. Explain the elements of user-defined function. (i.e. 1.Function declaration 2.Function call 3.Function
definition )
19. Write a program to demonstrate the use of passing strings as an argument to a function.
20. Write a program to find even and odd numbers in an array by passing array of integer to a function.

21. Comparison of iteration and recursion

Chapter - 3
Pointers, Dynamic memory allocation in ‘C’, Pointer to function
1. What is pointer? Illustrate the use of pointer variable by giving suitable example.
2. Describe pointer arithmetic with example.
3. Explain pointer to array with suitable example program.
4. Explain how the strings are accessed using pointer.
5. Write a program to demonstrate function call by reference.
6. Elaborate pointer to pointer. Write a program to describe pointer to pointer.
7. Explain different memory allocation schemes available in ‘C’
8. What is dynamic memory allocation? Explain need and advantages of dynamic memory allocation

9. Give difference between static and dynamic memory allocation. Explain with example.
10. Give dfference between malloc() and calloc() function
11. What is dynamic memory? Explain following with syntax and example.
a. malloc()
b. calloc()
c. realloc()
d. free()
12. Write a C program to swap three numbers in a cyclic order using function with call by reference.

13. Explain Array of pointers with suitable example program.


14. Write a program to accept an array of 10 elements and find a particular element in it.
15. What is pointer to function ? Give declaration and calling of pointer to function. Write a program
to demonstrate pointer to a function?
16. How to call a function through function pointer?
17. Write a C program to pass the address of a function as an argument to other function.
18. Write a program to check whether the given string is palindrome or not using pointer to strings.
19. Write a program to demonstrate the use of malloc().

Chapter - 4
Structure and Union
1. Define Structure with example. Give application of structure.
2. Define structure. Describe memory representation of structure with diagram.
3. Define union. Describe memory representation of union with diagram.
4. Explain declaration and initialization of structure with example.
5. Describe with example - how structure members are initialized and accessed.
6. How structure is passed to function Explain with example.
7. Explain pointer to structure with an example.
8. Define union and explain with an example how it is stored inside memory.
9. Differentiate between union and structure.
10. Describe use of typedef with suitable example.
11. Write a program to demonstrate nesting of structures.
12. Write a program to demonstrate passing structure to function.
13. Write a program to pass and return structure to function.
14. Write a program to demonstrate pointer to structure.
15. What is union of structure ? Demonstrate with example
16. Write a program to demonstrate array of structure.
17. Write a program to accept and print the student details (id, name, age, per). Create record for 10
students.
18. Explain declaration and initialization of structure with example.
19. What is enumerated data type ? How to define it in C.
20. Explain storage allocation & size of structure with example.
21. Write a program how structure variable is returned from function ?

Chapter - 5
Files and command line Arguments

1. What is a data file? Describe the types of data files.


2. What happens when a data file is opened? Is it is it necessary to close an opened data file? Why ?
3. Explain the meaning of following terms – i) ASCII text file, ii) Binary files iii) File buffer iv) File
pointer.
4. How to open and close a data file in C program? Demonstrate by writing a program.
5. Give syntax of fopen() and also explain the various modes in which a file can be opened using
fopen().
6. Explain the use of following file opening modes and also explain conditions if file exists and does
not exist, for each mode – i) r ii) w iii)a iv) “r+” v) “w+” vi) “a+” vii) “rb” viii) “wb” ix) “ab” x)
“rb+” xii) “wb+” xii) “ab+”
7. Explain the use of following functions with syntax –
fopen(), fclose (), fread() , fwrite(),fprintf() , fscanf() , feof() , fflush(),fgetpos(), fgets(), fputc(),
fseek(), ftell(), rewind(), rename() , remove()
8. Write a program to accept file name from user and display the contents of the file on screen.
9. Write a program to accept source and destination file names from user and copy contents of source
file into destination file.
10. Write a program to store ‘n’ numbers in a file and then by reading the numbers from file, calculate
and display their sum and average. Accept value of ‘n’ from user.
11. Write a program to accept a text file name and count the number of spaces in the file.
12. Write a program to accept a text file name and count the number of vowels in the file.
13. Write a program to accept a text file name and count the number of lines in the file.
14. Write a program to accept a file name from user and display its size in bytes.
15. Write a program to accept roll number and name of five students and store them in a file. Display
the records by reading them from the file.
16. Write a program to accept roll number and percentage of 10 students and store them in a file. By
reading the data from file display the roll number of student having highest percentage.
17. Write a program to accept 10 names from user and store them in a file. Display the names by
reading them from the file.
18. Write a program to accept 10 numbers in an array and write the complete array into a file. Display
the numbers by reading all the numbers from file in another array.
19. What are command line arguments? How to pass command line arguments? Explain with suitable
example program.
20. Write a program to accept a number as command line argument and display it’s factorial.
21. Write a program to accept a text file name and count number of numerical characters in a file.

Chapter - 6

Graphics Programming, Text mode And Graphics mode

1. Explain the meaning of following terms – Raster scan, Cathode Ray Tube, Interlaced raster scan,
Pixel, Resolution.
2. What is scanning? Explain Interlaced raster scan.
3. What is video card? Give the types of video cards with their text mode and graphics mode
resolutions.
4. How to initialize graphics mode? Explain with suitable example program.
5. Explain the use of following functions with their syntax with meaning of each parameter (if any). –
i) initgraph() ii) closegraph() iii) cleardevice() iv) line() v) lineto() vi) arc() vii) pieslice() viii) circle
ix) circle() x) ellipse() xi) drawpoly() xii) fillpoly() xiii) getmaxx() xiv) getmaxy() xv) setbkcolor()
xvi) setcolor() xvii) setfillstyle()
xviii) floodfill() xix) outtext() xx) outtextxy() xxi) bar() xxii) bar3d(), xxiii)Settextstyle()
6. How to draw a polygon? Explain with example program.
7. Give the library functions required to carry out following operations, along with their syntax. Also
give meaning of the parameters (if any).
1. To switch from text mode to graphics mode
2. To switch from graphics mode to text mode
3. To draw a polygon.
4. To draw and fill a polygon.
5. To display a text string at a particular co-ordinate on screen in graphics mode
6. To draw a horizontal ellipse.
7. To draw a vertical ellipse.
8. To draw a pie slice.
9. To draw a 2D bar
10. To draw a 3D bar
11. To fill color in a bound part of image.
12. To get maximum x – co-ordinates available in graphics mode.
13. To get maximum y – co-ordinates available in graphics mode.
14. To change background color in graphics mode.
15. To change foreground color in graphics mode.
16. To display a window in text mode.
17. To change text color in text mode.
18. To change text background color in text mode.
19. To display a blinking string in text mode.
20. To move cursor to a particular x and y co-ordinate position in text mode.
21. To clear the screen in graphics mode.
22. To change text font and size in graphics mode.
23. To change text color and text background color in text mode.
24. To display text in vertical direction (Bottom to Top) in graphics mode.

8. Explain the use of following text mode functions with their syntax and use of each parameter –
i) window() ii) gotoxy() iii) textcolor() iv) textbackground() v) cprintf() vi) cputs()
9. Explain the textattr() function along with the syntax and use of each parameter. Also write a
program to demonstrate use of textattr().
10. How to display a bound window in text mode? Write a program to demonstrate.
11. Write a program to display 5 concentric circles in the center of the screen. Every circle has to be
drawn in different color.
12. Write a program to display an octal shape on screen.
13. Write a program to display a pentagon on screen. Use drawpoly() function.
14. Write a program display a hexagon on screen. Use drawpoly() function.
15. Write a program to draw a parallelogram on screen and fill it with blue color. Use fillpoly()
function.
16. Write a program to display a star filled with light hatch pattern and green color.
17. Write a program to change the background color in graphics mode when a key is pressed.
18. Write a program to display a 2D bar chart. Assume suitable data.
19. Write a program to display a circle filled with blue color inside a rectangle filled with red color on
screen. Display “Cusrow Wadia” in the middle of the circle.
20. Write a program to display your name with red foreground and yellow background color in text
mode. Also the name should blink.
21. Write a program to display a text window of 10 x10 characters in the center of text mode screen.
Display your name and address in the window. Use text mode only.
22. Write a program to draw a circle of radius 10 at the center of screen and then move it to the top left
corner of screen.

You might also like