0% found this document useful (0 votes)
15 views

Question Bank of C Programming

Uploaded by

rohitrawat805318
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Question Bank of C Programming

Uploaded by

rohitrawat805318
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Question Bank of C Programming

Section A Very Short Questions (1 Mark Each)


Unit 4: Functions

Very Short Answer Type Questions (1 Mark Each)

1. What is a function?.

2. What is recursion?

3. What is a return value in a function?

4. What are preprocessor directives?

5. Give an example of macro substitution.

6. What is file inclusion?

7. Explain any two advantages of using functions.

8. Name two types of preprocessor directives.

MCQs/True-False/Fill in the Blanks (1 Mark Each)

1. Fill in the blank: Functions are used to avoid ________ of code.

2. Which of the following is a preprocessor directive? a) #include b) printf c) scanf d) return

3. True or False: Recursion is when a function calls itself.

4. What is the correct syntax for calling a function in C? a) function_name(); b) call


function_name; c) function_call: name; d) run(function_name);

5. Which directive is used for including header files? a) #define b) #include c) #macro d)
#pragma

6. True or False: Functions cannot be called from within other functions.

7. What is the correct way to return a value from a function? a) exit(value); b) return value; c)
stop(value); d) output(value);

8. True or False: Functions must always have arguments.

1. Which of the following is a valid function header? a) int func(); b) func int(); c) int func; d)
declare func();

2. True or False: #define is used for macro substitution.

Unit 5: Pointers

Very Short Answer Type Questions (1 Mark Each)

1. What is a pointer?

2. Define pointer arithmetic.


3. What does the malloc function do?

4. Differentiate between malloc and calloc.

5. What is the syntax to declare a pointer in C?

6. Define dynamic memory allocation.

7. What is the purpose of free() function in dynamic memory allocation?

8. What is the purpose of realloc?

9. Explain pointer variables with an example.

10. Name two advantages of using pointers.

MCQs/True-False/Fill in the Blanks (1 Mark Each)

1. True or False: A pointer can hold the address of a variable.

2. Fill in the blank: The ________ operator is used to access the address of a variable.

3. True or False: Pointer arithmetic includes addition and subtraction.

4. Which function is used to allocate memory dynamically? a) malloc b) printf c) scanf d) free

5. True or False: realloc is used to deallocate memory.

6. Fill in the blank: The ________ function is used to free dynamically allocated memory.

7. Which operator is used to access the value at the address stored in a pointer? a) & b) *
c) -> d) .
8. True or False: calloc initializes allocated memory to zero.

Unit 6: Structures and File Handling

9. Very Short Answer Type Questions (1 Mark Each)

10. What is a structure?.

11. What is an array of structures?

12. Write an example of a structure in C.

13. What is the difference between structures and unions?

14. Define nested structures.

15. What is the purpose of file handling in C?

16. List two file opening modes in C.

17. What is the difference between "r" and "w" modes in file handling?

18. Define command-line arguments.

19. What is the use of the fclose() function?

MCQs/True-False/Fill in the Blanks (1 Mark Each)


20. True or False: Structures are used to group different types of data.

21. Fill in the blank: The keyword ________ is used to define a structure.

22. Fill in the blank: The ________ function is used to close a file in C.

23. True or False: Command-line arguments are passed to the program at runtime.

24. Fill in the blank: A ________ structure contains another structure as its member.

25. Which of the following is used to read a file in C? a) fread b) fclose c) fprint d) fopen

26. Which operator is used to access structure members? a) . b) -> c) * d) &

27. True or False: A union shares memory among all its members.

Section B
long questions (5 mark each)
Unit 1: Introduction to Programming & Basics of C

1. Explain the role of translators in programming with examples.

2. Differentiate between variables and constants in C with examples.

3. Discuss the various types of operators in C and their usage.

4. How are algorithms and flowcharts useful in programming? Provide examples.

5. Explain the basic data types in C and their usage.

6. Write a program to calculate the area of a rectangle using input/output functions.

7. Write a program to reverse a number(like 123321)

8. Write a program to swap two variables in C Programming.

9. Write a program to calculate simple interest.

Unit 2: Control Structures

1. Explain the decision-making constructs in C with examples.

2. Write a program to demonstrate the usage of nested if-else statements.

3. What is Loops in C? Explain different types of Loop with example.

4. Write a program to calculate the factorial of a number using a for loop.

5. Explain the significance of break and continue statements in loops with examples.

6. Describe the switch-case construct with a program to simulate a simple calculator.

7. Write a program to print the Fibonacci series using a while loop.


8. Write a program to determine if a number is prime or not using a for loop.

9. Write a program to print the following patterns

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

10. Write a program to generate the following pattern.

*****
****
***
**
*
11. What do you mean by control Statement? Explain with example.

Unit 3: Arrays and Strings

1. What is Array? Explain different types of Array with Syntax and Example.

2. Write a program to Search an element from the array elements.

3. Write a program to perform matrix addition using two-dimensional arrays.

4. Write a program to sort an array of integers in ascending order.

5. What do you mean by Strings? Explain any 5 String methods with example.

6. Write a program to multiply two matrix using two dimension array.

Unit 4: Function

1. What is Function? Explain the advantages of using functions in programming.

2. Write a program to calculate the sum of two numbers using functions.

3. What is recursion? Explain with an example.

4. Explain the role of function arguments and return values in C.

5. What is preprocessor directives? Explain with Example.

6. Write a program to demonstrate the usage of macro substitution.

7. Explain the concept of file inclusion with an example.

8. Write a program to calculate the factorial of a number using recursion.

9. Write a program to print a Table with the help of with argument and no return value
category of function.

Unit 5: Pointers

1. What do you mean by pointers? Explain the advantage of using pointer in C.


2. Write a program to demonstrate pointer arithmetic.

3. What is Dynamic memory allocation? Explain its function with example.

4. Write a program to dynamically allocate memory using malloc and free.

5. Explain the differences between malloc and calloc with examples.

6. Describe the realloc function and its usage with a program.

7. What do you mean by pointer of pointer? Explain with examples.

Unit 6: Structures and File Handling

1. What is Structure? Explain the advantage of using Structure in C programming.

2. Write a program to demonstrate an array of structures.

3. What is the difference between structures and unions with examples.

4. Write a program to read and write data to a file in C.

5. Explain the concept of nested structures with a suitable example.

6. Write a program to demonstrate command-line arguments in C.

7. What do you mean by File Handling? Discuss the various file operations in C.

8. Write a program to calculate the total and average marks of students using structures.

You might also like