Sample paper · Class 12 · CBSE · Science Computer Science
Computer Science · Sample Paper 3
CBSE board pattern (083), Class 12 syllabus — all chapters, a fresh set of questions. Programming language: Python; queries in SQL.
37 questions · 70 marks · 180 minutes
General instructions
- This paper has 37 questions in five sections, A to E. All questions are compulsory.
- Section A — Q1 to Q21: 1 mark each.
- Section B — Q22 to Q28: 2 marks each.
- Section C — Q29 to Q31: 3 marks each.
- Section D — Q32 to Q35: 4 marks each.
- Section E — Q36 and Q37: 5 marks each.
- Internal choice is given in Q23, Q29, Q34 and Q37. Answer only one alternative.
- All programming questions are to be answered in Python; queries in SQL (MySQL).
Section A · Objective
Questions 1–21 carry 1 mark each.
- Question 11 mark
Software used to create and manage databases is a
- A.DBMS
- B.compiler
- C.browser
- D.spreadsheet
- Question 21 mark
A key that can uniquely identify rows but is not chosen as the primary key is an
- A.alternate key
- B.foreign key
- C.composite key
- D.super key only
- Question 31 mark
Which of these has the worst-case time complexity O(n²)?
- A.binary search
- B.linear search
- C.bubble sort
- D.accessing a list element
- Question 41 mark
Which exception is raised when dividing by zero?
- A.ValueError
- B.ZeroDivisionError
- C.TypeError
- D.IndexError
- Question 51 mark
The else block in try–except runs when
- A.an exception occurs
- B.no exception occurs
- C.always
- D.never
- Question 61 mark
Which mode opens a file for reading and writing without truncating it?
- A.'w+'
- B.'r+'
- C.'a'
- D.'x'
- Question 71 mark
Which function writes a Python object to a binary file?
- A.pickle.load()
- B.pickle.dump()
- C.write()
- D.csv.writer()
- Question 81 mark
Removing the top element of a stack is called
- A.push
- B.pop
- C.peek
- D.enqueue
- Question 91 mark
The infix form of the postfix expression 'A B C * +' is
- A.(A + B) * C
- B.A + B * C
- C.A * B + C
- D.A + (B + C)
- Question 101 mark
Inserting an element into a queue is called
- A.push
- B.enqueue
- C.dequeue
- D.pop
- Question 111 mark
After the first pass of bubble sort (ascending) on [5, 1, 4, 2], the list is
- A.[1, 4, 2, 5]
- B.[1, 5, 4, 2]
- C.[1, 2, 4, 5]
- D.[5, 4, 2, 1]
- Question 121 mark
The maximum number of comparisons in binary search on 16 sorted elements is about
- A.4–5
- B.8
- C.16
- D.2
- Question 131 mark
Data that can be stored in rows and columns is called
- A.unstructured data
- B.structured data
- C.metadata
- D.big data only
- Question 141 mark
Which constraint ensures a column cannot have NULL values?
- A.UNIQUE
- B.NOT NULL
- C.DEFAULT
- D.CHECK
- Question 151 mark
SELECT DISTINCT city FROM customer; returns
- A.all cities with repeats
- B.each city only once
- C.the number of cities
- D.an error
- Question 161 mark
Which device connects a computer to the internet over telephone lines by modulating signals?
- A.router
- B.modem
- C.hub
- D.switch
- Question 171 mark
A network of computers within a building is a
- A.WAN
- B.MAN
- C.LAN
- D.PAN
- Question 181 mark
Which protocol is used to transfer web pages?
- A.SMTP
- B.HTTP
- C.FTP
- D.POP3
- Question 191 mark
Unauthorised access to a computer system is
- A.hacking
- B.browsing
- C.backup
- D.encryption
- Question 201 mark
Assertion (A): Insertion sort is efficient for nearly sorted lists.
Reason (R): In a nearly sorted list, few elements need to be shifted.
- A.Both Assertion (A) and Reason (R) are true, and R is the correct explanation of A.
- B.Both Assertion (A) and Reason (R) are true, but R is not the correct explanation of A.
- C.Assertion (A) is true, but Reason (R) is false.
- D.Assertion (A) is false, but Reason (R) is true.
- Question 211 mark
Assertion (A): A switch is more efficient than a hub.
Reason (R): A switch sends data only to the intended device, while a hub broadcasts to all.
- A.Both Assertion (A) and Reason (R) are true, and R is the correct explanation of A.
- B.Both Assertion (A) and Reason (R) are true, but R is not the correct explanation of A.
- C.Assertion (A) is true, but Reason (R) is false.
- D.Assertion (A) is false, but Reason (R) is true.
Section B · Very short answer
Questions 22–28 carry 2 marks each.
- Question 222 marks
What is meant by the degree and cardinality of a relation? Give an example.
- Question 232 marks
Write the output:
try: x = int('12a') except ValueError: print('Invalid') finally: print('End') OR
Question 232 marksWhat is the purpose of the finally block? Give one situation where it is useful.
- Question 242 marks
Write a function
display_long()that displays the lines ofpoem.txtthat have more than 30 characters. - Question 252 marks
Convert the infix expression (A + B) * (C − D) to postfix, showing the stack steps briefly.
- Question 262 marks
Differentiate between CHAR and VARCHAR data types in SQL.
- Question 272 marks
Expand: (i) TCP/IP (ii) VoIP (iii) HTML (iv) LAN.
- Question 282 marks
What is two-factor authentication? Give an example.
Section C · Short answer
Questions 29–31 carry 3 marks each.
- Question 293 marks
Write functions
enqueue(q, item)anddequeue(q)for a queue implemented as a list; dequeue should print 'Underflow' if the queue is empty. OR
Question 293 marksShow the steps of binary search for 23 in [4, 8, 15, 16, 23, 42, 50].
- Question 303 marks
Write a program to read
students.csv(columns: roll, name, marks) and print the names of students who scored above 90. - Question 313 marks
Distinguish between guided and unguided transmission media with two examples of each.
Section D · Long answer
Questions 32–35 carry 4 marks each.
- Question 324 marks
Consider the table STUDENT:
| RollNo | Name | Class | Marks | City | |---|---|---|---|---| | 1 | Asha | 12 | 88 | Delhi | | 2 | Ravi | 11 | 72 | Pune | | 3 | Meena | 12 | 95 | Delhi | | 4 | Arjun | 12 | 65 | Mumbai |
Write SQL queries to:
(i) display the names of students from Delhi, (ii) display the average marks of class 12 students, (iii) display the details of students whose name starts with 'A', (iv) display the number of students in each city.
- Question 334 marks
Write a program that copies only those lines from
source.txttotarget.txtwhich do not start with the character '#'. - Question 344 marks
Write a Python program using mysql.connector to display all records from the table EMP of database
officewhere salary is greater than 50000. OR
Question 344 marksDifferentiate between DELETE and DROP commands, and between ALTER and UPDATE commands, with examples.
- Question 354 marks
Explain the star, bus, ring and tree topologies with one advantage of each.
Section E · Long answer
Questions 36 and 37 carry 5 marks each.
- Question 365 marks
Case study — School campus network. A school in Jaipur has four blocks: ADMIN, SCIENCE, JUNIOR and SPORTS. Distances: ADMIN–SCIENCE 80 m, ADMIN–JUNIOR 150 m, ADMIN–SPORTS 120 m, SCIENCE–JUNIOR 60 m, SCIENCE–SPORTS 90 m, JUNIOR–SPORTS 70 m. Computers: ADMIN 30, SCIENCE 80, JUNIOR 40, SPORTS 10.
(i) Suggest the best block for the server, with a reason. (1 mark)
(ii) Suggest a cable layout to connect the blocks. (1 mark)
(iii) Which device should be used to connect computers within each block? (1 mark)
(iv) The school wants to connect to its branch in another city. What type of network is this? (1 mark)
(v) Suggest a cost-effective way to provide internet in the SPORTS block, which is far from others. (1 mark)
- Question 375 marks
Write a program that uses a stack to reverse a string entered by the user, and then checks whether the string is a palindrome.
OR
Question 375 marksWrite a menu-driven program to (1) add a record [itemno, name, price] to the binary file
items.dat, (2) display all records, (3) search for an item by item number.
Ready to attempt this paper?
Take it as a timed test of 180 minutes. Your answers are saved as you go and every answer is marked when you submit.
You'll be asked to log in or sign up first if needed.