Debugging Programs Class 11 Computer Science Exam Questions

Exam Questions Class 11

Please refer to Debugging Programs Class 11 Computer Science Exam Questions provided below. These questions and answers for Class 11 Computer Science have been designed based on the past trend of questions and important topics in your class 11 Computer Science books. You should go through all Class 11 Computer Science Important Questions provided by our teachers which will help you to get more marks in upcoming exams.

Class 11 Computer Science Exam Questions Debugging Programs

Class 11 Computer Science students should read and understand the important questions and answers provided below for Debugging Programs which will help them to understand all important and difficult topics.

Short answer Type Questions

Question: Why are logical errors harder to locate?
Answer: in spite of logical errors presence, program executes without any problems but the output produced is not correct. Therefore, each and every statement of the program needs to be scanned and interpreted. Thus the logical errors are harder to locate.

Question: What is an Exception?
Answer: Exception in general refers to some contradictory or unusual situation which can be encountered unexpectedly while executing the program. Unhandled exceptions will cause Python to halt execution.

Question: Why is Exception Handling is required?
Answer: Unhandled exceptions will cause Python to halt execution. The exception handling is ideal for processing exceptional situations in a controlled way so that program ends gracefully rather than abrupt crashing of the program.

Question: What do you understand by Syntax errors and Semantics errors?
Answer: Syntax Errors: syntax error occur when rules of a programming language are misused i.e.
grammatical rule of Python is violated. e.g.
if x=(x*y) etc.
Prepared By: Sanjeev Bhadauria & Neha Tyagi

Semantics Errors: Semantics error occur when statements are not meaningful. e.g. x * y = z
this will result in a semantical eoor as an expression cannot come on the left side of an assignment operator.

Question: What are main error types? Which types are most dangerous and why?
Answer: Main error types are –  
(i)Compile-time errors   (ii) Run-time errors   (iii) Logical errors

 Logical errors are most dangerous errors because these are most difficult to fix. The error is caused by a mistake in the program‘s logic. You won‘t get an error message, because no syntax or runtime error has occurred. You will have to find the problem on your own by reviewing all the relevant parts of your code – although some tools can flag suspicious code which looks like it could cause unexpected behaviour.

Question: What is a difference between an error and exception?
Answer: Exception and Error: Exceptions are those which can be handled at the run time whereas errors cannot be handled. An exception is an Object of a type deriving from the System.
Exception class. System Exception is thrown by the CLR (Common Language Runtime) when errors occur that are nonfatal and recoverable by user.

Question: What is the need for debugger tool?
Answer: Debugger tools are very useful especially if the code is big or the error is not very clear, it becomes very difficult to manually figure out the origin and cause of the problem. Debugger tools here prove very handy and useful. They show us the line by line execution and its result on variables interactively and help a programmer get to the root of the problem.

Question: when does these exception occur?
(a) Type Error (b) Index Error (c) Name Error
Answer: (a) Type Error: Raised when an operation or function is applied to an object of inappropriate type. e.g. if you try to compute square-root of a string.
(b) Index Error: Raised when a sequence subscript or index is out of range e.g. from a string of length 4 if you try to read a value of index 4 or more.
(c) Name Error: Raised when an identifier name is not found.
Prepared By: Sanjeev Bhadauria & Neha Tyagi

Question: Name some common built-in exceptions in Python.
Answer: Some Common built-in Exceptions in Python are:
(i) EOFError
(ii) IOError
(iii) NameError
(iv) IndexError
(v) ImportError
(vi) TypeError
(vii) ValueError
(viii) ZeroDivisionError
(ix) KeyError

Question: What is debugging and code tracing?
Answer: Debugging involves correction of code so that the cause of errors is removed. I other words we can say that debugging means figure out the origin of error in code, fix the error code and review and rerun your code to ensure that the error is fixed.

Debugging Programs Computer Science Exam Questions

We hope you liked the above provided Debugging Programs Class 11 Computer Science Exam Questions. If you have any further questions please put them in the comments section below so that our teachers can provide you an answer.