Write down at least 20 common programming errors (from course book chapters) with example code. Submit the assignment in hand written form.
Error 1:
Forgetting to terminate a comment with */
Error 2:
Starting a comment with the characters */ or ending a comment with the characters /*
Error 3:
Typing the name of the output function printf as print in a program
Error 4:
Using a capital letter where a lowercase letter should be used (for example, typing Main
instead of main).
Error 5:
Placing variable definitions among executable statements causes syntax errors
Error 6:
A calculation in an assignment statement must be on the right side of the = operator. It is
a compilation error to place a calculation on the left side of an assignment operator.
Error 7:
Forgetting one or both of the double quotes surrounding the format control string in a
printf or scanf
Error 8:
Forgetting the % in a conversion specification in the format control string of a printf or
scanf
Error 9:
Placing an escape sequence such as \n outside the format control string of a printf or
scanf
Error 10:
Forgetting to include the expressions whose values are to be printed in a printf containing
conversion specifiers
Error 11:
Not providing a conversion specifier when one is needed in a printf format control string
to print the value of an expression
Error 12:
Placing inside the format control string the comma that is supposed to separate the format
control string from the expressions to be printed
Error 13:
Using the incorrect format conversion specifier when reading data with scanf
Error 14:
Forgetting to precede a variable in a scanf statement with an ampersand when that variable should, in fact, be preceded by an ampersand.
Error 15:
Preceding a variable included in a printf statement with an ampersand when, in fact,
that variable should not be preceded by an ampersand
Error 16:
An attempt to divide by zero is normally undefined on computer systems and generally results in a fatal error, i.e., an error that causes the program to terminate immediately without having successfully performed its job. Nonfatal errors allow programs to run to completion, often producing incorrect results
Error 17:
A syntax error occurs if the two symbols in any of the operators !=, >= and <= are reversed
as in =!, => and =<, respectively
Error 18:
Confusing the equality operator == with the assignment operator
Error 19:
Placing a semicolon immediately to the right of the right parenthesis after the condition
in an if statement
Error 20:
Placing commas (when none are needed) between conversion specifiers in the format control string of a scanf statement
Results
Sr# | Name | Roll No | Marks |
---|---|---|---|
1 | 16-mscit-21 Shamraiz Iqbal (Repeater) | 16-mscit-21 | NA |
2 | 16-mscit-29 Iram Naz (Repeater) | 16-mscit-29 | NA |
3 | 17-mscit-01 Ayesha Kanwal | 17-mscit-01 | NA |
4 | 17-mscit-02 Arbaz Naeem | 17-mscit-02 | NA |
5 | 17-mscit-03 Adeela Rani | 17-mscit-03 | NA |
6 | 17-mscit-04 Shaista Khan | 17-mscit-04 | NA |
7 | 17-mscit-05 Asma Benish | 17-mscit-05 | NA |
8 | 17-mscit-06 Maria Ummar | 17-mscit-06 | NA |
9 | 17-mscit-07 Azka Riaz | 17-mscit-07 | NA |
10 | 17-mscit-08 Shar Bano | 17-mscit-08 | NA |
11 | 17-mscit-09 Sahrish Ansar | 17-mscit-09 | NA |
12 | 17-mscit-10 Maryam Akram | 17-mscit-10 | NA |
13 | 17-mscit-11 Seerat Zhra | 17-mscit-11 | NA |
14 | 17-mscit-12 Sana Sultan | 17-mscit-12 | NA |
15 | 17-mscit-13 Kiran Yasmeen | 17-mscit-13 | NA |
16 | 17-mscit-14 Bilal Afzal | 17-mscit-14 | NA |
17 | 17-mscit-15 Pakeeza Arshad | 17-mscit-15 | NA |
18 | 17-mscit-16 Muhammad Zia Awan | 17-mscit-16 | NA |
19 | 17-mscit-17 Fariha Maryam | 17-mscit-17 | NA |
20 | 17-mscit-18 Muhammad Jahangir Alam | 17-mscit-18 | NA |
21 | 17-mscit-19 Tahseena Kanwal | 17-mscit-19 | NA |
22 | 17-mscit-20 Arslan Habib | 17-mscit-20 | NA |