ip notes for class 11 chapter 7 programming guidelines download pdf, programming guidelines 11 notes, class 11 informatics practices notes, programming guidelines class 11, programming guidelines class 11 notes, class 11 programming guidelines, note informatics practices, informatics practices notes, programming guidelines, class 11 cinformatics practices chapter 7 notes, 11th standard informatics practices notes, 11th std informatics practices notes, class 11 informatics practices notes chapter 7, programming guidelines chapter class 11 notes
GUI Programming adopts simplified approach to programming. In GUI Programming, most of the components are predefined in a generic way to be adapted and incorporated according to the needs of the application.
Some guidelines for good GUI Programming are:
• Understand the need of the application beforestarting the development.
• Find out all possible inputs, which arerequired to produce the desired result/output.
• Avoid ambiguity and use appropriate input component.
• Provide appropriatelabels for each input and output options.
• Use meaningful names for variable, controls etc. and follow naming conventions.
• Ensure clarety of expression so user can easly understand it.
• Use comments and proper indentation.
• Insert blank lines and blank spaces wherenecessary to separate logical group of
statements.
• Avoid using free formatting style.
• Effective and efficient
• User friendly
• Self documenting code
• Reliable
• Portable
Program/application development is a step by step process. Effective and efficient software is developed only throuth systematic apporach.
Stages of the application development are:
Phase 1: Analysis : This phase contains following steps:
• Problem Specification: To understand the problem and set the objective.
• Requirement Analysis: To find the technical, financial, and operational requirement
for the new application.
• Possible Input and Output for obtaining desired results.
Phase 2: Designing : In this phase detailed design of the following components is to be made:
• Input Design
• Ouput Design
• Interface Designing (Forms)
• Modular Components
• Algorithms
Phase 3: Coding
Phase 4: Testing and Debugging:
Phase 5: Implementation
Phase 6: Documentation and M aintenance:
Compile Time Error- Occurs during compile time. When a program compiles it sources code is checked for rules of programming language. Its types are:-
Syntax error: it occurs when a grammatical rule of Java is violated
Semantic error: it occurs when statement are not meaningful.
Run Time Error: Occurs during the execution of the program.
Logical Error: Occurs due to wrong logic of a program.
Questions & Answers on Programming Guidelines
Q1. Excessive comments add time to the execution of your program. (True/False). Justify your answer.
Ans. No, Comments don’t add time to program execution. As comments are only for documentation purpose. They are non executable statements.
Q2. Differentiate between compile time and run time errors.
Ans: a. Compile time errors occur due violation of grammatical rules of a programming language. Run time errors occur during execution of program.
Compile time errors are easy to correct as we get error message corresponding to that which give an idea to correct it. Run time errors causes abnormal termination of program.
Example of compile time error: Missing semicolon(;). Example of run time error: Divide by zero error, Logarithm of a negative number.
Q3. Which error is harder to locate and why?
Ans: Logical errors are harder to locate. Logical errors occur due to error in the logic of a program. When a program is syntactically coorect, even running properly but not giving a desired output, it means that it has a logical error.
One common example of logical error is when we write a statement
(Eng+Math+Sci/3) instead of (Eng+Math+Sci)/3 to calculate average of marks of 3 subjects.
Q4. Explain the term ‘Exception Handling’.
Ans. A run time error is called an exception , which causes abnormal termination of program. To handle such type of errors/exception is called Exception handling.
In java exception handling is done by try{ } and catch { } block. Statements that can raise exception are put in try{ } block and its handling code is written in catch { } block.
Q5. Define Syntax :
Ans. Syntax: Formal set of rules defined for writing any statement in a language is known as syntax. Example- Every line in JAVA should be terminated by semicolon(;).
Q6. Define Protability.
Ans. Portability -Portability means an application should run on different platform without doing any changes.
Q7. Prettyprinting
Ans. Prettyprinting is the formatting of a program to make it more readable. These formatting conventions usually consist of changes in positioning, spacing, color, contrast, size and similar modifications intended to make the content easier to view, read and understand.
Q8 The code given below will give an error on execution if the value entered in t2 is 0. Identify the type of the error and modify the code to handle such an error.
int a,b,c;
a= Intger.parseInt(t1.getText());
b= Intger.parseInt(t2.getText());
c= a / b;
Ans: The error is logical error. int a,b,c;
a= Intger.parseInt(t1.getText());
b= Intger.parseInt(t2.getText()); if(b!=0)
c= a / b;
else {
JOptionPane.showMessageDialog(null,”Denominator cann’t be zero”);
t2. setText(“ “);
t2.requestFocus( ) ;
}
Q9. What are the characteristics of a good program?
Ans. The characteristics of a good program are-
• The program should be efficient in terms of execution speed and effective memory utilization.
• Code should be accurate. It should produce correct result.
• The program should user friendly. It means meaningful names should be given to variable, proper messages should be given, use of comments and indentation.
• The program must be reliable that is it should be able to handle the situation when the wrong inputs are given.
• The program should be portable so that it can run on different platforms without doing any changes.
Q10. What is the use of comments and indentation?
Ans. Comments are non executable statements and are used for internal documentation purpose. In Java comments are given either by // or /* ….*/ brackets.
Example-
/* This method calculates sum of two numbers.*/
int Sum( int x, int y) // x,y are formal parameters
{
return (x+y);
}
Indentation makes a program readable and understandable. When you are writing a program you must remember that the opening braces should properly match with a closing braces. Spaces should be inserted between operator and operands in an expression.
Copyright @ ncerthelp.com A free educational website for CBSE, ICSE and UP board.