0% found this document useful (0 votes)
4 views6 pages

C Debugging Activity

The document outlines an activity for debugging C programs, consisting of 10 questions with buggy code snippets. Each question requires students to identify a specific error and is mapped to a Course Outcome (CO) and a Bloom's Taxonomy (BT) level. The activity aims to enhance students' understanding of syntax, logical reasoning, and debugging skills in C programming.

Uploaded by

Nupur Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

C Debugging Activity

The document outlines an activity for debugging C programs, consisting of 10 questions with buggy code snippets. Each question requires students to identify a specific error and is mapped to a Course Outcome (CO) and a Bloom's Taxonomy (BT) level. The activity aims to enhance students' understanding of syntax, logical reasoning, and debugging skills in C programming.

Uploaded by

Nupur Jain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Activity: Debugging C

Programs – Identify the


Error
Course Code: BCA103T
Course Name: Programming for Problem Solving using C
Activity Type: Buggy Code Identification and CO–BT Mapping
Total Questions: 10

Instructions to Students
1. Each question contains a buggy C code snippet.
2. Read the code carefully and identify the error in one line.
3. This activity is designed to strengthen your syntax understanding,
logical reasoning, and debugging skills in C.
4. Each question is mapped to a Course Outcome (CO) and a Bloom’s
Taxonomy (BT) Level for academic documentation.

Question-wise Details
[Link]. 1 [Mapped CO: CO1, BT Level:
Understand (BT-2)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
printf("Hello World")
return 0;
}

Error to be Identified:
Missing semicolon after printf statement.
[Link]. 2 [Mapped CO: CO1, BT Level:
Remember (BT-1)]
Buggy Code Snippet:

int main() {
int a = 5;
printf("%d", a);
return 0;
}

Error to be Identified:
Missing #include <stdio.h> header file.

[Link]. 3 [Mapped CO: CO2, BT Level: Analyze


(BT-4)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
int a = 10;

if (a = 5)
printf("True");

return 0;

Error to be Identified:
Assignment operator = used instead of comparison operator == in the if
condition.

[Link]. 4 [Mapped CO: CO3, BT Level: Analyze


(BT-4)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
int i;
for (i = 0; i < 5; i++);
printf("%d", i);

return 0;

Error to be Identified:
Semicolon after for (i = 0; i < 5; i++); ends the loop prematurely;
printf is not inside the loop body.

[Link]. 5 [Mapped CO: CO2, BT Level:


Understand (BT-2)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
int a;
printf("%d", a);
return 0;
}

Error to be Identified:
Use of uninitialized variable a in printf.

[Link]. 6 [Mapped CO: CO3, BT Level: Analyze


(BT-4)]
Buggy Code Snippet:

#include <stdio.h>

void main() {
int a = 5;
return a;
}

Error to be Identified:
Invalid return a; in a void function; a void function cannot return a value.

[Link]. 7 [Mapped CO: CO4, BT Level: Analyze


(BT-4)]
Buggy Code Snippet:

#include <stdio.h>

int add(int x, int y);

int main() {
printf("%d", add(2));
return 0;
}

Error to be Identified:
Function add is called with insufficient arguments; it requires two parameters
but only one is passed.

[Link]. 8 [Mapped CO: CO4, BT Level: Apply


(BT-3)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
int arr[5];
arr[5] = 10;
return 0;
}

Error to be Identified:
Array index out of bounds: valid indices for arr[5] are 0 to 4, but arr[5] is
being accessed.

[Link]. 9 [Mapped CO: CO5, BT Level:


Evaluate (BT-5)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
char str[5] = "Hello";
printf("%s", str);
return 0;
}

Error to be Identified:
String literal "Hello" (needs 6 bytes including '\0') exceeds the array size
char str[5].
[Link]. 10 [Mapped CO: CO5, BT Level:
Evaluate (BT-5)]
Buggy Code Snippet:

#include <stdio.h>

int main() {
while (1) {
printf("Loop");
}
return 0;
}

Error to be Identified:
Infinite loop – while (1) has no terminating condition or break, causing the
program to run forever.

Summary Table – CO and BT


Mapping
[Link]. Buggy Error Type Mapped CO BT Level
Concept
Highlighted
1 Syntax – Missing CO1 Understand
printf, semicolon (BT-2)
statement
terminator
2 Standard I/O Missing CO1 Remember
usage header file (BT-1)
3 Conditional Assignment CO2 Analyze (BT-
statements, vs 4)
operators comparison
4 Loops (for), Semicolon CO3 Analyze (BT-
control flow ending loop 4)
5 Variables Uninitialized CO2 Understand
and memory variable (BT-2)
6 Function Invalid CO3 Analyze (BT-
type and return in 4)
return void function
7 Functions Insufficient CO4 Analyze (BT-
and arguments 4)
parameters
8 Arrays and Out-of- CO4 Apply (BT-3)
indexing bounds
access
9 Strings and String CO5 Evaluate
arrays longer than (BT-5)
array
10 Loop design Infinite loop CO5 Evaluate
and logic (BT-5)

You might also like