1. Home
  2. /
  3. CBSE
  4. /
  5. Class 12
  6. /
  7. Computer Science
  8. /
  9. CBSE Sample Papers Class...

CBSE Sample Papers Class 12 Computer Science 2025

myCBSEguide App

myCBSEguide App

Download the app to get CBSE Sample Papers 2024-25, NCERT Solutions (Revised), Most Important Questions, Previous Year Question Bank, Mock Tests, and Detailed Notes.

Install Now

CBSE Sample Papers Class 12 Computer Science 2025

We recommend students to check out the Class 12 Computer Science model question papers 2024-25 on the myCBSEguide app for thorough exam preparation. CBSE Sample Papers for Class 12 Computer Science 2025 are now available for free download on both the official CBSE website and the myCBSEguide app. These sample papers provide a clear insight into the exam pattern and structure. The Class 12 Computer Science Sample Papers 2025 mainly feature subjective questions, with only 16 MCQs and 2 Assertion-Reason (ARQs) questions. For teachers, the Examin8 App is a perfect tool to create customized test papers with your name and logoCBSE Sample Papers Class 12 Computer Science 2025 are now available on the myCBSEguide Website, offering students the opportunity to practice real exam questions in PDF format.

Sample Papers of Computer Science class 12 – free PDF Download

CBSE Sample Papers for Class 12 Computer Science 2025 are now available for free download in PDF format on the myCBSEguide app and website. These sample papers are designed to help students get a clear understanding of the CBSE exam pattern and prepare efficiently for their Class 12 Computer Science board exams. Along with the sample papers, CBSE marking scheme and blueprint are also provided, helping students learn how to approach the exam effectively. For effective revision, download the CBSE Sample Papers Class 12 Computer Science 2025 to understand the exam format and marking scheme before the board exams.

Sample Papers for Class 12 Computer Science 2025 Download as PDF

Sample paper 2025 class 12 Computer Science

myCBSEguide offers CBSE Class 12 Board Sample Papers for Computer Science 2025 with solutions available for free download in PDF format. In addition to Computer SciencemyCBSEguide provides sample papers for all major CBSE Class 12 subjects, making it a one-stop platform for comprehensive exam preparation. These Class 12 Computer Science sample papers are based on the most recent syllabus and are designed to help students understand the question format, time management, and marking scheme. You can easily access these sample papers with solutions for the 2025 academic session through the myCBSEguide app or by logging into your Student Dashboard. The platform provides sample papers for Class 12 Computer Science as well as other subjects for the year 2025.

Key Features of CBSE Class 12 Computer Science Sample Papers 2025:

  • Free PDF downloads with detailed solutions.
  • Updated sample papers based on the CBSE blueprint for 2025.
  • Available for all major subjects, including Computer Science.
  • Student Dashboard access for easy downloading and tracking progress.

CBSE Class 12 Computer Science Sample Paper 2024

CBSE Sample Papers Class 12 Computer Science 2025

Class 12 – Computer Science
Sample Paper – 01 (2024-25)


Maximum Marks: 70
Time Allowed: : 3 hours


General Instructions:

  • ​​​​​​This question paper contains 37 questions.
  • All questions are compulsory. However, internal choices have been provided in some questions. Attempt only one of the choices in such questions.
  • The paper is divided into 5 Sections- A, B, C, D and E.
  • Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
  • Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
  • Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
  • Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
  • Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
  • All programming questions are to be answered using Python Language only.
  • In case of MCQ, text of the correct answer should also be written.

  1. Section A
  2. State true or false:
    In a nested loop, a break statement terminates all the nested loops in one go.

    a) True
    b) False
  3. A relational database consists of a collection of:
    a) Fields
    b) Keys
    c) Records
    d) Tables
  4. fetchall() method fetches all rows in a result set and returns a:
    a) Tuple of strings
    b) Tuple of lists
    c) List of tuples
    d) List of strings
  5. What is the output of the below program?
    def printMax(a, b):
    if a > b:
    print(a, ‘is maximum’)
    elif a = b:
    print(a, ‘is equal to’, b)
    else:
    print(b, ‘is maximum’)
    printMax(3, 4)

    a) 3 is maximum
    b) 4
    c) 4 is maximum
    d) 3
  6. What is the output of the following?
    d = {0, 1, 2}
    for x in d.values() :
    print (x)
  7. Which type of transmission media is the least expensive to manufacture?
    a) Twisted pair cable
    b) CAT cable
    c) Coaxial
    d) Fibre optic
  8. Which character is used to create a new file in csv?
    a) x
    b) r
    c) r+
    d) w
  9. l1 = [1,2,3,4,5] l1.append([5,6,[7,8,[9,10])
    What will be the final length of l1?

    a) 10
    b) 5
    c) 8
    d) Error
  10. The HAVING clause does which of the following?
    a) Acts like a WHERE clause but is used for columns rather than groups.
    b) Acts like a WHERE clause but is used for rows rather than columns.
    c) Acts like a WHERE clause but is used for groups rather than rows.
    d) Acts EXACTLY like a WHERE clause.
  11. Write a line of code that writes “Hello world!” to a file opened with file object my file.
  12. State true or false:
    The default values for parameters are considered only if no value is provided for that parameter in the function call statement.

    a) True
    b) False
  13. When a stack, implemented as an array/list of fixed size, is full and no new element can be accommodated, it is called an ________.
    a) OVERFLOW
    b) NOFLOW
    c) EXTRAFLOW
    d) UNDERFLOW
  14. In SQL, write the name of the aggregate function which will display the cardinality of a table.
  15. A ________ is a network spread across states, countries or whole world.
    a) PAN
    b) LAN
    c) WAN
    d) MAN
  16. What is  the output of following code ?
    def f():
    x = (2856 / 156) % 89
    print(x++)
    x* = 34
    f()

    a) 19
    b) 18
    c) 646
    d) Error
  17. Which of the following is not a sequential datatype in Python?
    a) List
    b) Dictionary
    c) Tuple
    d) String
  18. Which transmission media is capable of having a much higher bandwidth (data capacity)?
    a) Untwisted cable
    b) Twisted pair cable
    c) Fibre optic
    d) Coaxial
  19. Which part of TCP/IP is responsible for dividing a file or message into very small parts, at the source computer?
    a) ISP
    b) Both TCP and IP
    c) TCP
    d) IP
  20. Assertion (A): The tuple items cannot be deleted by using the del keyword.
    Reason (R): To delete an entire tuple, we can use the del keyword with the tuple name.

    a) Both A and R are true and R is the correct explanation of A.
    b) Both A and R are true but R is not the correct explanation of A.
    c) A is true but R is false.
    d) A is false but R is true.
  21. Assertion (A): pandas is defined as an open-source library that is built on top of the NumPy library.
    Reason (R): pandas provides fast analysis, data cleaning, and preparation of the data for the user.

    a) Both A and R are true and R is the correct explanation of A.
    b) Both A and R are true but R is not the correct explanation of A.
    c) A is true but R is false.
    d) A is false but R is true.
  22. Assertion (A): If you try to change the value of a frozenset item this will cause an error.
    Reason (R): The frozenset() function returns an changeable frozenset object

    a) Both A and R are true and R is the correct explanation of A.
    b) Both A and R are true but R is not the correct explanation of A.
    c) A is true but R is false.
    d) A is false but R is true.
    To practice more questions & prepare well for exams, download myCBSEguide.com App. It provides complete study material for CBSE, NCERT, JEE (main), NEET-UG and NDA exams. Teachers can use Examin8.com App to create similar papers with their own name and logo. The Class 12 Computer Science Sample Papers 2025 available on myCBSEguide are based on the latest syllabus issued by the CBSE board. With questions and solutions in each sample paper, you’ll have everything you need to perform well in the CBSE Class 12 Computer Science exam.
  23. Section B
  24. Write Python code to create a table location with the following fields
    idid of the location
    bidycodecode of the building
    roomtype of rooms
    capacitycapacity of the room
  25. Observe the given list and find the answer of questions that follows.
    list1 = [23, 45, 63, ‘Hello’, 20 ‘World’, 15, 18]
    1. list1 [-3]
    2. list[3]

    OR

    Draw a flow chart to find the factorial of any number.

  26. The table Company of database connect contains the following records
    NameDeptSalary
    ABCDBA35000
    XYZAnalyst42000
    ABC1DBA40000

    What will be the output of following code?

    import mysql.connector
    con = mysql.connector.connect(host = "localhost",
                    user = "system",passwd = "hello",database = "connect")
    cur = con.cursor()
    cur.execute("select Name, Salary from Company")
    display = cur.fetchone()
    print(display)
    
  27. Predict the output.
    a, b = 10, 15
    x = 20
    y = 25
    a = x + y - b
    x = a + b - y + 10
    z = y + b * 3 + a
    x = 50
    a = x + y + z
    print("a :", a)
    print("b :", b)
    print("x :", x)
    print("y :", y)
    print("z :", z)

    OR

    What is the length of the tuple shown below?
    t = ((((‘a’, 1), ‘b’, ‘c’), ‘d’, 2), ‘e’, 3)

  28. Consider a binary file Employee.dat containing details such as empno:ename:salary (separator ‘:’). Write a Python function to display details of those employees who are earning between 20000 and 40000. (Both values inclusive)OR Write a function count_Dwords () in Python to count the words ending with a digit in a text file “Details.txt”.
    Example:
    If the file content is as follows:
    On seat2 VIP1 will sit and
    On seat1 VVIP2 will be sitting
    Output will be:
    Number of words ending with a digit are 4
  29. Explain the use of a default parameter in a Python function with the help of a suitable example.
  30. Explain the two types of duplex communication.
  31. Section C
  32. Write a method in Python to find and display the prime number between 2 to n. Pass n as an argument to the method.OR Write functions in Python for InsertQ(Names) and RemoveQ(Names) for performing insertion and removal operations with a queue of list which contains names of students. The function must check for Empty Queue.
  33. Write the output of SQL queries (a) to (d) based on the table VACCINATION_DATA given below:TABLE: VACCINATION_DATA
    VIDNameAgeDose1Dose2City
    101Jenny272021-12-252022-01-31Delhi
    102Harjot552021-07-142021-10-14Mumbai
    103Srikanth432021-04-182021-07-20Delhi
    104Gazala752021-07-31NULLKolkata
    105Shiksha322022-01-01NULLMumbai
    1. SELECT Name, Age FROM VACCINATION_DATA
      WHERE DOSE2 IS NOT NULL AND Age >40;
    2. SELECT City, COUNT(*) FROM VACCINATION_DATA GROUP BY City;
    3. SELECT DISTINCT CIEY EROM VACCINATION_DATA;
    4. SELECT MAX (Dose1), MIN (Dose2) FROM VACCINATION_DATA;

    OR

    What is the purpose of using MySQL?

  34. What is the difference between a local variable and a global variable? Also, give a suitable Python code to illustrate both.OR Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are not even.
  35. Section D
  36. Write a program to implement a stack for these book details (book no., book name). That is, now each item node of the stack contains two types of information – a book no. and its name. Just implement Push and display operations.OR A line of text is read from the input terminal into a stack. Write a program to output the string in the reverse order, each character appearing twice.
    (ie.g., the string a b c d e should be changed to ee dd cc bb aa)
  37. A binary file “PATIENTS.dat” has structure (PID, NAME, DISEASE).
    Write the definition of a function countrec() in Python that would read contents of the file “PATIENTS.dat” and display the details of those patients who have the DISEASE as ‘COVID-19’. The function should also display the total number of such patients whose DISEASE is ‘COVID-19’.
  38. Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (v).TABLE: DOCTOR
    IDNAMEDEPTSEXEXPERIENCE
    101JohnENTM12
    104SmithORTHOPEDICM5
    107GeorgeCARDIOLOGYM10
    114LaraSKINF3
    109K GeorgeMEDICINEF9
    105JohnsonORTHOPEDICM10
    117LucyENTF3
    111BillMEDICINEF12
    130MorphyORTHOPEDICM15

    TABLE: SALARY

    IDBASICALLOWANCECONSULTATION
    101120001000300
    104230002300500
    107320004000500
    114120005200100
    109420001700200
    105189001690300
    130217002600300
    1. Display NAME of all doctors who are in MEDICINE department having more than 10 yrs experience from the table DOCTOR.
    2. Display the average salary of all doctors working in ENT department using the tables DOCTOR and SALARY.SALARY = BASIC + ALLOWANCE.
    3. Display the minimum ALLOWANCE of female doctors.
    4. Display the highest consultation fee among all male doctors.
    5. To display the detail of doctor who have experience more than 12 years.

    OR

    Consider the following tables PRODUCT and CLIENT. Write SQL commands for the following statements.Table: PRODUCT

    P_IDProductNameManufacturerPrice
    TP01Talcum PowderLAK40
    FW05Face WashABC45
    BS01Bath SoapABC55
    SH06ShampooXYZ120
    FW12Face WashXYZ95

    Table: CLIENT

    C_IDClientNameCityP_ID
    01Cosmetic ShopDelhiFW05
    06Total HealthMumbaiBS01
    12Live LifeDelhiSH06
    15Pretty WomanDelhiFW12
    16DreamsBangloreTP01
    1. To display the details of those Clients whose City is Delhi.
    2. To display the details of Products whose Price is in the range of 50 to 100 (Both values included).
    3. To display the ClientName, City from table Client, and ProductName and Price from table Product, with their corresponding matching P_ID.
    4. To increase the Price of all Products by 10.
  39. Write a program that inputs the main string and then creates an encrypted string by embedding a short symbol-based string after each character. The program should also be able to produce the decrypted string from an encrypted string.
  40. Section E
  41. The Freshminds University of India is starting its first campus in Ana Nagar of South India with its center admission office in Kolkata. The university has 3 major blocks comprising of Office Block, Science Block and Commerce Block in the 5 km area Campus.

    As a network expert, you need to suggest the network plan as per (i) to (iv) to the authorities keeping in mind the distance and other given parameters.
    Expected Wire distances between various locations:

    Office Block to Science Block90 m
    Office Block to Commerce Block80 m
    Science Block to Commerce Block15 m
    Kolkata Admission office to Ana Nagar Campus2450 km

    Expected number of Computers to be installed at various locations in the University are as follows:

    Office Block10
    Science Block140
    Commerce Block30
    Kolkata Admission office8
    1. What type of server should be installed in university?
      • Dedicated
      • Non-dedicated
    2. Suggest the most suitable place (i.e., block) to house the server of this university with a suitable reason.
    3. Suggest an efficient device from the following to be installed in each of the blocks to connect all the computers:
      • MODEM
      • SWITCH
      • GATEWAY
    4. Suggest the most suitable (very high speed) service to provide data connectivity between Admission Office located in Kolkata and the campus located in Ana Nagar from the following options:
      • Telephone line
      • Fixed-Line Dial-up connection
      • Co-axial Cable Network
      • GSM
      • Leased line
      • Satellite Connection
  42. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables:TABLE: BOOK
    CodeBNAMETYPE
    F101The PriestFiction
    L102German easyLiterature
    C101Tarzan in the lost worldComic
    F102Untold storyFiction
    C102War heroesComic

    TABLE: MEMBER

    MNOMNAMECODEISSUEDATE
    M101RAGHAV SINHALI 022016-10-13
    M103S ARTHAKJ OHNFI 022017-02-23
    M102ANISHA KHANC1012016-06-12
    1. To display all details from table MEMBER in descending order of ISSUEDATE.
    2. To display the BNO and BNAME of all Fiction Type books from the table Book.
    3. To display the TYPE and number of books in each TYPE from the table BOOK.
    4. To display all MNAME and ISSUEDATE of those members from table MEMBER who have books issued (i.e., ISSUEDATE) in the year 2017.
    5. SELECT MAX (ISSUEDATE) FROM MEMBER
    6. SELECT DISTINCT TYPE FROM BOOK
    7. SELECT A.CODE, BNAME, MNO. MNAME FROM BOOK A. MEMBER B WHERE A.CODE= B.CODE
    8. SELECT BNAME FROM BOOK WHERE TYPE NOT IN (“FICTION”, “COMIC”)

    OR

    Consider the following tables CABHUB and CUSTOMER and answer the following parts of this question :
    Table: CABHUB

    VcodeVehicleNameMakeColorCapacityCharges
    100InnovaToyotaWHITE715
    102SX4SuzukiBLUE414
    104C ClassMercedesRED435
    105A-StarSuzukiWHITE314
    108IndigoTataSILVER312

    Table: CUSTOMER

    CCodeCNameVcode
    1Hemant Sahu101
    2Raj Lai108
    3Feroza Shah105
    4Ketan Dhal104

    Give the output of the following SQL queries :

    1. SELECT COUNT (DISTINCT Make) FROM CABHUB ;
    2. SELECT MAX(Charges), MIN(Charges) FROM CABHUB ;
    3. SELECT COUNT(*), Make FROM CABHUB ;
    4. SELECT VehicleName FROM CABHUB WHERE Capacity = 4;
      For top-notch exam preparation, download the myCBSEguide App today. The app offers a wide range of study materials for CBSENCERTJEE (Main)NEET-UG, and NDA exams. Whether you’re a student or a teacher, myCBSEguide Website equips you with everything you need to succeed—sample paperspractice questionsstudy notes, and revision materials tailored to your syllabus.Students can enhance their exam readiness with customized study plans and timely reminders, while teachers can utilize the Examin8 App and Examin8 Website to create personalized exam papers. This feature allows educators to generate test papers with their own name and logo, making it an invaluable tool for crafting customized assignments and assessments to improve classroom learning.

Class 12 – Computer Science
Sample Paper – 01 (2024-25)


Solution

Section A

    1. (b) False
      Explanation: False
    2. (d) Tables
      Explanation: A relational database consists of a collection of tables that store interrelated data.
    3. (c) List of tuples
      Explanation: List of tuples
    4. (c) 4 is maximum
      Explanation: Here, we define a function called printMax that uses two parameters called a and b. We find out the greater number using a simple if..else statement and then print the bigger number.The above code will produce error as the statement above is not correct form of dictionary, which has keys and values.
    5. (a) Twisted pair cable
      Explanation: Twisted pair cable is the least expensive transmission media.
    6. (a) x
      Explanation: x
    7. (b) 5
      Explanation: A list is getting added in list l1 which will be counted as one item for the list.
    8. (c) Acts like a WHERE clause but is used for groups rather than rows.
      Explanation: Acts like a WHERE clause but is used for groups rather than rows.HAVING is used to filter values after they have been groups.
    9. myfile.write(“Hello world!”)
      File object is myfile, and write() function writes string “Hello World!” into the file.
    10. (a) True
      Explanation: True
    11. (a) OVERFLOW
      Explanation: When a stack, implemented as an array/list of fixed size, is full and no new element can be accommodated, it is called an OVERFLOW.
    12. The aggregate function that can display the cardinality (number of rows) of a table in SQL is COUNT.
    13. (c) WAN
      Explanation: WAN spans a large geographical area, often a country or a continent and uses various commercial and private communication lines to connect computers.
    14. (d) Error
      Explanation: ++ is not defined as an increment operator in python.
    15. (b) Dictionary
      Explanation: Dictionary
    16. (c) Fibre optic
      Explanation: The transmission capacity of optical fibre cable is 26,000 times higher than that of twisted pair cable.
    17. (c) TCP
      Explanation: TCP
    18. (b) Both A and R are true but R is not the correct explanation of A.
      Explanation: The tuple items cannot be deleted individually by using the del keyword as tuple is immutable. To delete an entire tuple, we can use the del keyword with the tuple name.
    19. (b) Both A and R are true but R is not the correct explanation of A.
      Explanation: pandas is defined as an open-source library that is built on top of the NumPy library and it provides fast analysis, data cleaning, and preparation of the data for the user.
    20. (c) A is true but R is false.
      Explanation: The frozenset() function returns an unchangeable/immutable version of a set object. The elements of set can be changed at any time but the elements of frozenset remains same. If you try to change the value of a frozenset item, it will cause an error.For effective exam preparation, download the myCBSEguide App today. It offers complete study material for CBSENCERTJEE (Main)NEET-UG, and NDA exams. The app provides a wide range of resources including sample paperspractice questionsstudy notes, and revision tools, all designed to help you ace your exams.Whether you’re preparing for CBSE board exams or competitive tests like JEENEET, or NDA, the myCBSEguide Website has everything you need to study smarter and perform better.In addition, Examin8 App and  Examin8 Website allows teachers to easily create customized test papers with their name and logo, making it an excellent tool for generating personalized assessments and assignments.

 

  1. Section B
  2. import MySQLdb
    db = MySQLdb.connect(“localhost”, “Admin”, “Ad123”, “HMD”)
    cursor= db.cursor()
    cursor.execute(“DROP TABLE IF EXISTS Location”)
    sql=” ” “Create Table location (id Numeric(5) PRIMARY KEY, bidycode  varchar(10)  Not Null ,
    room varchar(6) Not Null , Capacity Numeric(5) Not Null)” ” ”
    cursor.execute(sql)
    db.close()

    1. ‘World’
    2. ‘Hello’
  3. OR
  4. (‘ABC’, 35000)
  5. Output
    a : 175
    b : 15
    x : 50
    y : 25
    z : 100OR The length of this tuple is 3 because there are just three elements in the given tuple. Because a careful look at the given tuple yields that tuple t is made up of:
    t1 = “a”, 1
    t2 = t1, “b”, “c”
    t3 = t2, “d”, 2
    t = (t3, “e”, 3)
  6. def Readfile():
        i=open("Employee.dat", "rb+")
        x=i.readline()
        while(x):
            l=x.split(':')
            if (20000>=float(1[2])<=40000):
                print(x)
            x=i.readline()

    OR

    def count_Dwords():
        with open ("Details.txt", 'r') as F:    # ignore 'r'
            S=F.read()
            Wlist = S.split()
            count = 0
            for w in wlist:
                if w [-1].isdigit():
                    count+=1
    print ("Number of words ending with a digit are", count)

    OR

    def count_Dwords():
        count=0
        myfile=open("Details.txt")
        S=myfile.read()
        Wlist=S.split()
            for W in Wlist:
                if i[-1] in "0123456789":
                    count=count+1
        myfile.close()
        print("Number of words ending with a digit are",count)
    
  7. In Python, a default parameter is defined with a fallback value as a default argument. Such parameters are optional during a function call. If no argument is provided, the default value is used, and if an argument is provided, it will overwrite the default value. greet(“Ankit”, “How do you do?”)
  8. There are mainly two types of duplex communication:
    1. Full duplex: In this type of transmission, two bitstreams can be simultaneously transmitted over the links at the same time, one going in each direction, i.e., sending as well as receiving the data. For example, in a telephone conversation, two people communicate, and both are free to speak and listen at the same time.
    2. Half-duplex: In this type of transmission, data can flow in only one direction at a time i.e., either sending or receiving data at a time. For example, in walkie-talkies, the speakers at both ends can speak, but they have to speak one by one. They cannot speak simultaneously.
  9. Section C
  10. def prime(n) :
    for num in range (2, n) :
    is_prime = 1
    for i in range (2, num):
    if num % i == 0:
    is_prime = 0
    if is_prime == 1:
    print (num)OR

    def InsertQ(Names):
     Name=raw_input("enter Name to be inserted: ")
     Names.append(Name)
    def DeleteQ(Names):
     if (Names==[]):
     print "Queue empty"
     else:
     print "Deleted Player’s Name is: ",Names[0]
     del(Names[0])
    
    1. SELECT Name, Age FROM VACCINATION_DATA WHERE DOSE2 IS NOT NULL AND Age > 40;
      NameAge
      Harjot55
      Srikanth43
    2. SELECT City, COUNT(*) FROM VACCINATION_DATA GROUP BY City;
      CityCOUNT(*)
      Delhi2
      Mumbai2
      Kolkata1
    3. SELECT DISTINCT CITY FROM VACCINATION_DATA;
      CITY
      Delhi
      Mumbai
      Kolkata
    4. SELECT MAX(Dose1), MIN(Dose2) FROM VACCINATION_DATA;
      MAX(Dose1)MIN(Dose2)
      2022-01-012021-07-20
  11. OR MySQL is a free, open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). In a MySQL database, information is stored in Tables. A single MySQL database can contain many tables at once and store thousands of individual records.
  12. The differences between a local variable and a global variable are as given below :
    Local VariableGlobal Variable
    1. It is a variable which is declared within a function or within a block1. It is a variable which is declared outside all the functions
    2. It is accessible only within a function/block in which it is declared2. It is accessible throughout the program
    3.Local variables are created when the function has started execution and are lost when the function terminates.3.Global variable is created as execution starts and is lost when the program ends.

    For example, in the following code, x, xCubed are global variables and n and cn are local variables.
    def cube(n):
    cn = n * n * n
    return cn
    x = 10
    xCubed = cube(x)
    print(x, “cubed is”, xCubed)OR

    def OddSum(NUMBERS) :
    odd_sum = 0
    for num in range (len(NUMBERS)):
    if (NUMBERS[num] % 2 != 0:
    odd_sum = odd_sum + NUMBERS [num] print odd_sum

  13. Section D
  14. ” ” ”
    Stack: implemented as a list
    top: integer having a position of a topmost element in Stack
    ” ” ”
    def cls( ):
    print(“\n”* 100)
    def is Empty(stk) :
    if stk== [ ] :
    return True
    else :
    return False
    def Push(stk, item) :
    stk.append(item)
    top = len(stk) – 1
    def Display(stk) :
    if isEmpty(stk) :
    print (“Stack empty”)
    else :
    top = len(stk) – 1
    print(stk[top], “<-top”)
    for a in range(top-1, -1, -1 ) :
    print(stk[a])
    # __main__
    Stack = [] # initially stack is empty
    top = None
    while True :
    cls()
    print (“STACK OPERATIONS”)
    print(“1. Push operation”)
    print(“2. Display stack”)
    print(“3. Exit”)
    ch = int(input(“Enter your choice (1-5) :”))
    if ch == 1 :
    bno = int(input(“Enter Book no. to be inserted :”))
    bname = input (“Enter Book name to be inserted :”)
    item = [bno, bname] # creating a list from the input items.
    PushfStack, item)
    input()
    elif ch == 2 :
    Display(Stack)
    input( )
    elif ch == 3 :
    break
    else :
    print(“Invalid choice!”)
    input()OR MAX_SIZE = 1000
    stack = [0 for i in range(MAX_SIZE)] top = 0
    def isEmpty ( ):
    global top
    return top == 0
    def push(x):
    global stack,top
    if top >= MAX_SIZE:
    return
    stack[top]= x
    top += 1
    def pop( ):
    global stack,top
    if isEmpty( ):
    return
    else:
    top -= 1
    return stack[top] string = input( ).split()
    for i in string:
    push(i)
    while not isEmpty( ):
    x = pop( )
    print (x + x, end = ‘ ‘)
  15. def countrec():
        try:
            # Open the binary file in read mode
            with open("PATIENTS.dat", "rb") as file:
                covid_patients = []  # List to store COVID-19 patients
                total_covid_patients = 0
                while True:
                    record = file.readline().decode().strip()
                    if not record:
                        break
                    PID, NAME, DISEASE = record.split(",")
                    if DISEASE == "COVID-19":
                        covid_patients.append((PID, NAME))
                        total_covid_patients += 1
                # Display details of COVID-19 patients
                print("Details of COVID-19 patients:")
                for pid, name in covid_patients:
                    print(f"PID: {pid}, NAME: {name}")
                print(f"Total COVID-19 patients: {total_covid_patients}")
        except FileNotFoundError:
            print("File 'PATIENTS.dat' not found.")
    # Call the function
    countrec()
    1. SELECT NAME FROM DOCTOR WHERE DEPT=’MEDICINE’ AND EXPERIENCE > 10;
    2. SELECT AVG(BASIC + ALLOWANCE) FROM SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE DEPT=’ENT’);
    3. SELECT MIN(ALLOWANCE) FROM SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE SEX =’F’);
    4. SELECT MAX(CONSULTATION) FROM SALARY WHERE SALARY.ID IN(SELECT ID FROM DOCTOR WHERE SEX=’M’);
    5. SELECT * FROM DOCTOR
      WHERE EXPERIENCED>12;
  16. OR
    1. SELECT * FROM CLIENT
      WHERE City = ‘ Delhi ‘ ;
    2. SELECT * FROM PRODUCT
      WHERE Price BETWEEN 50 AND 100 ;
    3. SELECT ClientName, City, ProductName, Price
      FROM CLIENT, PRODUCT
      WHERE CLIENT.P_ID = PRODUCT.P_ID ;
    4. UPDATE PRODUCT
      SET Price = Price + 10 ;
  17. def encrypt(sttr, enkey):
    return enkey.join(sttr)
    def decrypt(sttr, enkey):
    return sttr.split(enkey)
    #-main-
    mainstring = input(“Enter main string:”)
    encryptStr = input(“Enter encyption key:”)
    enStr = encrypt(mainString, encryptStr)
    deLst = decrypt(enStr, encryptStr)
    # deLst is in the form of a list, converting it to string below
    deStr=””.join(deLst)
    print(“The encrypted string is”, enStr)
    print(“String after decryption is:”, deStr)
    The sample run of the above program is as shown below:
    Enter main string : My main string
    Enter encryption key : @$
    The encrypted string is m@$y@$ @$m@$a@$i@$n@$ @$s@$t@$r@$i@$n@$g
    String after decryption is : My main string
  18. Section E
    1. The server should be Dedicated server
    2. The most suitable place to house the server is Science Block as it has the maximum number of computers. Thus, reducing the cabling cost and increase the efficiency of the network.
    3. SWITCH
    4. Satellite Connection Or Leased line
    1. SELECT * FROM MEMBER ORDER BY ISSUEDATE DESC
    2. SELECT Code, BNAME FROM BOOK WHERE TYPE ‘Fiction’
    3. SELECT COUNT(*), TYPE FROM BOOK GROUP BY TYPE
    4. SELECT MNAME, ISSUEDATE FROM MEMBER WHERE ISSUEDATE Like ‘2017 %’
    5. MAX (ISSUE DATE) 2017-02-23
    6. DISTINCT (TYPE)
      Fiction
      Literature
      Comic
    7. CODEBNAMEMNOMNAME
      L102German easyM101RAGHAV SINHA
      F102Untold StoryM103SARTHAK JOHN
      C101Tarzan in the lost worldM102ANISHA KHAN
    8. BNAME
      German easy
  19. OR
    1. 4
    2. 3512
    3. Invalid query
    4. SX4
      C Class
      Boost Your Exam Preparation with the myCBSEguide AppFor effective exam preparation, download the myCBSEguide App today. It offers complete study material for CBSENCERTJEE (Main)NEET-UG, and NDA exams. The app provides a wide range of resources, including practice questionssample papersstudy notes, and revision guides—all designed to help students excel in their exams.Whether you’re aiming for top marks in CBSE, preparing for JEE MainNEET UG, or the NDA exam, the myCBSEguide app and myCBSEguide website has everything you need to study effectively and efficiently.Additionally, Examin8 App and Examin8 Website allows teachers to create customized test papers with their name and logo, making it a valuable tool for generating personalized exams and assignments.

CBSE Sample Papers for Class 12

For comprehensive exam preparation, download sample papers for Class 12 in PhysicsChemistryBiologyHistoryPolitical ScienceEconomicsGeographyComputer ScienceHome ScienceAccountancyBusiness Studies, and more on the myCBSEguide app or myCBSEGuide website. These CBSE Class 12 sample papers come with detailed solutions and are based on the latest syllabus and exam pattern. The Examin8 website and Examin8 app provide a complete exam preparation solution with sample papersmock tests, and personalized learning plans. Access Class 9 Hindi A Sample Papers 2025 for better exam practice and confidence.

myCBSEguide offers a complete range of study resources to help you excel in your board exams. You can access chapter-wise test papersNCERT solutionsNCERT Exemplar solutions, and quick revision notes to sharpen your understanding of key concepts. Additionally, you’ll find CBSE guess papersimportant question papers, and other essential resources to boost your exam preparation.

Whether you’re preparing for Class 12 PhysicsChemistryBiology, or any other subject, myCBSEguide provides the best app and website for CBSE students to download and practice sample papers and solve practice questions efficiently.

Why Choose myCBSEguide for Your CBSE Exam Preparation?

1. Comprehensive Study Materials

myCBSEguide offers a wealth of study resources, including sample paperstest paperschapter-wise practice papersNCERT solutions, and NCERT Exemplar solutions. These materials cover the entire CBSE syllabus, ensuring that students have everything they need to prepare effectively for their exams.

2. Free Sample Papers & Solutions

You can download free sample papers for Class 9 and 10 across all subjects like Science, Mathematics, Social Science, English, and Hindi. Each paper comes with detailed solutions and a marking scheme, helping you understand how to approach different question types.

myCBSEguide App

Test Generator

Create question paper PDF and online tests with your own name & logo in minutes.

Create Now
myCBSEguide App

myCBSEguide

Question Bank, Mock Tests, Exam Papers, NCERT Solutions, Sample Papers, Notes

Install Now

2 thoughts on “CBSE Sample Papers Class 12 Computer Science 2025”

Leave a Comment