CBSE Class 12 Computer Science Multiple Choice Questions, with Answers
10 practice questions for CBSE Class 12 Computer Science. Every question whose answer is the output of a program was run before publishing, so the answer is what the code really prints — not what it looks like it should.
s = [1, 2, 3] s.append([4, 5]) print(len(s))
- 3
- 4
- 5
- Error
Show the answer
append() adds the whole list as ONE element, so the length becomes 4. extend() would have made it 5.
t = (1, 2, 3) print(t[-1] + t[0])
- 2
- 3
- 4
- Error
Show the answer
t[-1] is the last element, 3, and t[0] is 1.
d = {'a': 1, 'b': 2}
print(d.get('c', 0) + d['a'])- 0
- 1
- 2
- KeyError
Show the answer
get() returns the default 0 for a missing key instead of raising KeyError.
def f(x, lst=[]):
lst.append(x)
return lst
print(f(1))
print(f(2))- [1] then [2]
- [1] then [1, 2]
- [1, 2] then [1, 2]
- Error
Show the answer
A mutable default argument is created once and reused on every call. This is a classic trap: use None as the default instead.
st = []
for i in range(1, 4):
st.append(i * i)
print(st.pop(), st)- 9 [1, 4]
- 1 [4, 9]
- 9 [1, 4, 9]
- Error
Show the answer
pop() removes and returns the top of the stack, which is the last item.
print('Kwickprep'[2:5])- ick
- ickp
- wic
- ckp
Show the answer
Slicing starts at index 2 and stops before index 5.
- WHERE
- HAVING
- ORDER BY
- GROUP BY
Show the answer
WHERE filters rows before grouping. HAVING filters the groups afterwards, so it can use aggregate functions.
- True
- False
Show the answer
A primary key must uniquely identify every row, so it can be neither NULL nor duplicated.
- r
- a
- w
- r+
Show the answer
w truncates the file to zero length before writing. a appends instead.
- overflow
- underflow
- traversal
- overwrite
Show the answer
Underflow is removing from empty; overflow is adding to a full fixed-size stack.
Want the full set?
More questions, the practical file format and the topics examiners come back to — sent on WhatsApp.
Get it on WhatsApp Book a free demo classPlease read: these are practice questions written by Kwickprep to help you revise. They are not past examination papers and not a CBSE publication. Questions asked in your school’s viva or examination may differ, and the syllabus can change between sessions — the board’s own document at cbseacademic.nic.in is always the final word. Tell us if you spot a mistake and we will correct it.

