Assignment #2 CMP2122 BSSE 1st 2017

Max Marks: 10
Course: CMP-2122 (SE 1st 2017)
Class: BSSE Fall 2017
Submission Date: 25/12/2017

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 14-se-19 Fakhar Abbas (Repeater) 14-se-19 NA
2 16-se-10 Faizan Arshad (Repeater) 16-se-10 NA
3 17-se-01 Nazma Arshad 17-se-01 NA
4 17-se-02 Amna Nasar 17-se-02 NA
5 17-se-03 Azka Masood 17-se-03 NA
6 17-se-04 Muhammad Ahmed Saleh 17-se-04 NA
7 17-se-05 Khudija Tul Kobra 17-se-05 NA
8 17-se-06 Noor Fatima 17-se-06 NA
9 17-se-07 Noman Mustafa 17-se-07 NA
10 17-se-08 Raja Shzeb Awab 17-se-08 NA
11 17-se-09 Maryam Bibi 17-se-09 NA
12 17-se-10 Nabeel Akram Javed 17-se-10 NA
13 17-se-11 Maheen Irfan 17-se-11 NA
14 17-se-12 Umair Khan 17-se-12 NA
15 17-se-13 Kainat Kayani 17-se-13 NA
16 17-se-14 Shazma Ijaz 17-se-14 NA
17 17-se-15 Raja Muhammad Usman 17-se-15 NA
18 17-se-16 Huzaifa Zafar 17-se-16 NA
19 17-se-17 Kainat Iqra 17-se-17 NA
20 17-se-18 Muhammad Umar 17-se-18 NA
21 17-se-19 Humaira Channa 17-se-19 NA
22 17-se-20 Shalina Riaz 17-se-20 NA
23 17-se-21 Abdul Mujeeb Ahsan 17-se-21 NA
24 17-se-22 Muhammad Arslan Shahzad 17-se-22 NA
25 17-se-23 Muhammad Ahmad 17-se-23 NA
26 17-se-24 Maida Mubashar 17-se-24 NA
27 17-se-25 Ibtisam Haider 17-se-25 NA
28 17-se-26 Adnan Shahzad 17-se-26 NA
29 17-se-27 Muhammad Ammar Ashraf 17-se-27 NA
30 17-se-28 Muhammad Shahzad Fiaz 17-se-28 NA
31 17-se-29 Zeeshan Raza 17-se-29 NA
32 17-se-30 Kazim Ilyas 17-se-30 NA
33 17-se-31 Muhammad Umair Khalid 17-se-31 NA
34 17-se-32 Muhammad Hamza Tahir 17-se-32 NA
35 17-se-33 Hafiz Touseef Ahmad 17-se-33 NA
36 17-se-34 Usman Ali 17-se-34 NA
37 17-se-35 Muhammad Ammar Choudhary 17-se-35 NA
38 17-se-36 Shoaib Suleman 17-se-36 NA
39 17-se-37 Ghulam Murtaza 17-se-37 NA
40 17-se-38 Unsa Sharif 17-se-38 NA
41 17-se-39 Tasadduf Bibi 17-se-39 NA
42 17-se-40 Jawad Ali Khan 17-se-40 NA
43 17-se-41 Zain ul Abideen 17-se-41 NA
44 17-se-42 Ayesha Nisar 17-se-42 NA
45 17-se-43 Umer Shahzad 17-se-43 NA
46 17-se-44 Mirza Taimur Zafar 17-se-44 NA
47 17-se-45 Khurram Shahzad 17-se-45 NA
48 17-se-46 Zainab Shakir 17-se-46 NA
49 17-se-47 Tahseen Kousar 17-se-47 NA
50 17-se-48 Hasan Raza Tahir 17-se-48 NA
51 17-se-49 Muhammad Azaan Danish 17-se-49 NA
52 17-se-50 Baseer ud din 17-se-50 NA
53 17-se-51 Sheraz Ahmed 17-se-51 NA
54 17-se-52 Bushra Aslam 17-se-52 NA
55 17-se-53 Ali Safdar 17-se-53 NA
56 17-se-54 Sidra Ishaq 17-se-54 NA
57 17-se-55 Bisma Zaib 17-se-55 NA
58 17-se-56 Raja Muhammad Sohaib Akram 17-se-56 NA
59 17-se-57 Zohaib Zeeshan Aslam 17-se-57 NA
60 17-se-58 Waqas Ali 17-se-58 NA
61 17-se-59 Palwasha Ilyas 17-se-59 NA
62 17-se-60 Muhammad Rebal 17-se-60 NA
63 17-se-61 Zain ul Abdin 17-se-61 NA
64 17-se-62 Muhammad Asad Ali 17-se-62 NA
65 17-se-63 Khalid 17-se-63 NA