Skip to main content

Important Introduction to Programming Short Questions

Chapter: 3
Question 1:
How does integer division differ from floating-point division in C?
Answer: Integer division discards the fractional part and returns an integer result, while floating-point division returns the complete result, including the fractional part.
Chapter: 3
Question 2:
What does the modulus operator % do in C?
Answer: The modulus operator % returns the remainder after dividing one integer by another.
Chapter: 3
Question 3:
What is operator precedence in C?
Answer: Operator precedence determines the order in which operators are evaluated in an expression. Operators like *, /, and % have higher precedence than + and -.
Chapter: 3
Question 4:
What happens in the expression 10 + 10 * 5 in C?
Answer: The expression evaluates to 60 because multiplication has higher precedence than addition, so 10 * 5 is calculated first, then 10 is added.
Chapter: 3
Question 5:
Why is it recommended to use parentheses in arithmetic expressions?
Answer: Parentheses clarify the order of operations and can force certain operations to be evaluated first, ensuring the intended result.
Chapter: 3
Question 6:
What are reserved words in C, and why can't they be used as variable names?
Answer: Reserved words are keywords defined by the C language for specific purposes (e.g., int, float). They cannot be used as variable names because they have predefined meanings.
Chapter: 3
Question 7:
Why is C considered case-sensitive?
Answer: C is case-sensitive, meaning it differentiates between uppercase and lowercase letters, so x and X would be considered different variables.
Chapter: 3
Question 8:
What is a null statement in C?
Answer: A null statement in C consists of just a semicolon ; and does nothing when executed.
Chapter: 3
Question 9:
What should you avoid when using the assignment operator in C?
Answer: Avoid using expressions on both sides of the assignment operator, as it only allows a variable on the left side and an expression on the right side.
Chapter: 3
Question 10:
Why is the main function mandatory in a C program?
Answer: The main function is mandatory because it serves as the entry point for program execution in C.