KwickCards Exams and revision
Exams and revision: 151 revision cards
Every card below is written out in full underneath its picture, so you can read it, search it and copy from it. Free, no sign-up.

QUICK QUIZ · PYTHON
Which of these is a mutable data type?
- tuple
- string
- list
- int
One-mark question. Can you answer in five seconds?
Answer: (C) list.
Lists can be changed in place: add, remove or modify elements without creating a new object. Tuples, strings and integers are immutable. Dictionaries and sets are also mutable. Keep a two-column table of mutable and immutable types in your notes; it answers several objective questions at once.
Save this post for revision and share it with a classmate preparing for the same exam.
![s = "PYTHON": what is s[1:-1:2]?](/images/learn/cards/A-027.webp)
QUICK QUIZ · SLICING
s = "PYTHON": what is s[1:-1:2]?
- P
- Y
- T
- H
- O
- N
Start at 1, stop before -1, take every 2nd
Slice with a start, a negative stop and a step.
Answer: YH.
Index 1 is Y. The stop -1 is N (excluded), so we look at Y, T, H, O and take every second one: Y and H. Mark indexes 0 to 5 and -6 to -1 under the word before solving any slicing question.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · FILE MODES
Which binary mode reads and writes without erasing the file?
- rb
- wb+
- rb+
- ab
File modes: small letters, big marks.
Answer: (C) rb+.
rb+ opens an existing binary file for both reading and writing without erasing it. rb is read only. wb+ also allows reading and writing, but erases the file first. ab only appends at the end. This distinction is useful when updating records stored with pickle.
Save this post for revision and share it with a classmate preparing for the same exam.
![L = [10,20,30,40]: what is L[-3:3]?](/images/learn/cards/A-029.webp)
QUICK QUIZ · LISTS
L = [10,20,30,40]: what is L[-3:3]?
- 10
- 20
- 30
- 40
Convert -3 to a positive index first
Negative start, positive stop. Stay calm.
Answer: [20, 30].
Index -3 is the same position as index 1 (value 20). The stop 3 is excluded. So we get positions 1 and 2: [20, 30]. Converting negative indexes to positive ones (len + index) makes these questions straightforward.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · ERRORS
Which exception does this code raise?
- IndexError
- KeyError
- NameError
- ValueError
d = {"x": 1}
print(d["y"])Match the error to the mistake.
Answer: (B) KeyError.
Accessing a missing dictionary key raises KeyError. IndexError is for list or tuple positions out of range, NameError for an undefined variable, and ValueError for a right type with a wrong value, like int('abc'). Knowing the built-in exceptions helps in both theory and output questions.
Save this post for revision and share it with a classmate preparing for the same exam.

CBSE CS · STACK
- LIFO
- Last In, First Out. The item pushed last onto a stack is the first one popped.
Usesundo, browser back button
The easiest mark in the data structures section.
A stack follows LIFO, Last In First Out. The element pushed last is popped first, like a stack of plates. A queue follows the opposite rule, FIFO. Real uses of stacks include undo operations, browser back history and reversing a string. Pair this definition with a push and pop program and you are covered.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · FUNCTIONS
Default argument overridden: what is the output?
- 9 8
- 6 6
- 9 9
- 8 9
def f(a, b=2):
return a ** b
print(f(3), f(2, 3))Default argument, then an override.
Answer: (A) 9 8.
f(3) uses b = 2, so 3 ** 2 = 9. f(2, 3) overrides the default, so 2 ** 3 = 8. The default value is used only when that argument is not passed. Watch the order of values in print carefully; option D is there to catch hurried readers.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · DICTIONARY
Reassign a key: add or replace?
What is printed?
d = {1: "a", 2: "b"}
d[1] = "z"
print(len(d), d[1])Assigning to an existing key: add or replace?
Answer: 2 z.
Dictionary keys are unique. Assigning to key 1 again replaces its value instead of adding a new pair, so the length stays 2 and d[1] is 'z'. A new key such as d[3] = 'c' would increase the length. Simple, yet often mixed up under exam pressure.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · FILES
Which method reads the whole file at once?
- readline()
- readlines()
- read()
- load()
Three read methods. Do you know the difference?
Answer: (C) read().
read() returns the entire content as a single string. readline() returns one line at a time, and readlines() returns a list of all lines. load() belongs to pickle for binary files. Choosing the right method makes counting words, lines or characters much simpler.
Save this post for revision and share it with a classmate preparing for the same exam.

PYTHON · LOOPS
Count the prints
How many numbers are printed?
for i in range(10, 0, -3):
print(i)Count the values, do not guess.
Answer: 4.
The loop prints 10, 7, 4 and 1. The next value, -2, crosses the stop value 0, so the loop ends. With a negative step, range counts down and stops before reaching the stop value. Listing the values explicitly takes ten seconds and avoids silly errors.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · STRINGS
Repeat and join strings
What are the two outputs?
print("ab" * 2 + "c")
print("3" + "4")String operators behave differently from number operators.
Answer: ababc, then 34.
* repeats a string, and + joins strings. '3' + '4' joins two strings to give '34', not 7. To add them as numbers, convert first: int('3') + int('4'). Mixing a string and an int with + raises TypeError, another favourite question.
Save this post for revision and share it with a classmate preparing for the same exam.

Exam Tips
csv module: four key functions
csv module
- reader()
- writer()
- writerow()
- writerows()
Know your modules for Unit I.
The csv module provides reader(), writer(), writerow() and writerows(). pickle handles binary files with dump() and load(), so do not mix the two. CSV files are plain text where values are separated by commas, which is why they open neatly in spreadsheet software. In IP, pd.read_csv() and to_csv() do the same job with Pandas.
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · CHARTS
Best chart to show how marks are distributed?
- Line chart
- Histogram
- Pie chart
- Scatter only
Choosing the right chart is a concept question, not a coding one.
Answer: (B) Histogram.
A histogram groups continuous data such as marks into bins (0-10, 10-20...) and shows how many values fall in each. Use plt.hist(data, bins=...). A line chart shows a trend over time, and a bar chart compares separate categories. Understanding when to use each earns easy marks.

PYTHON · SORTING
L.sort()
- Sorts L in place
- Returns None
sorted(L)
- Returns a new list
- L stays unchanged
sort() and sorted() are not the same thing.
L.sort() sorts the list in place and returns None, so print(L.sort()) prints None. sorted(L) returns a new sorted list and leaves the original alone. For example, with L = [3, 1, 2], L.sort() makes L [1, 2, 3], and sorted(L, reverse=True) gives a new list [3, 2, 1]. Never write L = L.sort().
Save this post for revision and share it with a classmate preparing for the same exam.

QUICK QUIZ · SCOPE
Local versus global: what is the output?
- 9 9
- 9 5
- 5 5
- Error
x = 5
def f():
x = 9
return x
print(f(), x)A local variable does not touch the global one.
Answer: (B) 9 5.
Inside f(), x = 9 creates a local variable, so f() returns 9 while the global x remains 5. To modify the global x, the function would need the global keyword. This LEGB idea (Local, Enclosing, Global, Built-in) explains how Python looks up names.
Save this post for revision and share it with a classmate preparing for the same exam.

CBSE CS CLASS 12
Unit I carries 40 of 70
70 theory marks
- Programming-2
- Database Mgmt
- Networks
Unit I carries 40 of the 70 theory marks in CBSE Class 12 Computer Science.
That makes it the unit where consistent practice pays most. Output questions test careful tracing, so never answer from memory. File handling programs follow patterns you can master: open, loop, process, close. Stack functions are short and predictable. Write every program by hand at least once, because the exam is on paper, not on a laptop. Kajal Ma'am's batches work through these patterns unit by unit with KwickAssignment practice.

PYTHON · BEGINNERS
Check these before you run
- == inside if, not =
- Colon after if, for, def
- No mixed tabs and spaces
- str() before joining a number
- Assign before you use
If your program refuses to run, check these five first.
Each one produces a specific error: SyntaxError for = in a condition or a missing colon, IndentationError or TabError for mixed indentation, TypeError for 'Marks: ' + 90, and NameError for using an undefined variable. Reading the last line of the error message tells you the type and line number. Learning to read errors calmly is a skill that saves time in practicals and viva.

CBSE IP CLASS 12
25 marks in Unit 1 Data Handling
Pandas is the backbone of it
IP Unit 1 carries 25 marks. These functions are its backbone.
Most Pandas questions in Class 12 IP revolve around creating a Series or DataFrame, selecting data, modifying it and moving it to or from CSV. Practise each function on a small DataFrame of student marks until you can predict the output without running it. Then add boolean filtering like df[df['Marks'] > 80]. KwickNotes summarise these with solved examples.

CBSE CS · FILE HANDLING
Three files, key functions
| File | Functions |
|---|---|
| Text | read/write |
| Pickle binary | dump/load |
| CSV | reader/writer |
| Any | seek/tell |
Always close(), or use a with block
Three file types, plus two functions that work on any file.
File handling questions usually ask you to write a function that reads a file and counts, searches or updates something. Knowing which functions belong to which file type prevents mixing them up, like using read() on a pickled binary file. seek(offset) moves the file pointer and tell() reports its position. Keep this list on your desk while solving previous papers.

PYTHON · LISTS
List methods to revise tonight
- append(): one item
- extend(): many
- insert(i, x)
- remove(x): 1st match
- pop(i): returns it
- sort(): in place
Six list methods, one quick revision.
Lists appear in almost every Class 11 Python paper. Remember that methods like append, extend, insert and sort change the list in place and return None. pop() returns the removed element, while remove() does not. Try each method in the Python shell once and note the output in your own words.

Exam Tips
Trace every variable, line by line
Output questions are not about speed. They are about method.
Output questions are not about speed. They are about method.
Students often know the concept yet lose marks on a missing space, a wrong bracket or an off-by-one loop. A simple tracing table removes that risk. List your variables across the top, move line by line, and write the output exactly as Python would print it, including brackets and quotes for lists of strings. Kajal Ma'am trains students on this habit from Class 11 itself.

CBSE IP · MATPLOTLIB
Plotting marks you never lose
- import matplotlib.pyplot as plt
- plot, bar or hist
- title(), xlabel(), ylabel()
- legend() for 2+ series
- show() or savefig()
A plotting question is often 3 to 4 marks. Do not leave any on the table.
Examiners usually check the import, the correct chart function, labels and the final show() call. If the question says 'save the chart', use savefig('name.png'). For multiple lines, pass label='...' to each plot() and then call legend(). Practise with simple data like weekly study hours or test scores until the structure becomes automatic.

Exam Tips
Errors you will meet in Python
Built-in errors
- ZeroDivisionError
- ValueError
- TypeError
- IndexError
- KeyError
- EOFError
Name the exception and you are halfway to handling it.
Exception handling questions often show a small code snippet and ask which error it raises or how to handle it. Link each exception to a real mistake, as in this list. EOFError deserves special attention in Class 12 because it is the standard way to stop reading records from a binary file with pickle.load() inside a while True loop.

PYTHON · STRINGS
String methods and what they return
| Method | Returns |
|---|---|
| find() miss | -1 |
| index() miss | ValueError |
| split() | a list |
| join() | a string |
| isdigit() | True/False |
Strings never change in place
Strings are everywhere in Python papers. So are these methods.
Remember that every string method returns a new value because strings are immutable. The find versus index difference is a common objective question. split() and join() work as a pair: ' '.join(s.split()) removes extra spaces between words. The is-methods are useful when counting letters, digits and spaces in a string or a text file.

CBSE CS CLASS 12
Practical is 30 of your 100
- Theory
- Practical
The practical carries 30 marks. Treat it with the same seriousness as theory.
Many students prepare the theory paper well and leave practicals for the last week. A strong practical score is very achievable with steady preparation: a complete file, confident program writing, and clear answers in the viva about how your project works. Kajal Ma'am guides students on practical files and project work along with theory in every batch.

CBSE IP · DATAFRAME
DataFrame moves for quick marks
- Add a column
- Filter rows
- rename(columns=)
- drop(axis=1)
Four DataFrame operations that appear year after year.
Each of these fits in a single line of code, which makes them ideal for short-answer questions. Pay attention to syntax details: axis=1 for columns in drop(), and the columns= keyword in rename(). Filtering rows uses a condition inside square brackets, such as df[df['Marks'] > 80]. Practise on a small marks DataFrame and write the expected result before printing it.

PYTHON · DICTIONARY
- d.get(k, default)
- Safe access: returns the default instead of raising KeyError. Pair it with keys(), values(), items().
Examplefor k, v in d.items():
Dictionaries store data as key-value pairs. Here is the toolkit.
Dictionary programs often ask you to count frequencies, store student records or search by key. Loop with for k, v in d.items() to get both key and value. Keys must be immutable (string, number, tuple), while values can be anything. Revise these methods with short examples and you will handle most dictionary questions comfortably.

Exam Tips
Functions: what examiners test
Do
- Defaults after non-defaults
- return a, b gives a tuple
Don't
- def f(a=1, b): SyntaxError
- Edit a global without global
Functions are the foundation of Class 12 Python.
Nearly every program you write for stacks and file handling is a function. Make sure you can explain each idea here with a two-line example. For instance, return a, b sends back the tuple (a, b). Default parameters must come after non-default ones. Short definitions with an example earn full marks more reliably than long paragraphs.

Exam Tips
One small program, every single day
Class 12 is easier when your Class 11 Python is solid.
Class 12 is much easier when Class 11 Python is solid.
Class 12 Computer Science builds directly on Class 11 programming: functions, file handling and stacks all assume you are comfortable with lists, strings, loops and dictionaries. Consistency beats marathon sessions. Fifteen focused minutes daily, with honest output prediction, builds real understanding. Kajal Ma'am has taught these foundations since 2006 and teaches every batch personally.

Exam Tips
Pickle programs: avoid these slips
Do
- Open with 'rb' or 'wb'
- load() inside a loop
- Catch EOFError
- 'ab' to add records
Don't
- Open with 'r' or 'w'
- Forget import pickle
Binary file programs are high-scoring once you avoid these slips.
Pickle stores Python objects in binary form, so modes must include 'b'. When the file contains several records, call pickle.load() inside a loop and catch EOFError to stop. To add new records without deleting old ones, open with 'ab'. To update a record, read all records, modify the right one and write them back. Practise each variation once.

Exam Tips
Pick the right chart
Pick the chart
- Line: trends
- Bar: categories
- Histogram: ranges
- Always label axes
The right chart makes data easy to read. The wrong one confuses.
Class 12 IP focuses on line charts, bar charts and histograms with Matplotlib. Case-based questions often describe a situation and ask which chart suits it, then ask for the code. A bar chart has gaps between bars for separate categories; a histogram has adjacent bars for continuous ranges. Know the difference and explain it in one line.

PYTHON · DATA TYPES
Immutable
- int, float, bool, str
- tuple
- Can be dict keys
Mutable
- list, dict, set
- Change in place
- Not dict keys
One concept that explains dozens of Python behaviours.
Why does a list change after a function call while an integer does not? Why can a tuple be a dictionary key but a list cannot? The answer to both is mutability. Use id() in the Python shell to see whether an operation creates a new object or modifies the existing one. Understanding this saves marks in theory and output questions alike.

LAST MONTH · PYTHON
Your 4-week revision plan
- Functions, scope, exceptions
- Text, binary, CSV files
- Stacks + output drills
- Timed sample papers
- Review mistakes notebook
A clear plan turns the final month into steady progress.

Exam Tips
Free tools on kwickprep.com
Practice doesn't have to wait for your next class.
Practice does not need to wait for your next class.
Kwickprep's website has free tools built for Computer Science and IP students. Test a snippet in the Python Playground, plan your target score with the Weightage Target Calculator, find an idea with the Project Topic Generator, and check your understanding with Quick Tests. Pair them with free sample papers for complete revision. Explore the Syllabus Explorer too.

PYTHON · RECURSION
Recursion rules that work
- Base case first
- Move closer each call
- Trust the smaller call
- Trace n = 3 on paper
Recursion feels tricky until you follow a few simple rules.
A recursive function solves a problem by calling itself on a smaller version of it. Factorial, sum of digits and Fibonacci are the usual examples. Missing or unreachable base cases lead to RecursionError. When tracing, write each call and its return value on separate lines, then combine them from the bottom up. That habit makes every recursion question manageable.

PYTHON · SEQUENCES
List [ ]
- Mutable
- append, sort, pop
- Not a dict key
Tuple ( )
- Immutable
- count(), index() only
- Can be a dict key
Both store ordered sequences. So when do you choose which?
Use a list when the data will change, such as a growing list of marks. Use a tuple for fixed data such as days of the week or coordinates. Tuples protect data from accidental changes and can be used as dictionary keys. Both support indexing, slicing, len() and loops. Remember the single-element tuple needs a comma: (5,).

CBSE CS · FILES
Text file vs binary file
| Text | Binary | |
|---|---|---|
| Readable | Yes | No |
| Modes | r w a | rb wb ab |
| Functions | read/write | dump/load |
| Example | notes.txt | records.dat |
A very common 2-mark 'differentiate' question.
Text files store data as readable characters and can be opened in any text editor. Binary files store data in byte form, which in Class 12 means Python objects saved with pickle. Binary files are useful for storing structured records like dictionaries or lists exactly as they are. Write three clear points of difference with one example each for full marks.

CBSE IP · PANDAS
A Series is one labelled column
- 10
- 20
- 30
A DataFrame is many Series sharing one index
Start with the Series. The DataFrame is built from it.
A Series holds one column of data with labels, like 10, 20 and 30 at positions 0, 1 and 2. A DataFrame holds a whole table where every column is a Series sharing the same index. Selecting one column from a DataFrame with df['Marks'] gives you a Series. Learn creation from lists, dictionaries and ndarrays for both.
Save this post for revision and share it with a classmate preparing for the same exam.

CBSE IP · PANDAS
loc[]
- Selects by label
- Slice end included
iloc[]
- Selects by position
- Slice end excluded
Mix these up and your output will be one row off.
loc uses the actual row and column labels, and label slices include the end. iloc uses positions, just like Python list slicing, so the end is excluded. When the index labels are 0, 1, 2 and so on, both may appear similar, but slicing still differs. Practise each with a DataFrame whose index labels are names, not numbers.

PYTHON · DATA TYPES
- Mutable object
- Its value can change in place and keep the same id(). list, dict and set are mutable.
ExampleL.append(2) keeps id(L)
This single idea explains why some variables change and others do not.
Try this in the Python shell: L = [1]; print(id(L)); L.append(2); print(id(L)) shows the same id. Then s = 'a'; print(id(s)); s += 'b'; print(id(s)) shows a different id. That is mutability made visible. It matters when passing values to functions and when choosing dictionary keys.
Save this post for revision and share it with a classmate preparing for the same exam.
Written by Kajal Mehta (Kajal Ma'am), MCA, teaching computer subjects since 2004. All KwickCards

