Important Introduction to Programming Short Questions
Chapter: 8
Question 1:
What is the impact of missing a break statement in a switch case?
Answer:
Missing a break statement causes the execution to fall through to subsequent cases, leading to potentially unintended code execution.
Chapter: 8
Question 2:
How is the default case used in a switch statement?
Answer:
The default case handles any values that do not match the listed cases, providing a way to manage unexpected inputs.
Chapter: 8
Question 3:
In which scenarios is a continue statement particularly useful?
Answer:
A continue statement is useful when you want to skip certain iterations of a loop based on a condition while continuing the loop itself.
Chapter: 8
Question 4:
What is the significance of proper indentation and brace matching in if/else and switch statements?
Answer:
Proper indentation and brace matching ensure that the code blocks are correctly associated with their conditions, preventing logic errors and improving readability.
Chapter: 8
Question 5:
Why is structured programming preferred over using goto statements?
Answer:
Structured programming is preferred because it makes code easier to follow, debug, and maintain, avoiding the chaos that goto statements can create.
Chapter: 9
Question 6:
What is the primary construct of a C program?
Answer:
The primary construct of a C program is the function, which is a subtask that receives information, processes it, and returns a result.
Chapter: 9
Question 7:
What is the concept of top-down design in programming?
Answer:
Top-down design involves breaking down a complex problem into smaller, more manageable tasks or modules, which are then solved individually.
Chapter: 9
Question 8:
How does parallel processing work in programming?
Answer:
Parallel processing involves delegating tasks to different functions or processes so that multiple tasks can be performed simultaneously, improving efficiency.
Chapter: 9
Question 9:
What does 'function-oriented language' mean?
Answer:
In a function-oriented language like C, the primary focus is on writing and using functions to structure the program and perform tasks.
Chapter: 9
Question 10:
What are the two categories of functions in C?
Answer:
Functions in C are categorized into those that return a value and those that do not return any value (void functions).