0% found this document useful (0 votes)
20 views3 pages

Theory based questions

Uploaded by

anantsharma3000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Theory based questions

Uploaded by

anantsharma3000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Operators

1. What is the difference between arithmetic, relational, and logical operators in C?


2. Explain the use of the bitwise AND (&) and OR (|) operators with an example.
3. How does the modulo operator (%) work in C? Provide an example.
4. What are the differences between the increment (++) and decrement (--) operators in prefix
and postfix forms?
5. What is the purpose of the conditional (ternary) operator in C? Provide an example.
6. How do logical operators (&&, ||, !) work in decision-making in C?
7. What are the bitwise shift operators, and how do they function in C?
8. Differentiate between = and == in C with examples.
9. Can arithmetic operations be performed on characters in C? Explain with an example.
10. What is operator precedence, and why is it important in expressions?
11. Explain the difference between the assignment operators += and -=.
12. What are compound operators, and how are they used in C?
13. How does operator associativity influence the evaluation of expressions?
14. What is the precedence order of arithmetic, logical, and relational operators in C?
15. Explain the use of compound bitwise operators (&=, |=, ^=) with examples.
16. What are the differences between left shift (<<) and right shift (>>) operators in C?
17. How can the ? : operator be nested to evaluate complex conditions?

Basic Questions

1. What is a token in C programming?


2. What are reserved words in C? Can they be used as identifiers?
3. List five keywords in C and explain their use.
4. What is the difference between a keyword and an identifier in C?
5. How do you declare a variable in C, and what is its purpose?
6. What is the role of a literal in C programming? Give examples of different types of literals.
7. What is an integer literal? Provide an example.
8. How are floating-point literals represented in C? Give an example.
9. What is the syntax for declaring a character variable and assigning it a character literal in C?
10. Can you use a reserved word (keyword) as a variable name in C? Why or why not?

Conditional Statements

1. What is the syntax of an if statement in C? Provide an example.


2. How does the else if ladder work in C?
3. What are the differences between a simple if and a nested if statement?
4. Explain the working of the switch statement with a use case example.
5. What happens if a break statement is omitted in a switch case?
6. Can a switch statement work with strings? Why or why not?
7. How does a default case work in a switch statement?
8. What are the differences between the if-else and switch statements in terms of use cases?
9. Can multiple conditions be combined in an if statement? Provide an example.
10. Explain the role of the goto statement in conditional control.
11. How does nesting of if-else statements improve conditional logic?
12. What is the importance of indentation and braces in writing conditional statements?
13. Explain the working of the switch statement with a use case example.
14. What happens if a break statement is omitted in a switch case?
15. Can a switch statement work with strings? Why or why not?
16. Explain the limitations of switch statements in C and why they cannot directly handle string
comparisons.
17. How does a default case work in a switch statement?
18. Describe how the default case provides a fallback if none of the case values match.
19. What are the differences between the if-else and switch statements in terms of use cases?
20. Highlight when it is more appropriate to use if-else versus switch, depending on the number
of conditions and types of checks involved.

Storage Classes

1. What are storage classes in C, and why are they important?


2. Explain the differences between auto and static storage classes.
3. What is the purpose of the register storage class in C?
4. How does the extern storage class work? Provide an example.
5. What is the default storage class of variables declared inside a function?
6. Compare the scope and lifetime of variables with static and auto storage classes.
7. What are the use cases for register variables? Why can't you take their address?
8. Explain the difference between global and local variables in terms of storage classes.
9. How does the static keyword affect functions in C?
10. Explain the use of %lf for double-precision floating-point numbers.
11. What is the purpose of %p, and how is it used?
12. How does the %x specifier display numbers in hexadecimal format?
13. Explain the difference between %d and %i for integers.
14. What is the ASCII standard, and why is it important in C programming?
15. How many characters are represented in the ASCII table?
16. What is the ASCII value of 'A'? How about 'a'?
17. Explain the difference between printable and non-printable ASCII characters.
18. How can the ASCII value of a character be obtained in C?
19. Write a program snippet to convert a character to its ASCII equivalent.

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

1. What are functions in C, and why are they used?


2. Explain the difference between a user-defined function and a library function in C.
3. What are function prototypes, and why are they necessary?
4. How are arguments passed to a function in C (pass by value vs. pass by reference)?
5. What is recursion, and how is it implemented in C?
6. How can the return statement be used in a function?
7. What is meant by call by value in C, and how does it differ from call by reference?
8. What are formal parameters in C, and how are they different from actual parameters?
9. How are formal parameters defined in the function declaration, and what role do they play
when the function is called?
10. How do actual parameters get passed to a function? Can they be constants, variables, or
expressions?
11. In call by value, how does the value of an actual parameter get copied to the corresponding
formal parameter?
12. What happens when there is a mismatch between the data type of formal parameters and
actual parameters in a function call?

You might also like