COMPUTER 2 Flashcards
(12 cards)
What are the two main aspects of software designing?
Program Structure and Program Representation
Program Structure refers to how a program should be organized, while Program Representation refers to its presentation style for readability.
What is the importance of programming style?
Developing a good program is a skill; writing a good program is a quality habit.
Effective programming style enhances readability and maintainability.
List the guidelines for making a program readable.
- Use of proper names for identifiers
- Clarity of expressions
- Use comments and indentation
- Insert blank lines and spaces
What should be considered when using proper names for identifiers?
Assign meaningful names to variables, constants, and functions. Avoid similar-looking names.
Examples include avg_marks, total_salary, roll_number.
How can clarity of expressions be improved?
Use parentheses to enclose subexpressions.
This enhances readability and understanding of the code.
What is the purpose of using comments and indentation in programming?
To provide internal documentation that is ignored by the compiler.
Example: //Program to add.
Why is inserting blank lines and spaces beneficial?
It enhances the program’s readability.
Good formatting helps others understand the code better.
What is pretty printing in programming?
The process of converting and presenting source code in a legible and attractive way.
It improves the visual structure of the code.
What are the characteristics of a good program?
- Efficient and effective
- User friendly
- Self-documenting code
- Reliable
- Portable
What is a syntax error?
Occurs when the rules of programming are misused, violating grammatical rules of the programming language.
Example: Incorrect use of syntax in C++.
What is a logical error?
Occurs when a program compiles and runs but does not produce the correct result due to a programmer’s mistake in analysis.
These errors can be difficult to detect.
What is a runtime error?
Errors that occur during the execution of a program.
These can cause the program to crash or behave unexpectedly.