Linear search comparisons: Class 11 practice
Linear search checks elements one by one from the start. The quick answer and an example come first; then the method, worked examples and six graded questions.
Linear search comparisons: quick answer
Linear search checks elements one by one from the start. Finding the item at position k (1-based) takes k comparisons; an absent item takes n comparisons.
Example: Linear search for 28 in [12, 80, 44, 28, 14, 51, 17, 68]. How many comparisons are made? Answer: 4.
- Where it is taught: "Searching", Class 11 Computer Science.
- On this page: the method, 3 worked examples and 6 graded questions with a full answer key.
How to use this page (about 30 minutes)
- Read the method once, then cover the worked examples and try them yourself before reading the steps.
- Do the two Basic questions without notes. If either is wrong, re-read the matching worked example.
- Do the Standard and Challenge questions, then check every line of working against the answer key — not only the final answer.
- Write down the mistake behind each wrong answer and redo that question the next day.
What you should know first
- Lists
The idea behind linear search comparisons
Linear search checks elements one by one from the start. Finding the item at position k (1-based) takes k comparisons; an absent item takes n comparisons.
Step-by-step method
- Start at index 0.
- Compare each element with the target.
- Stop when found or at the end of the list.
Worked example 1 (Basic)
Linear search for 28 in [12, 80, 44, 28, 14, 51, 17, 68]. How many comparisons are made?
- First match at index 3
- 4 comparisons
- Answer: 4
Worked example 2 (Standard)
Linear search for 54 in [22, 52, 13, 29, 55, 40, 23, 54, 23, 59]. How many comparisons are made?
- First match at index 7
- 8 comparisons
- Answer: 8
Worked example 3 (Challenge)
Linear search for 41 in [41, 70, 23, 71, 26, 52, 84, 44, 46, 91, 52, 39]. How many comparisons are made?
- First match at index 0
- 1 comparisons
- Answer: 1
Common mistakes and misconceptions
- Counting from 0 when asked for the number of comparisons
- Stopping early for an absent item
Practice questions
- (Basic) Linear search for 46 in [46, 31, 93, 18, 54, 73, 31, 53]. How many comparisons are made?
- (Basic) Linear search for 20 in [30, 20, 93, 26, 54, 81, 96, 55]. How many comparisons are made?
- (Standard) Linear search for 32 in [35, 45, 40, 25, 73, 71, 16, 33, 32, 50]. How many comparisons are made?
- (Standard) Linear search for 89 in [15, 22, 89, 63, 68, 37, 63, 38, 81, 88]. How many comparisons are made?
- (Challenge) Linear search for 94 in [94, 32, 37, 20, 94, 37, 28, 82, 76, 20, 45, 41]. How many comparisons are made?
- (Challenge) Linear search for 45 in [61, 73, 45, 97, 44, 13, 91, 29, 23, 66, 53, 29]. How many comparisons are made?
Answer key with full working
- Q1: First match at index 0 → 1 comparisons → Answer: 1
- Q2: First match at index 1 → 2 comparisons → Answer: 2
- Q3: First match at index 8 → 9 comparisons → Answer: 9
- Q4: First match at index 2 → 3 comparisons → Answer: 3
- Q5: First match at index 0 → 1 comparisons → Answer: 1
- Q6: First match at index 2 → 3 comparisons → Answer: 3
Which textbook this practice follows
This skill is taught under "Searching" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Still stuck after the answer key?
If the same step in linear search comparisons keeps going wrong, a short live 1 on 1 class can find the exact gap. The first demo class is free; send the class, board and chapter on WhatsApp (+91 9379416374).
Related practice and notes
More Class 11 Computer Science practice
Continue with this syllabus
Frequently asked questions
Which chapter is linear search comparisons in?
This skill is taught under "Searching" in Class 11 Computer Science. Check your own textbook's contents page — CBSE, ICSE/ISC and state boards order chapters differently.
Which question should I start with?
Start with the Basic questions. Move to Standard only when both Basic answers match the key with the same working; the Challenge questions combine this skill with earlier ones.
How were the answers checked?
Answers on this page are generated and automatically re-checked by a second, independent calculation. They have not been reviewed by a teacher — if you spot a problem, tell us on WhatsApp.
Is this only for CBSE?
The skill names follow NCERT/CBSE, but the method is the same for ICSE, state boards, IGCSE and IB. Only the chapter name and order differ.
Can I get live help with this topic?
Yes. RG's E-Learning teaches live 1 on 1 online classes; the first demo class is free and fees are shared after it.