CBSE Class 12 · Computer Science, code 083 · One-mark questions

Class 12 computer science MCQ with answers: a 40-question test.

Forty class 12 computer science MCQs with answers, set by chapter in the manner of Section A, eight of them assertion and reason. Give yourself 50 minutes and a blank sheet. Each answer opens to the correct option written in full and the reason, because in the board paper the letter alone is not what the instructions ask for.

Live one to one · 40 original questions · outputs run, queries run · whichever day and hour suits

Start here

If one set of the test went badly

Match the course to the set with the fewest ticks. The first covers all six.

Ans. The short version

Class 12 computer science MCQs with answers are the quickest check of the CBSE 083 syllabus. In the 2026-27 sample paper, Section A has 21 one-mark questions: 15 MCQs, four short ones without options and two assertion and reason. This page is a test of 40 original questions, chapter wise, covering Python, functions, exceptions, files, stack, networks, SQL and connectivity, each with the correct option and a reason. Modern Age Coders goes through your wrong answers live, personalised one to one, on your own timing. A priority demo lets you try a full class first.

Q1. What does Section A look like?

How many MCQs come in the Class 12 Computer Science paper?

The 2026-27 sample paper has 15 MCQs, all in Section A, beside four one-mark questions without options and two of assertion and reason: 21 marks in all.

Section A, sample paper 2026-27Question numbersCount
MCQ, four options2 to 9, 11 to 13, 15 to 17, 1915
Write the output or answer, no options1, 10, 14, 184
Assertion and reason20, 212
One mark each, no internal choice21
By unitCount
Programming12
Database6
Networks3

That is one year's sample. The board paper follows the same five sections, but nobody outside the board knows its mix of MCQs.

Rules for this test

  • 50 minutes for 40, pen and paper, no Python open.
  • Write the option, not only its letter. The paper says the text of the correct answer should also be written.
  • Mark a guess with a dot. A correct guess is still a topic to revise.
  • Answer all. The sample paper's instructions mention no deduction for a wrong option.

Why the wrong option looks right

The setter's trickHow to see through itTry it in
The stop value includedSlices and range() end one early5, 6
Print mistaken for returnNo return means None10
NULL counted as zeroAggregates skip it28
Columns and rows multiplied alikeDegree adds, cardinality multiplies25
Half of a correct sentenceRead all four options to the end23, 24
Two true statementsPut because between them34, 37

Sets 1 and 2. Programming

Class 12 computer science MCQ chapter wise: Python and functions

Set 1 is the Class 11 Python that the board paper reuses. Set 2 is functions, scope and exception handling.

Set 1. Python revised (1 to 7)

  1. What is displayed?
    Q1Python
    print("level 9".title().swapcase())
    (a) LEVEL 9
    (b) Level 9
    (c) lEVEL 9
    (d) level 9
    Answer (c) lEVEL 9. title() gives Level 9, and swapcase() turns each letter to the other case. The digit has no case.
  2. What is displayed?
    Q2Python
    t = (4, [5, 6])
    t[1].append(7)
    print(t)
    (a) (4, [5, 6, 7])
    (b) (4, [5, 6], 7)
    (c) (4, [5, 6])
    (d) TypeError, since a tuple cannot change
    Answer (a) (4, [5, 6, 7]). The tuple still holds the same two objects. One of them is a list, and a list may change.
  3. What is displayed?
    Q3Python
    print(2 ** 3 ** 0 + 10 % 4 * 2)
    (a) 5
    (b) 6
    (c) 9
    (d) 3
    Answer (b) 6. Powers go from the right: 3 ** 0 is 1, so 2 ** 1 is 2. Then 10 % 4 is 2, times 2 is 4, and 2 + 4 is 6.
  4. What is displayed?
    Q4Python
    d = {"a": 1}
    d["b"] = d.get("c", 5)
    d.pop("a")
    print(d)
    (a) {'a': 1, 'b': 5}
    (b) {'b': None}
    (c) {'c': 5}
    (d) {'b': 5}
    Answer (d) {'b': 5}. get("c", 5) returns 5 and adds no key c. Then the key a is removed.
  5. What is displayed?
    Q5Python
    L = [1, 2, 3, 4, 5, 6]
    print(L[-2:1:-2])
    (a) [5, 3, 1]
    (b) [5, 3]
    (c) [2, 4]
    (d) [6, 4]
    Answer (b) [5, 3]. Index -2 is the 5. Stepping back by two gives indexes 4 and 2; index 1 is the stop and is not reached.
  6. Which output is not possible?
    Q6Python
    import random
    N = ["Rut", "Kol", "Sur", "Mad"]
    a = random.randint(0, 1)
    b = random.randrange(2, 4)
    for i in range(a, b):
        print(N[i], end="/")
    (a) Kol/
    (b) Rut/Kol/
    (c) Kol/Sur/
    (d) Kol/Sur/Mad/
    Answer (d) Kol/Sur/Mad/. b is 2 or 3, so i is at most 2 and Mad, at index 3, is never shown.
  7. What is displayed?
    Q7Python
    print(not 5 > 3 or 7 and 0)
    (a) 0
    (b) True
    (c) 7
    (d) False
    Answer (a) 0. not 5 > 3 is False. 7 and 0 gives 0. False or 0 gives the last value looked at, which is 0.

Set 2. Functions and exceptions (8 to 12)

  1. What is displayed?
    Q8Python
    def f(a, b=2, c=3):
        return a + b * c
    
    print(f(4, 1))
    (a) 10
    (b) 18
    (c) 7
    (d) 6
    Answer (c) 7. a is 4, b becomes 1 and c keeps 3, so 4 + 1 * 3 is 7.
  2. What is displayed?
    Q9Python
    x = 10
    def g():
        global x
        x += 5
        return x
    
    print(x, g(), x)
    (a) 15 15 15
    (b) 10 15 15
    (c) 10 15 10
    (d) 10 10 15
    Answer (b) 10 15 15. The three arguments are worked out from left to right: the first x is read before the call, the last one after it.
  3. What does the second print display?
    Q10Python
    def show(n):
        print(n * 2)
    
    r = show(4)
    print(r)
    (a) 8
    (b) None
    (c) Nothing at all
    (d) NameError
    Answer (b) None. The function prints 8 but has no return statement, so r is None.
  4. What is displayed?
    Q11Python
    try:
        print(int("7.5"))
    except ZeroDivisionError:
        print("Z")
    except ValueError:
        print("V")
    finally:
        print("F")
    (a) 7 and then F
    (b) V
    (c) Z and then F
    (d) V and then F
    Answer (d) V and then F. int() cannot convert the text 7.5, so ValueError is raised and caught, and finally always runs.
  5. A function starts def park(car, hours=1):. Which call raises TypeError?
    (a) park()
    (b) park("KA01")
    (c) park("KA01", 4)
    (d) park(5, 2)
    Answer (a) park(). car has no default, so a value must be given. The number 5 as a car is odd, but legal.

Two lines, then the options. For an output question cover the four options with your hand, write the value of each variable in two lines, and only then look. Students who read the options first tend to hunt for the one that feels familiar.

Less than four correct in either set? Go to output questions with traces or to the functions chapter.

Set 3. Files and stack

File handling and stack MCQs for Class 12 CS

Set 3 has six questions: modes, reading, the file pointer, pickle, CSV and one stack trace.

  1. Which mode fails with FileNotFoundError if the file does not exist?
    (a) a+
    (b) w+
    (c) r+
    (d) a
    Answer (c) r+. r+ reads and writes an existing file. The others create the file when it is missing.
  2. A file holds three lines: one, two, three. What is displayed?
    Q14Python
    f = open("nums.txt", "r")
    f.readline()
    print(len(f.readlines()))
    f.close()
    (a) 3
    (b) 2
    (c) 1
    (d) 0
    Answer (b) 2. The first line has been read already, so readlines() returns only the two that remain.
  3. A file holds EXAM2027. What is displayed?
    Q15Python
    f = open("code.txt", "r")
    f.seek(4)
    print(f.read(2), f.tell())
    f.close()
    (a) M2 6
    (b) 20 4
    (c) 20 6
    (d) 20 5
    Answer (c) 20 6. Position 4 is the first 2. Two characters are read, and the pointer moves to 6.
  1. All records of a binary file have been read and pickle.load() is called again. What happens?
    (a) It returns None
    (b) It starts again at the first record
    (c) It returns an empty list
    (d) EOFError is raised
    Answer (d) EOFError is raised. This is why load() is placed in a loop inside try, with except EOFError.
  2. Each row given by csv.reader() is
    (a) a list of strings
    (b) a tuple of strings
    (c) one string with commas
    (d) a dictionary
    Answer (a) a list of strings. Numbers arrive as strings too, so convert them before adding.
  3. What is displayed?
    Q18Python
    S = []
    S.append(3)
    S.append(8)
    S.append(S.pop() + S.pop())
    S.append(1)
    S.pop()
    print(S)
    (a) [3, 8]
    (b) [11]
    (c) [11, 1]
    (d) [3, 11]
    Answer (b) [11]. Both values are popped before the sum 11 is pushed. The 1 is pushed and popped.

The chapter pages are text files, CSV and binary files and stack.

Sets 4 and 5. Networks and database

Networking and SQL MCQs with answers

Set 4 is Unit 2, six questions. Set 5 is Unit 3, eight questions from keys to connectivity.

Set 4. Networks (19 to 24)

  1. A device reads the destination of incoming data and forwards it to one port only. It is a
    (a) hub
    (b) repeater
    (c) modem
    (d) switch
    Answer (d) switch. A hub would copy the data to every port.
  2. The files of a finished website have to be uploaded to the web server. The protocol made for this is
    (a) FTP
    (b) SMTP
    (c) POP3
    (d) VoIP
    Answer (a) FTP. FTP moves files. SMTP and POP3 handle mail, VoIP handles calls.
  3. In https://fees.example.in/july.html, the domain name is
    (a) https
    (b) july.html
    (c) fees.example.in
    (d) fees.example.in/july.html
    Answer (c) fees.example.in. The domain name names the site only. The whole text is the URL.
  4. The ATMs of one bank in eleven states are connected. The network is a
    (a) PAN
    (b) WAN
    (c) LAN
    (d) MAN
    Answer (b) WAN. A MAN stops at a city. Eleven states need a WAN.
  5. Which statement about packet switching is true?
    (a) One path is reserved for the whole message
    (b) Packets must arrive in the order they were sent
    (c) The line stays idle when nobody is sending
    (d) Packets of one message may take different routes
    Answer (d) Packets of one message may take different routes. The first and third describe circuit switching, and order is restored at the destination.
  6. Terminators are fitted in which topology, and why?
    (a) Star, to boost the signal
    (b) Bus, to absorb the signal at the ends of the cable
    (c) Tree, to join the switches
    (d) Star, to join two networks
    Answer (b) Bus, to absorb the signal at the ends of the cable. Without them the signal would return along the backbone.

Revise from computer networks for Class 12.

Set 5. Database and connectivity (25 to 32)

  1. T1 has 3 columns and 4 rows. T2 has 5 columns and 6 rows. The degree and cardinality of their Cartesian product are
    (a) 15 and 10
    (b) 8 and 10
    (c) 8 and 24
    (d) 15 and 24
    Answer (c) 8 and 24. Columns add, 3 + 5. Rows multiply, 4 x 6.
  2. Which command removes a table, its rows and its structure together?
    (a) DROP TABLE Stall;
    (b) DELETE FROM Stall;
    (c) ALTER TABLE Stall DROP;
    (d) UPDATE Stall SET NULL;
    Answer (a) DROP TABLE Stall;. DELETE FROM empties the table but leaves the structure in place.
  3. The column Name holds Neha, Anita, Veda and Geet. Which rows satisfy Name LIKE '_e%a'?
    (a) Neha only
    (b) Neha, Veda and Geet
    (c) Neha and Veda
    (d) All four
    Answer (c) Neha and Veda. One character, then e, then anything, ending in a. Geet ends in t, and Anita has n in second place.
  4. The column Price holds 10, NULL, 20 and 30. SELECT AVG(Price) gives
    (a) 15.0000
    (b) 20.0000
    (c) NULL
    (d) 60.0000
    Answer (b) 20.0000. NULL is skipped: 60 is divided by 3 values, not 4.
  5. Which order of clauses is correct?
    (a) WHERE, HAVING, GROUP BY, ORDER BY
    (b) GROUP BY, WHERE, HAVING, ORDER BY
    (c) WHERE, GROUP BY, ORDER BY, HAVING
    (d) WHERE, GROUP BY, HAVING, ORDER BY
    Answer (d) WHERE, GROUP BY, HAVING, ORDER BY. Choose rows, make groups, choose groups, then sort.
  6. A SELECT gave 3 rows. cur.fetchone() is called once and then cur.fetchall(). The second call returns
    (a) a list of 3 tuples
    (b) a list of 2 tuples
    (c) one tuple
    (d) None
    Answer (b) a list of 2 tuples. fetchall() returns the rows not yet fetched.
  7. ORDERS.CustId is a foreign key to CUSTOMER.CustId. A value in ORDERS.CustId
    (a) must be found in CUSTOMER.CustId, unless it is NULL
    (b) must not repeat in ORDERS
    (c) must be the first column of ORDERS
    (d) must be NULL in CUSTOMER
    Answer (a) must be found in CUSTOMER.CustId, unless it is NULL. A foreign key may repeat: one customer can place many orders.
  8. BOOK(Bid, Title) and LOAN(Lid, Bid, Day) are joined. How many columns appear with SELECT * in (i) an equi-join on Bid and (ii) a natural join?
    (a) 5 and 5
    (b) 4 and 5
    (c) 5 and 4
    (d) 4 and 4
    Answer (c) 5 and 4. The equi-join keeps both copies of Bid. The natural join shows the common column once.

Revise from SQL questions with results.

Set 6. Assertion and reason

Assertion reason questions, Class 12 Computer Science

Judge A alone, judge R alone, and only if both are true put the word because between them and listen.

OptionIn the words of the paperWhen to choose it
(a)Both A and R are True and R is the correct explanation for A"A because R" makes sense
(b)Both A and R are True and R is not the correct explanation for ATwo facts, no link
(c)A is True but R is FalseR has one wrong word
(d)A is False but R is TrueR often shows why A fails

One pair, four ways

Keep A fixed: "A list can be changed after it is made." Now change R. "A list is mutable" gives (a). "A list is written in square brackets" gives (b). "A list is immutable" gives (c). Make A "A string can be changed after it is made" with R "Strings are immutable", and you have (d). Writing four such sets on your own topic teaches more than answering forty.

  1. Assertion (A): A tuple of two strings can be a dictionary key.
    Reason (R): A key must be an immutable object, and such a tuple is immutable.
    Answer (a) Both A and R are True and R is the correct explanation for A. Because works between them: it can be a key because it is immutable.
  2. Assertion (A): The finally block runs even when no exception occurs.
    Reason (R): A try block may be followed by finally without any except.
    Answer (b) Both A and R are True and R is not the correct explanation for A. Both are facts about finally, but the second does not cause the first.
  3. Assertion (A): To add a record at the end of a binary file, it is opened in wb mode.
    Reason (R): Opening a file in wb mode erases its old contents.
    Answer (d) A is False but R is True. Adding needs ab. The reason is true, and shows why A is false.
  4. Assertion (A): readlines() returns a list of strings.
    Reason (R): readlines() removes the newline character from each line.
    Answer (c) A is True but R is False. Each string keeps its newline, except perhaps the last.
  5. Assertion (A): Calling pop() on an empty list raises IndexError.
    Reason (R): A stack works on the principle last in, first out.
    Answer (b) Both A and R are True and R is not the correct explanation for A. The order of removal is not why an empty list gives an error.
  6. Assertion (A): A switch causes less unneeded traffic than a hub.
    Reason (R): A switch sends data only to the port of the device it is meant for.
    Answer (a) Both A and R are True and R is the correct explanation for A. The reason is exactly how the traffic is reduced.
  7. Assertion (A): A table can have several primary keys.
    Reason (R): A table can have several candidate keys.
    Answer (d) A is False but R is True. One candidate is chosen as the primary key; the others become alternate keys.
  8. Assertion (A): SELECT * FROM A, B; gives the Cartesian product of A and B.
    Reason (R): It keeps only the rows whose common columns match.
    Answer (c) A is True but R is False. With no condition every row of A is paired with every row of B. Matching needs a join condition.

Q2. What does my score mean?

Class 12 CS MCQ online test: answer key and score

Count each set separately. The total tells you little, but the weakest set tells you what to study this week.

Answer key

No.12345678910
1 to 10cabdbdacbb
11 to 20dacbcdabda
21 to 30cbdbcacbdb
31 to 40acabdcbadc

Read along a row: the third letter in the row 21 to 30 is the answer to question 23.

By set

SetOut ofRevise if belowFirst thing to do
1. Python75Trace ten outputs on paper
2. Functions, exceptions54Write each function and call it twice
3. Files, stack64Try every mode on one small file
4. Networks65Say the job of nine devices aloud
5. Database86Type the queries, with a NULL in the table
6. Assertion, reason86Make four sets from one topic

The limits are our teaching guide, not a CBSE rule. Take the test again after ten days with the order of sets reversed.

In class, the key is hidden

You explain why three options are wrong. If you can, the fourth needs no luck.

In class, the number changes

Same code, new values. A remembered answer fails at once, an understood one does not.

In class, it becomes two marks

An MCQ on scope turns into "define and give an example", since Section B asks for the same ideas.

Longer answers come next: important questions by chapter, and a full Section A under time in our 2026-27 sample paper.

After the test, one to one

Find the idea behind each wrong option

An MCQ marked wrong says nothing about why. Was it the NULL, the slice, or only haste? With one teacher and one student, each wrong option is followed back to the idea that led there. We teach it no other way, and you settle the days and the timing. The priority demo gives you one complete lesson, its fee later set against your first month if you enrol; or choose the free demo class. You are billed monthly, there is no fee for admission, and any month end may be your last.

Before you enrol · Try a class

Priority demo, at a slot you pick

a full live class of about 45 to 60 minutes

  • Your sheet from this test, or ten questions taken live
  • Two wrong answers traced to the idea behind them
  • The same idea taught and asked again in a new form
  • A written skill report, set by set
Book a priority demo

The classes · Choose your own timing

Personalised one to one

₹4,999

per month, 4 private classes, fully flexible timing

  • Section A practised inside every chapter, not at the end
  • Outputs traced in writing before anything is run
  • Assertion and reason pairs written by you for the teacher to solve
  • Progress noted by set, so weak ones come back
Ask for a personalised plan

A student who scores 35 here needs a different month from one who scores 18, and the plan is made after seeing the sheet. The fee on this page is per month and in the currency of your country.

Studying outside India?

Section A, taught across time zones

If your CBSE school is in Al Ain, Doha, Riyadh or Singapore, Section A is the same 21 marks. Lessons fall in your own afternoon or evening.

Where you liveTime differenceUsual class window, local timeFormat
India
every Indian city
Indian timeAny time you choosePersonalised 1-on-1
UAE and Oman
Dubai, Abu Dhabi, Sharjah, Muscat
1 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Saudi Arabia, Qatar, Kuwait, Bahrain
Riyadh, Jeddah, Dammam, Doha, Kuwait City, Manama
2 h 30 min behind India3:00 PM to 9:00 PMPersonalised 1-on-1
Nepal
Kathmandu
15 min ahead of India4:30 PM to 9:00 PMPersonalised 1-on-1
Ethiopia and East Africa
Addis Ababa and East Africa Time
2 h 30 min behind India4:30 PM to 9:00 PMPersonalised 1-on-1
Singapore and Malaysia
Singapore, Kuala Lumpur
2 h 30 min ahead of India3:30 PM to 9:00 PMPersonalised 1-on-1

MCQ work travels well: short, spoken, and easy to fit into a half-free evening during term. Mention your last school test in the form.

What families say

Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the Class 12 series

More pages for Class 12 students

Every page in the CBSE Class 12 Computer Science series, grouped by what you need.

MCQ doubts

Class 12 computer science MCQ: questions and answers

How many MCQs are there in the Class 12 Computer Science board exam?

In the CBSE sample paper for 2026-27, Section A has 21 one-mark questions, of which 15 are MCQs with four options, four have no options and two are assertion and reason. The board paper keeps the same section, though its exact mix is known only on the day.

Where can I practise Class 12 computer science MCQs with answers?

On this page: 40 original questions in six sets, covering Python, functions, exceptions, files, stack, networks, SQL and assertion and reason. Each has its answer and a reason, and the outputs and queries were run before they were printed. The key is in one table at the end.

Do I have to write the full answer in MCQs in CBSE Class 12 CS?

Yes. The general instructions of the 2026-27 sample paper say that in an MCQ the text of the correct answer should also be written. Write the letter and the text of the option, and for a code option copy it exactly, with its brackets and quotes.

Is there negative marking in Class 12 Computer Science?

The sample paper and its marking scheme mention no negative marks. So attempt all 21 questions of Section A. If you have to guess, strike out the options you can prove wrong first, and put a small mark so that you return if time is left.

How do I solve assertion reason questions in computer science?

Read the assertion and decide true or false. Do the same for the reason, without linking them. If both are true, join them with the word because. If the sentence makes sense, choose (a); if not, (b). One wrong word in the reason makes it (c).

Which chapters have the most MCQs in Class 12 CS?

In Section A of the 2026-27 sample paper, 12 questions came from programming, six from databases and three from networks. That is close to the unit weights of 40, 20 and 10 marks, so prepare Python and SQL first and networks for quick, certain marks.

How much time should I give to Section A?

About 30 minutes for 21 questions is comfortable, leaving the rest of the three hours for programs, SQL and the network case. Do the definition and SQL items first, then the outputs, which need writing. Keep a few minutes at the end to check spaces and brackets.

Are MCQs enough to prepare for Class 12 Computer Science?

No. Section A is 21 of 70 marks, and the other sections ask you to write programs, queries and short explanations. Use MCQs to find weak ideas quickly, then write a program or query on each. Recognising an answer is easier than producing one.

Are these MCQs from previous year papers?

No, they are original questions written for this page in the style of Section A. Nothing is copied from a board paper, the sample paper or a book. For official questions use the sample papers and question papers published by CBSE.

Can you take my child through MCQs chapter by chapter?

Yes, one to one and at the time your family chooses. The teacher asks for the reason behind each option, so the weak chapter shows within a lesson. You can see a whole class first through the priority demo, or meet us in the free demo class.

Start

Send your six set scores

Six numbers are enough to begin. Book a priority demo with them, choose the slot, and the class opens with your weakest set: two wrong answers explained, the idea taught, fresh questions asked. The written skill report that follows is yours, and the demo fee counts towards month one if you join us.

Or ask for the free demo class. If networks was the low one, solve a drawn layout from the case study page before we meet.

WhatsApp us · +91 91233 66161 · connect@modernagecoders.com

Every class is live video. The form requests a callback and reserves nothing.

We call within a few hours. No card, no enrolment fee.

Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

Book a priority demo

Keep exploring Modern Age Coders

By class and age

Learn more

Free resources

From the blog

Start here