Skip to main content

Important Introduction to Programming Short Questions

Chapter: 5
Question 1:
What is a conditional statement in programming?
Answer: A conditional statement in programming is a statement that performs an action only if a certain condition is true.
Chapter: 5
Question 2:
How does an 'if statement' work in C language?
Answer: In C, an 'if statement' checks a condition, and if the condition is true, it executes a block of code.
Chapter: 5
Question 3:
What is the role of braces { } in an 'if statement'?
Answer: Braces { } are used to group multiple statements into a block that will execute together if the condition in the 'if statement' is true.
Chapter: 5
Question 4:
What is the difference between = and == in C programming?
Answer: '=' is an assignment operator, while '==' is a comparison operator used to check equality between two values.
Chapter: 5
Question 5:
What is a relational operator?
Answer: Relational operators in programming compare two values and return a boolean result, such as true or false.
Chapter: 5
Question 6:
What are examples of relational operators in C?
Answer: Examples of relational operators in C include > (greater than), < (less than), == (equal to), >= (greater than or equal to), and <= (less than or equal to).
Chapter: 5
Question 7:
Why is it important to initialize variables in C programming?
Answer: Initializing variables in C prevents them from containing garbage values, ensuring the program behaves as expected.
Chapter: 5
Question 8:
What is the purpose of the 'else' part in an 'if/else' structure?
Answer: The 'else' part specifies what to do if the condition in the 'if statement' is false, allowing for alternate code execution.
Chapter: 5
Question 9:
How does the && operator work in C programming?
Answer: The && operator in C is a logical AND operator that returns true if both operands are true, and false otherwise.
Chapter: 5
Question 10:
What does the ! operator do in C programming?
Answer: The ! operator is a logical NOT operator that inverts the boolean value of its operand, turning true to false and vice versa.