Worksheetsdebbuging
Total questions: 36
Worksheet time: 12mins
Which attribute is MOST important for accessibility?
A)alt
B)id
C)title
D)style
Which attribute is MOST important for accessibility?
A)alt
B)id
C)title
D)style
Output?
x = [1,2,3]
print(x.pop() + x.pop())
A)3
B)5
C)4
D)Error
Which bug disappears when debug mode is enabled?
A) Race bug
B) Heisenbug
C) Logic bug
D) Syntax bug
Error type?
print(int("1.5"))
A) SyntaxError
B) RuntimeWarning
C) TypeError
D) ValueError
Which HTML tag improves SEO the most?
A) <article>
B) <div>
C) <b>
D) <iframe>
What happens?
int *p;
printf("%d", *p);
A) Prints random value
B) Undefined compile
C) 0
D) Segmentation fault
Which debugging method shows variable history?
A) Renaming variables
B) Print debugging
C) Watch expressions
D) Indenting code
Output?
print([] is [])
A) True
B) Error
C) Depends
D) False
Which error compiler detects?
A) Runtime
B) Input
C) Syntax
D) Logical
Output?
x = 5
y = x > 3 and x < 10 or 0
print(y)
A) 5
B) True
C) 0
D) False
Which HTML tag is NOT self-closing?
A) <img>
B) <br>
C) <meta>
D) <div>
What happens?
int i = 0;
printf("%d %d", i++, ++i);
A) 1 2
B) 0 1
C) 1 1
D) Undefined behavior
Memory leak occurs when:
A) Wrong print
B) Missing header
C) Code is too long
D) Memory allocated but not freed
Output?
a = [0, 1, 2]
b = a[:]
b[0] = 10
print(a[0])
A) Error
B) 10
C) 0
D) None
What does <meta charset="UTF-8"> do?
A) Sets text encoding
B) Adds heading
C) Loads scripts
D) Adds styling
Which bug appears only on large inputs?
A) Semantic
B) Indentation bug
C) Performance bug
D) Syntax
Error type?
d = {"a":1}
print(d["b"])
A) NameError
B) ValueError
C) KeyError
D) SyntaxError
Which error stops program immediately?
A) Logic
B) Print
C) Warning
D) Runtime crash
Output?
x = (1,2,3)
try:
x[0] = 10
except Exception as e:
print(type(e).__name__)
A) ValueError
B) TypeError
C) No error
D) IndexError
Which HTML tag is semantic?
A) <span>
B) <font>
C) <section>
D) <div>
When a program freezes suddenly, most likely cause?
A) Compiler issue
B) Import missing
C) Print error
D) Deadlock / infinite loop
Output?
x = 1
def fun():
return x
x = 2
print(fun())
A) Error
B) None
C) 2
D) 1
Which causes unpredictable behavior?
A) Memory corruption
B) Comments
C) Missing return
D) Dead code
Error type?
for i in "123":
i += 1
A) RuntimeError
B) SyntaxError
C) Logical error
D) TypeError
Which debugging step helps track code flow?
A) Running
B) Assembling
C) Tracing
D) Compilation
Output?
printf("%d", sizeof("ABC"));
A) 1
B) 3
C) Depends
D) 4
Which debugging method is BEST to isolate a bug?
A) Remove loops
B) Create minimal reproducible example
C) Add comments
D) Rewrite full code
Output?
x = [1]
def f(y):
y = y + [2]
f(x)
print(x)
A) [1, 2]
B) Error
C) [1]
D) [1, [2]]
Which error is FileNotFoundError?
A) Syntax error
B) Logic error
C) Runtime error
D) None
Output?
x = 10
def f():
x = x + 1
return x
print(f())
A) 11
B) 10
C) None
D) Error (UnboundLocalError)
Which bug appears due to loop boundary mistakes?
A) Off-by-one error
B) Import error
C) Syntax error
D) Input error
What happens?
char s[] = "Hi";
char *p = s;
p[5] = 'X';
A) Compilation error
B) X added
C) Undefined behavior
D) Prints Hi
Debugger cannot:
A) Step into functions
B) Inspect variables
C) Pause execution
D) Fix logic automatically
Race condition occurs in:
A) HTML pages
B) Multi-thread programs
C) Single-thread programs
D) Compilers
Which error is hardest to detect?
A) Syntax
B) Import
C) Type
D) Logical
