C Programming Question and Answers

13. What is an array?
 
  • An array is a group of similar data types stored under a common name.
  • Int a[10]; Here a[10] is an array with 10 integer values.
 
Your Name Your Email-ID
Your Answer
14. What is the difference between ++a and a++?
 
  • ++a Means do the increment before the operation (pre increment)
  • a++ Means do the increment after the operation(post increment)
 
Your Name Your Email-ID
Your Answer
15. What are the different types of errors?
  The types of errors are syntax error, logical error, and runtime error.
  • Syntax error results from the violation of the grammar (syntax) of C language. In the process of syntax errors, the program will not compile.
  • Logical errors result from the wrong logic that in turn result from the poor understanding of the problem under consideration. Even in the process of logical errors, the program will run but the results will be incorrect. These errors are most difficult to locate particularly if the problem is large and complex.
  • Runtime errors result either from non availability of the resource required such an attempt to open/read from a non existing data file or memory allocation failure, etc. or an attempt to perform an illegal operation such as division by zero, taking square root or logarithm of a negative number etc. In the presence of these errors, the program will terminate prematurely, i.e., before finishing its intended task. Premature termination is also known as abnormal terminal.
  • Errors are also known as bugs.
 
Your Name Your Email-ID
Your Answer
16. What is the difference between while loop and do while loop?
 
  • In the while loop the condition is first executed. If the condition is true then it executes the body of the loop. When the condition is false it comes out of the loop.
  • In the do while loop first the statement is executed and then the condition is checked.
  • The do while loop will execute atleast one time even though the condition is false at the very first time.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 4 of 15