Assignment #2 CMP2122 BSCS 1st 2017

Max Marks: 10
Course: CMP-2122 (CS 1st 2017)
Class: BSCS 1st 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 16-cs-02 Muhammad Saleem (Repeater) 16-cs-02 NA
2 16-cs-10 Noman Akram (Repeater) 16-cs-10 NA
3 16-cs-12 Ameer Hassan (Repeater) 16-cs-12 NA
4 16-cs-20 S. Iqra Batool (Repeater) 16-cs-20 NA
5 16-cs-26 Rida Umber (Repeater) 16-cs-26 NA
6 17-cs-01 Hafsa Javed 17-cs-01 NA
7 17-cs-02 Amina Yousaf 17-cs-02 NA
8 17-cs-03 Mubashar Munir Gondal 17-cs-03 NA
9 17-cs-04 Muhammad Ehsan 17-cs-04 NA
10 17-cs-05 Syed Nade Ali Zaidi 17-cs-05 NA
11 17-cs-06 Shiza Qandeel 17-cs-06 NA
12 17-cs-07 Umair Ahmed 17-cs-07 NA
13 17-cs-08 Aqib Ali 17-cs-08 NA
14 17-cs-09 Rabia Kanwal 17-cs-09 NA
15 17-cs-10 Izaz ur Rehman 17-cs-10 NA
16 17-cs-11 Rida Sarwar 17-cs-11 NA
17 17-cs-12 Muhammad Naqash Iqbal 17-cs-12 NA
18 17-cs-13 Aqsa Mubeen 17-cs-13 NA
19 17-cs-14 Ali Irtiza 17-cs-14 NA
20 17-cs-15 Ali Hassan 17-cs-15 NA
21 17-cs-16 Kashif Khaliq 17-cs-16 NA
22 17-cs-17 Muhammad Shehbaz 17-cs-17 NA
23 17-cs-18 Syed Arsalan Asif 17-cs-18 NA
24 17-cs-19 Muhammad Zain ul Abedin 17-cs-19 NA
25 17-cs-20 Mubeen Arshad 17-cs-20 NA
26 17-cs-21 Imama Safdar 17-cs-21 NA
27 17-cs-22 Abdullah 17-cs-22 NA
28 17-cs-23 Inzamam ul Haq 17-cs-23 NA
29 17-cs-24 Ali Husnain Raza 17-cs-24 NA
30 17-cs-25 Roomisa Pervaiz 17-cs-25 NA
31 17-cs-26 Taneem Tahira 17-cs-26 NA
32 17-cs-27 Ali Usman 17-cs-27 NA
33 17-cs-28 Muhammad Yousaf 17-cs-28 NA
34 17-cs-29 Basit Abbas 17-cs-29 NA
35 17-cs-30 Muhammad Qasim 17-cs-30 NA
36 17-cs-31 Rida Mukhtar 17-cs-31 NA
37 17-cs-32 Sanawer Hussain 17-cs-32 NA
38 17-cs-33 Arslan Munir 17-cs-33 NA
39 17-cs-34 Muhammad Zeeshan 17-cs-34 NA
40 17-cs-35 Muhammad Zain Ul Hassan 17-cs-35 NA
41 17-cs-36 Sami Ullah 17-cs-36 NA
42 17-cs-37 Tanzeela Bibi 17-cs-37 NA
43 17-cs-38 Muhammad Asad Waqar 17-cs-38 NA
44 17-cs-39 Seemab Fatima 17-cs-39 NA
45 17-cs-40 Haroon Khalid 17-cs-40 NA
46 17-cs-41 Hassan Sardar 17-cs-41 NA
47 17-cs-42 Fasih Ur Rehman 17-cs-42 NA
48 17-cs-43 Hamna Aslam 17-cs-43 NA
49 17-cs-44 Ali Saqlain 17-cs-44 NA
50 17-cs-45 Inam Khalil 17-cs-45 NA
51 17-cs-46 Iqra Nawaz 17-cs-46 NA
52 17-cs-47 Awais Ijaz 17-cs-47 NA
53 17-cs-48 Bilal Arshad 17-cs-48 NA
54 17-cs-49 Farina Shehnaz 17-cs-49 NA
55 17-cs-50 Waqar Hassan 17-cs-50 NA
56 17-cs-51 Masum Muhammad Ali 17-cs-51 NA
57 17-cs-52 Jawad Ali 17-cs-52 NA
58 17-cs-53 Abdul Rehman Ali Siddique 17-cs-53 NA
59 17-cs-54 Qasim Ali 17-cs-54 NA
60 17-cs-55 Muhammad Bilal 17-cs-55 NA
61 17-cs-56 Muhammad Nabeel Asif 17-cs-56 NA
62 17-cs-57 Qumar Shahzad 17-cs-57 NA
63 17-cs-58 Shehzad Ahmed 17-cs-58 NA
64 17-cs-59 Shumraz Farooq 17-cs-59 NA
65 17-cs-60 Muhammad Kamran Akhtar 17-cs-60 NA
66 17-cs-61 Muhammad Muzammal 17-cs-61 NA
67 17-cs-62 Syed Tahir Abbas 17-cs-62 NA
68 17-cs-63 Sohaib Ali 17-cs-63 NA
69 17-cs-64 Shahzaib Afzal 17-cs-64 NA
70 17-cs-65 Tooba Rabab 17-cs-65 NA