CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science C++ Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE C++ 2007 Delhi : 1.a) Differenctiate between a Run Time Error and Syntax Error. Also give suitable examples of each in c++. Ans: Run Time Errors: Errors that occur during the execution of a program are called as run time errors. It is caused of some illegal peration taking place or inavailability of desired or required conditions for the execution of the program. For instance, if a program is trying to open a file which does not exist or it could not be opened, it results into an execution error. Similarly, if enough memory is not available or an expression is trying to divide a number by zero are run-time errors. 2 Eg: Division by zero.c=a/b; Syntax Errors: Syntax errors occur when rules of a programming languages (syntax) is misused. Ie when a grammatical rule of C++ is violated. Eg (i) c=a+b In this statement,since there is no semicolon at the end of the statement,there will occurs a syntax error. (ii) cin<<a; In this statement, since stream insertion operator (<<) has given instead of stream extraction operation(>>), there will occurs a syntax error. 1.b) Name the header file(s) that shall be needed for successful compilation of the following C++ code.
1 Ans) stdio.h string.h 1. c) Rewrite the following program after removing the syntactical error(s) if any.Underline each correction.
Ans)
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] ) |
|