Assignment #2 CMP2122 BSIT 1st 2017

Max Marks: 10
Course: CMP-2122 (BSIT 1st 2017)
Class: BSIT 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-it-40 Basharat Hussain (Repeater) 14-it-40 NA
2 16-it-03 Ammar Hassan (Repeater) 16-it-03 NA
3 16-it-04 Adnan Zafar (Repeater) 16-it-04 NA
4 16-it-08 Ali Zulfiqar Khan (Repeater) 16-it-08 NA
5 16-it-11 Behram Munir (Repeater) 16-it-11 NA
6 16-it-13 Asad Hussain (Repeater) 16-it-13 NA
7 16-it-16 Nimra Shahzadi (Repeater) 16-it-16 NA
8 16-it-26 Ans Saeed (Repeater) 16-it-26 NA
9 16-it-76 Babar Hussain (Repeater) 16-it-76 NA
10 17-it-01 Itshaz Ul Haq 17-it-01 NA
11 17-it-02 Kinza Kanwal 17-it-02 NA
12 17-it-03 Aleeza Fzal Gondal 17-it-03 NA
13 17-it-04 Naeem Tasleem 17-it-04 NA
14 17-it-05 Rizwana Nawaz 17-it-05 NA
15 17-it-06 Abu Bakar Sadeeq 17-it-06 NA
16 17-it-07 Muneeb Ahmed 17-it-07 NA
17 17-it-08 Musab Umair Badar 17-it-08 NA
18 17-it-09 Maria Imtiaz 17-it-09 NA
19 17-it-10 Isra Iqbal 17-it-10 NA
20 17-it-11 Syed Ali Raza 17-it-11 NA
21 17-it-12 Anum Rubab 17-it-12 NA
22 17-it-13 Mobeen Liaqat 17-it-13 NA
23 17-it-14 Syeda Najjaf Zahra 17-it-14 NA
24 17-it-15 Usama Nazir 17-it-15 NA
25 17-it-16 Muhammad Kashif Khan 17-it-16 NA
26 17-it-17 Ayesha Afzal 17-it-17 NA
27 17-it-18 Arosha Ayman 17-it-18 NA
28 17-it-19 Sajid Afzal 17-it-19 NA
29 17-it-20 Humair Shahzad 17-it-20 NA
30 17-it-21 Zaka Ur Rehman 17-it-21 NA
31 17-it-22 Rabia Yar 17-it-22 NA
32 17-it-23 Aqsa Bashir 17-it-23 NA
33 17-it-24 Ahsan Ali 17-it-24 NA
34 17-it-25 Asad Abbas 17-it-25 NA
35 17-it-26 Fahad Hassan Khan 17-it-26 NA
36 17-it-27 Anosha Fatima 17-it-27 NA
37 17-it-28 Wajiha Asif 17-it-28 NA
38 17-it-29 Iqra Mushtaq 17-it-29 NA
39 17-it-30 Ali Hassan 17-it-30 NA
40 17-it-31 Zaraq Nadeem Ijaz 17-it-31 NA
41 17-it-32 Ghulam Murtaza 17-it-32 NA
42 17-it-33 Muhammad Qasim Ali 17-it-33 NA
43 17-it-34 Munzareen 17-it-34 NA
44 17-it-35 Tayyaba Naz 17-it-35 NA
45 17-it-36 Muhammad Shahroz Arshad 17-it-36 NA
46 17-it-37 Sawaira Ishaq 17-it-37 NA
47 17-it-38 Taskeen Ashraf 17-it-38 NA
48 17-it-39 Shahroz Ali 17-it-39 NA
49 17-it-40 Hassam Haider 17-it-40 NA
50 17-it-41 Bilal 17-it-41 NA
51 17-it-42 Abdul Rehman 17-it-42 NA
52 17-it-43 Waqas Ali (Repeater) 17-it-43 NA
53 17-it-44 Afzal Ahmad 17-it-44 NA
54 17-it-45 Ambeena Kiran 17-it-45 NA
55 17-it-46 Jahanzaib Khan 17-it-46 NA
56 17-it-47 Muhammad Haseeb Riaz 17-it-47 NA
57 17-it-48 Sidra Nawaz 17-it-48 NA
58 17-it-49 Tania Arshad 17-it-49 NA
59 17-it-50 Zartash Anwar 17-it-50 NA
60 17-it-51 Tauseef Arshad 17-it-51 NA
61 17-it-52 Muhammad Waleed Rauf 17-it-52 NA
62 17-it-53 Muhammad Bilal 17-it-53 NA
63 17-it-54 Areeba Mukhtar 17-it-54 NA
64 17-it-55 Adil Ashraf 17-it-55 NA
65 17-it-56 Muhammad Ali 17-it-56 NA
66 17-it-57 Asad Ali Shakar 17-it-57 NA
67 17-it-58 Amar Sajid 17-it-58 NA
68 17-it-59 Muhammad Umer 17-it-59 NA
69 17-it-60 Ali Hassan Tarar 17-it-60 NA
70 17-it-61 Zeeshan Ali 17-it-61 NA
71 17-it-62 Areej 17-it-62 NA
72 17-it-63 Asma Azam 17-it-63 NA
73 17-it-64 Mudassar Mushtaq 17-it-64 NA
74 17-it-66 Syed Saliq 17-it-66 NA
75 17-it-67 Sami Ullah 17-it-67 NA