Theory based questions
Theory based questions
Basic Questions
Conditional Statements
Storage Classes
Type Casting
1. What is type casting in C, and why is it necessary?
2. Explain the difference between implicit and explicit type casting with examples.
3. How does type casting affect arithmetic operations between different data types?
4. Can type casting be used to truncate floating-point numbers? Explain with an example.
5. How does type casting work with pointers in C?
Loops
1. What are the differences between for, while, and do-while loops in C?
2. How does the syntax of a while loop differ from a do-while loop?
3. Explain the use of the break statement in loops with an example.
4. What is the purpose of the continue statement, and how does it affect loop execution?
5. How do nested loops work in C? Provide an example.
6. What is an infinite loop? Write an example of an infinite for loop.
7. How can a while loop be used to validate user input?
8. How does the loop counter work in a for loop?
9. What is the difference between pre-checking (while) and post-checking (do-while) loops?
10. How can loops be used to generate patterns in C? Provide a basic example.
11. Write the general syntax of a for loop and explain each component.
12. What is the difference between a counter-controlled loop and a sentinel-controlled loop?
Arrays
1. What are arrays in C, and how are they declared?
2. Explain the difference between one-dimensional and two-dimensional arrays.
3. How can an array be initialized in C? Provide examples.
4. What is the syntax for accessing an element in a 2D array?
5. How does the memory layout of an array work in C?
6. Explain how an array name acts as a pointer in C.
7. What happens if you access an array index that is out of bounds?
8. How can arrays be used to store strings in C?
9. Write a program example to find the largest element in an array.
10. How can arrays be passed to functions in C?
11. What is the difference between static and dynamic arrays in terms of memory allocation?
12. Explain how a multidimensional array can be visualized and manipulated.
13. Can negative index be used in an array in C?
Function