Creative Convent College
Computer Science (083)
                                           CLASS XII 2024-25
     Time: 3 Hours                                                                            Max. Marks: 70
     General Instructions:
     1.   This question paper contains 37 questions.
     2.   All questions are compulsory. However, internal choices have been provided in some questions. Attempt
          only one of the choices in such questions
     3.   The paper is divided into 5 Sections- A, B, C, D and E.
     4.   Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
     5.   Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
     6.   Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
     7.   Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
     8.   Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
     9.   All programming questions are to be answered using Python Language only.
     10. In case of MCQ, text of the correct answer should also be written.
                                               SECTION A
1.   State True or False
     “Multiple elements can be added at the end of list by the append method”.
2.   Identify the output of the following code snipped :
     s = “Wonders of World”
     print(s.count(‘o’) + s.index(‘o’))
     (a) 3                                             (b) 4
     (c) 2                                             (d) 1
3.   Which of the following are sequence of character data?
     (a) Lists                                         (b) Tuples
     (c) Strings                                       (d) Dictionaries
4.   a = 1.0
     b = 1.0
     a is b # Line 1
     Output of Line 1 will be
     (a) False                                         (b) True
     (c) 1.0                                           (d) 0.0
                                     Creative Convent College
5. What will be the output of the following code snippet?
     text = “Data Science”
     print(text[-3::-3])
6.   a = 6
     b = 5.5
     sum = a+b
     print(sum)
     print(type (sum))
     (a) 11.5                                          (b) 10.5
     <class ‘float’>                                <class ‘float’>
     (c) None                                          (d) None of these
     <class ‘int’>
7.   Which constraint is used to specify a condition for a field to accept only certain values?
     (a) NULL                                          (b) PRIMARY KEY
     (c) CHECK                                         (d) NOT NULL
8.   Which of the following are random number generators ?
     (a) randint()                                     (b) randrange()
     (c) random()                                      (d) All of these
9.   Which device is used to connect two different types of networks?
     (a) modem                                         (b) repeater
     (c) bridge                                        (d) gateway
10. Write the missing statement to complete the following code:
     logfile = open(“log.txt”, “r”)
     content = logfile.read(200)
     first_line = logfile.readline()
     logfile.close()
11. State whether the following statement is True or False:
    The else block in Python is executed only if no exception occurs in the try block.
12. In which file, no delimiters are used for line and no translations occur?
     (a) Text file                                     (b) Binary file
     (c) CSV file                                      (d) None of these
13. What is the purpose of logical operators in programming?
                                                                                      CConionue Co oueen ppaue......
CBSC 12th Computer Science                                                                                   Page 3
14. In files, there is a key associated with each record which is used to differentiate among different records. For
    every file, there is atleast one set of keys that is unique. Such a key is called
    (a) primary key                                    (b) prime attribute
    (c) index key                                      (d) unique key
15. Which of the following is a correct syntax to add a column in SQL command?
    (a) ALTER TABLE table_name ADD column_name data_type;
    (b) ALTER TABLE ADD column_name data_type;
    (c) ALTER table_name ADD column_name data_type;
    (d) None of the above
16. In complex number a + ib, a represents as
    (a) real part                                      (b) imaginary part
    (c) special part                                   (d) None of these
17. A column storing Name of a department in a table Emp will be of type
    (a) int                                            (b) date
    (c) float                                          (d) varchar
18. The. ...... keyword sorts the records in ascending order by default.
    (a) LIKE                                           (b) UPDATE
    (c) ORDER                                          (d) ORDER BY
19. What is the purpose of the write() method in Python, and what type of data does it take as an argument
    to perform its function?
Directions : (Q.Nos.-20 and 21) are Assertion and Reason based Questions.
20. Assertion (A) : Built-in functions are predefined in the system and can be directly used in any program.
    Reason (R) : id( ) and type( ) are built-in functions in Python.
    (a) Both A and R are true and R is the correct explanation for A.
    (b) Both A and R are true but R is not the correct explanation for A.
    (c) A is true but R is false.
    (d) A is false but R is true.
21. Assertion (A) : The CSV files are like TEXT files and are comma separated value files.
    Reason (R) : The data stored in CSV files are separated by comma by default. Although the delimiter can
    be changed.
    (a) Both A and R are true and R is the correct explanation for A.
    (b) Both A and R are true but R is not the correct explanation for A.
    (c) A is true but R is false.
    (d) A is false but R is true.
Page 4
                                            SECTION - B
22. Seema was asked to accept a list of even numbers ,but she did not put the relevant condition while accepting
    the list of numbers. She wrote a user defined function odd to even (L) that accepts the list L as an argument
    and converts all the odd numbers into even by multiplying them by 2.
    def oddtoeven (L)
    for i in range (size(L)):
       if (L[i]%2! == 0)
            L[i]= L[1] ** 2
       print (L)
    There are some errors in the code . Rewrite the correct code.
23. Observe the code and write the output
    (a) ‘‘Nodia publication’.
        count(‘hant’, 0, 10)
    (b) dic = {}
    dic[(1, 2, 4)] = 8
    dic[(4, 2, 1)] = 10
    dic[(1, 2)] = 24
    sum = 0
    for i in dic:
         sum = sum + dic[i]
    print(sum)
24. How are E-mail and chat applications different?
                                                         or
    How are LAN and MAN different?
25. Write about the terms degree and cardinality of a table.
26. (a) Write the full forms of
         (i) URL
         (ii) VoIP
    (b) Write the use of SMTP.
27. Find the output of following code.
    dic = {“Nitin”: (21, “NIIT”), “Ankit”: (15, “NIIT”)}
    print(“The original dictionary :”, str(dic))
    result = [(key, i, j) for key, (i, j) in dic.items()]
    print(“The list after conversion :”, str(result))
                                                         or
    What output will be generate when the following Python code is executed?
    def ChangeList ():
       l =[]
       l1=[]
CBSC 12th Computer Science                                                                                  Page 5
       l2=[]
       for i in range(1, 10):
            l.append(i)
       for i in range(10, 1, –2):
            l1.append(i)
       for i in range(len (l1)):
            l2.append(l1[i] + l[i])
       l2.append (len(l)– len(l1))
       print(l2)
    ChangeList()
28. Differentiate between DROP and DELETE commands of SQL.
                                                         or
    Identify any two DML commands from the following and also explain.
    ALTER , INSERT , UPDATE , DROP , CREATE
                                              SECTION-C
29. Write a function countEU() in Python, which should read each character of a text file. IMP.TXT should
    count and display the occurrence of alphabets E and U (including small cases e and u too).
    e.g. If the file content is as follows :
    Pinaky has gone to his friend’s house.
    His friend’s name is Ravya. Her house is 12 km from Pinaky’s house.
    The countEU() function should display the output as
    E:8
    U:3
                                                         or
    Write a Python program to find the longest word in file “status.txt”. If contents of status.txt are Welcome
    to your one-step solutions for all your study, practice and assessment need for various competitive and
    recruitment examinations and school segment. We have been working tirelessly for over a decade to make
    sure that you have best in class study resources because you deserve SUCCESS AND NOTHING LESS...
    Output should be
    Longest word : examinations
30. Priya has created a dictionary with names as keys and marks as values for 6 students. Write a program with
    separate user-defined functions to perform the following operations.
    (a) Push the keys (name of the student) of the dictionary into a stack, where the corresponding value
        (marks) is greater than 75.
    (b) Pop and display the content of the stack.
    For example If the sample content of the dictionary is as follows
    R={“OM”:76, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}
    The output from the program should be
    TOM ANU BOB OM
                                                         or
    Rohit has a list of 10 integers. Write a program with separate user-defined functions to perform the specified
    operations on this list..
Page 6
   (a) Traverse the content of the list and push the even numbers into a stack.
   (b) Pop and display the content of the stack.
   For example, If the sample content of the list is as follows
   N = [12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
   Sample Output of the code should be:
   38 22 98 56 34 12
31. Consider the following tables - STUDENT and STREAM :
                                                TABLE: STUDENT
    SCODE             NAME              AGE          STRCDE            POINTS               GRADE
    101               Amit              16           1                 6                    NULL
    102               Arjun             13           3                 4                    NULL
    103               Zaheer            14           2                 1                    NULL
                    TABLE: STREAM
    STRCDE      STRNAME
    1           SCIENCE+COMP
    2           SCIENCE+ BIO
    3           SCIENCE+ECO
    4           COMMERCE+MATHS
   What will be the ouput of the following statement?
   SELECT NAME, STRNAME FROM STUDENT S, STREAM ST WHERE S.STRCDE=ST.STRCDE;
                                                         or
   Write the output for SQL queries (i) to (iii), which are based on the table ITEMS.
                                                  TABLE: ITEMS
    Code          IName                        Qty        Price       Company                         TCode
    1001          DIGITAL PAD 12i              120        11000       XENITA                          T01
    1006          LED SCREEN 40                70         38000       SANTORA                         T02
    1004          CAR GPS SYSTEM               50         2150        GEOKNOW                         T01
    1003          DIGITAL CAMERA 12X           160        8000        DIGICLICK                       T02
    1005          PEN DRIVE 32 GB              600        1200        STOREHOME                       T03
   (i) SELECT MAX(Price), MIN(Price) FROM ITEMS;
   (ii) SELECT Price * Qty AS AMOUNT
         FROM ITEMS WHERE Code=1004;
   (iii) SELECT DISTINCT TCode FROM ITEMS;
                                                                                  CConionue Co oueen ppaue......
CBSC 12th Computer Science                     Sample Paper 01                                        Page 7
                                           SECTION-D
32. (a) Find the output of the following Python program:
       def makenew (mystr):
         newstr = “”
         count = 0
         for i in mystr:
           if count%2!=0:
             newstr = newstr + str (count)
           else:
             if islower (i):
               newstr = newstr + upper (i)
             else:
               newstr = newstr + i
           count + = 1
         newstr = newstr + mystr [:1]
         print(“The new string is:”,
                                          newstr)
       makenew(“sTUdeNT”)
   (b) Consider the table Student whose fields are
    Scode            Name                Age                Strcde        Points            Grade
    101              Amit                16                 1             6                 NULL
    102              Arjun               13                 3             4                 NULL
    103              Zaheer              14                 2             1                 NULL
    104              Gegen               15                 5             2                 NULL
    105              Kumar               13                 6             8                 NULL
   Write the Python code to update grade to ‘A’ for all these students who are getting more than 8 as points.
   The table structure is as follows :
   Scode : integer
   Name : varchar
   Age : integer
   Strcde : integer
   Points : integer
   Grade : varchar
   Note the following to establish the connection between Python and MySQL:
   Host : localhost
   Username : Admin
   Password : Admin@123
   The table exists in MySQL database as : Student
                                                       or
   (a) Write a Python program to remove the characters of odd index values in a string.
   (b) Consider the table MobileStock with following fields
   M_Id. M_Name, M_Oty, M_Supplier
   Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database
   Mobile.
Page 8                                      Sample Paper 01                                   NODIA APP
   Consider:
   host : localhost
   UserName : root
   Password : system
   Database : Mobile
33. Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to
    (iv).
                                            TABLE: GARMENT
    GCODE              DESCRI-PTION           PRICE           FCODE              READY-DATE
    10023              PENCIL SKIRT           1150            F03                19-DEC-08
    10001              FORMAL SHIRT           1250            F01                12-JAN-08
    10012              INFORMAL SHIRT         1550            F02                06-JUN-08
    10024              BABY TOP               750             F03                07-APR-07
    10090              TULIP SKIRT            850             F02                31-MAR-07
    10019              EVENING GOWN           850             F03                06-JUN-08
    10009              INFORMAL PANT          1500            F02                20-OCT-08
    10007              FORMAL PANT            1350            F01                09-MAR-08
    10020              FROCK                  850             F04                09-SEP-07
    10089              SLACKS                 750             F03                20-OCT-08
                                             TABLE: FABRIC
    FCODE                                             TYPE
    F04                                               POLYSTER
    F02                                               COTTON
    F03                                               SILK
    F01                                               TERELENE
   (i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
   (ii) To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and
        16-JUN-08 (inclusive of both the dates).
   (iii) To display the average PRICE of all the GARMENTs. Which are made up of FABRIC with FCODE as
         F03.
   (iv) To display FABRIC wise highest and lowest price of GARMENTs from GARMENT table.
         (Display FCODE of each GARMENT alongwith highest and lowest price.)
                                                                               CConionue Co oueen ppaue......
CBSC 12th Computer Science                    Sample Paper 01                                          Page 9
34. Red Pandas Info-systems has its 4 blocks of buildings. The number of computers and distances between
    them is given below :
    Building               Number of Computers
    HR                     15
    ADMIN                  100
    SYSTEM                 25
    PERS                   30
    Building                 Distance
    HR -Admin                10 m
    HR- System               50 m
    HR- Pers                 750 m
    Admin- System            300 m
    Admin- Pers              20 m
    System-Pers              250 m
   Answer the following questions with respect to the above :
   (i) Suggest a suitable cable layout for the network.
   (ii) Suggest the best place to house the server of the network.
   (iii) Which topology should be used to connect computers in each building?
   (iv) What kind of network will be formed here? (LAN/MAN/WAN)
                                                                                CConionue Co oueen ppaue......
Page 10
35. What is CSV file?
    Write a program using two functions :
    (a) addCustomer( ): To write Customer code, Customer name and Amt in file “cust.csv”.
          The details of the customers are as follows :
          [‘CustCode’, ‘CustName’, ‘Amount’]
          [‘001’, ‘Nihir’, ‘8000’]
          [‘104’, ‘Akshay’, ‘5000’]
   (b) readCustomer( ): To read the details of the customers and display them.
                                                             or
   When do we use CSV file?
   Write a program using following functions :
   (a) getlnventory() : Write code to accept as many inventory records and store them to the csv file Inventory.
       csv storing records of inventory as per following structure
36. PCode       Invname      Price    Reorder
   (b) Display() : To display the detail that store in Inventory.csv
                                                 SECTION - E
37. Consider the table MOVIE DETAILS given below
                                                  Table : MOVIEDETAILS
    MOVIEID                    TITLE                     LANGUAGE                 RAT-ING      PLAT-FORM
    M001                       Minari                    Korean                   5            Netflix
    M004                       MGR Magan                 Tamil                    4            Hotstar
    M010                       Kaagaz                    Hindi                    3            Zee5
    M011                       Harry Potter and the      English                  4            Prime
                               Chamber of Secrets                                              Video
    M015                       Uri                       Hindi                    5            Zee5
    M020                       Avengers: Endgame         English                  4            Hotstar
   (i) Identify the degree and cardinality of the table.
   (ii) Which field should be made the primary key? Justify your answer.
   (iii) Write statements to :
          (a) Delete the records whose language is “English”
          (b) Add a new record : “M050”, “Palki”,“Hindi”, 5, “Amazon Prime”.
                                                or (Option for part (iii) only)
          Write statements to :
          (a) Add a new column “DAYS” of type integer
          (b) Remove the column “RATING”
CBSC 12th Computer Science                         Sample Paper 01                                  Page 11
38. Below is a program to delete the line having word (passed as argument). Answer the questions that follow
    to execute the program successfully.
    import ......
    def filedel (word):
        file1 = open (“Python. txt ”,
                                      “......”)
        nfile = open (“algo1.txt”, “w”)
        while True:
          line = file1.readline( )
          if not line:
             break
          else :
             if word in line :
               ......
          else :
             print(line)
             nfile. .......... (line)
          file1.close()
          nfile.close()
    filedel (‘write’)
    (i) Name the module that should import in Line 1.
    (ii) In which mode, above program should open the file to delete the line?
    (iii) Fill the blank in Line 11 and Line 14.
    (iv) Suggest an alternative way to open and read the file without using.
    (v) Explain what happens if the specified word is not found in any line of “Python.txt”.
                                                        EEN