KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
PRE-BOARD - EXAMINATION - 2020-21
Class: XII                                       Max Marks:70
Subject:Computer Science                         Time: 3 hours
General Instructions:
1. This question paper contains two parts A and B. Each part is compulsory.
2. Both Part A and Part B have choices.
3. Part-A has 2 sections:
         a. Section – I is short answer questions, to be answered in one word or one line.
          b. Section – II has two case studies questions. Each case study has 4 case-based subparts.
         An examinee is to attempt any 4 out of the 5 subparts.
 4. Part - B is Descriptive Paper.
 5. Part- B has three sections
         a. Section-I is short answer questions of 2 marks each in which two question have
         internal options.
          b. Section-II is long answer questions of 3 marks each in which two questions have
         internal options.
          c. Section-III is very long answer questions of 5 marks each in which one question has
         internal option.
6. All programming questions are to be answered using Python Language only
Q.No                                           Part-A                                     Marks
                                              Section-I
        Attempt any 15 questions from question no 1 to 21.
1       Write the output of the following python statements:                              1
           Array=[8,5,3,2,1,1]
           print(Array[-1:-6:-1])
2       Which one is valid assignment operator in Python                                  1
           i.        /         ii.     =         iii. = =           iv.   and
3       Which of the following can be used as valid variable identifiers in Python?       1
        i) 4th Sum       ii) Total      iii) Number#          iv) _Data
4       Find the operator which cannot be used with a string in Python from the           1
        following: (a) +             (b) in               (c) *             (d) //
5       Consider the tuple in python named DAYS= (”SUN”,”MON”,”TUES”).                    1
        Identify the invalid statement(s) from the given below statements:
        1. S=DAYS[1]
        2. print(DAYS[2])
        3. DAYS[0]=”WED”
        4. LIST=list(DAYS)
1|Page
6    Write a statement in Python to declare a dictionary whose keys are 1, 2, 3                  1
     and values are Monday, Tuesday and Wednesday respectively.
7    Identify the valid declaration of L:                                                        1
                L = (‘Mon’, ‘23’, ‘hello’, ’60.5’)
     a. dictionary           b. string              c. tuple            d. list
8    ..................... method of pickle module is used to read data from a binary file.      1
         (a) read( )       b) load( )          c)   dump( )            d)     readlines( )
9    Expand the term                                                                             1
         i.       URL                    ii.        HTTPS
10   A device used to connect dissimilar networks is called ................................ .   1
         i.       Modem        ii.    Gateway       iii. Bridge    iv. hub
11   Which of the following is NOT a DML Command.                                                1
         i)       Insert         ii) Update            iii) Drop            iv)   Delete
12   In SQL ,what command is used to describe the table structure?                               1
13   Identify the error in the following SQL query which is expected to delete all               1
     rows of a table TEMP without deleting its structure and write the correct one:
                    DELETE TABLE TEMP;
14   A relation has 5 rows & 5 columns, later two more rows were added to the                    1
     relation .What will be the Degree & Cardinality of that relation?
         i.       Degree 5, Cardinality 7
         ii.      Degree 7, Cardinality 5
         iii.     Degree 50, Cardinality 7
         iv.      Degree 5, Cardinality 5
15   Website in charge KABIR of a school is handling downloading/uploading                       1
     various files on school website. Write the name of the protocol which is being
     used in the above activity.
16   Which statement is used to retrieve the current position within the file?                   1
         a) fp.seek( )          b) fp.tell( )             c) fp.loc               d) fp.pos
17   Name the Python Library modules which need to be imported to invoke the                     1
     following functions:
          (i) sin( )       (ii) random ( )
18   In SQL, which clause is used to remove duplicate records of a table while                   1
     display?
     i) or             ii) distinct            iii) any               iv)unique
2|Page
19    Identify the Guided and Un-Guided Transmission Media out of the following:       1
      Satellite, Twisted Pair Cable, Optical Fiber,        Infra-Red waves
20    Which clause is used in query to place the condition on groups in MySql?         1
          i) where        ii) having       iii) group by       iv) none of the above
21    What is GSM?                                                                     1
                                         Section-II
 Both the case study based questions are compulsory. Attempt any 4 subparts from each
                         question. Each question carries 1 mark.
22    A CD/DVD Shop named “NEW DIGITAL SHOP” stores various CDs &                      4
      DVDs of songs/albums/movies and use SQL to maintain its records. As a
      Database Administrator, you have decided the following:
          •   Name of Database - CDSHOP
          •   Name of Relation - LIBRARY
          •   Attributes are:-
              (a) CDNO - Numeric values
              (b)NAME - Character values of size (25)
              (c) QTY - Numeric values
              (d)PRICE - Decimal values
       Answer the following questions based on the above table LIBRARY:-
          a) Display all the details of the table whose quantity is more than 20 .
          b) Identify the best attribute which may be declared as Primary key.
          c) Insert the following record in the above relation: (10009,
              ”Motivational Songs”, 15, 70)
          d) Write an SQL query to display the minimum quantity.
          e) Database administrator wants to count the no. of CDs which does not
              have any Price value. Write the query for the same.
23    Suresh is writing a program to create a CSV file “files.csv” which will contain 4
      filetypes and file extensions for some records. He has written the following
3|Page
    code. As a programmer, help him to successfully execute the given task.
     import ---------------------                                         # Line 1
     def addinFile(filetype,extension):              # to write /add data into the file
         f=open('-----------------','-----------')                               # Line 2
         newFileWriter = csv.writer(f)
         newFileWriter.writerow([filetype,extension])
         f.close()
     #csv file reading code
    def readFile(filename):                                  # to read data
           from CSV            with open(filename,'r') as nf:
           nfr = csv._________(nf)                                       # Line 3
           for row in nfr:
              print (row[0],row[1])
              nf.____________                                            # Line 4
    addinFile(“C++”,”.cpp”)
    addinFile(“Python”,”.py”)
    addinFile(“Java”,”.java”)
    addinFile(“Microsoft Excel”,”.xls”)
    readFile(………….)                                                           #Line 5
     Answer the following questions: (1 mark each)
         (a) Name the module he should import in Line 1.
         (b) Fill in the blank to open file and In which mode, Suresh should open
          the file to add data into the file
         (c) Fill in the blank in Line 3 to read the data from a csv file.
         (d) Fill in the blank in Line 4 to close the file.
         (e) Fill in the blank in line 5 to send the file name as parameter .
4|Page
                                          Part-B
                                         Section-I
24   Find the output of the following program:                                      2
     def increment(n):
         n.append([4])
         return n
     l=[1,2,3]
     m=increment(l)
     print(l,m)
25   Differentiate between SMTP & POP3.                                             2
                                          OR
     List any two security measures to ensure network security.
26   Rohit has purchased a new Smart TV and wants to cast a video from his          2
     mobile to his new Smart TV. Identify the type of network he is using and
     explain it.
27   What is the meaning of return value of a function? Give an example to          2
     illustrate its meaning.
                                          OR
     Differentiate between a positional and default arguments with the help of an
     example.
28   Rewrite the following code after removing syntax error and underline the       2
     correction:
     Y=integer(input(“Enter 1 or 10”))
     if Y==10
     for Y in range(1,11):
               print(Y)
     else:
          for m in range(5,0,-1):
                   print(thank you)
29   What possible output(s) are expected to be displayed on screen at the time of 2
     execution of the program from the following code? Also specify the
     maximum values that can be assigned to each of the variables start and end.
     import random
     ar=[20,30,40,50,60,70]
     start=random.randint(0,2)
     end=random.randint(2,4)
     for k in range(start,end):
         print(ar[k],end=”#”)
         (i)       30#                       (iii)   10#20#30#40#50#
5|Page
             (ii)       20#30                          (iv)    40#30#
30   What do you understand by Candidate Keys in a table? Give a suitable 2
     example of Candidate Keys from a table containing some meaningful data.
31   Answer the following questions :                                     2
         1. Which package must be imported in python to create a database
            connectivity application?
         2. Which method is used for Connecting SQL with Python?
32   Differentiate between Alter and update TABLE command.                2
33   Predict the output for following code.                                         2
     def myfunc(str1):
             rstr=' '
             index=len(str1)
             while(index > 0):
                    if str1[index-1].isalpha():
                        rstr+=str1[index-1]
                    else:
                        rstr+='@'
                    index=index-1
             return rstr
     print(myfunc('a1b2c3d4'))
                                                  Section II
34   Write a function in python named SwapHalfList(Array), which accepts a list 3
     Array of numbers and swaps the elements of 1st Half of the list with the 2nd
     Half of the list ONLY if the sum of 1st Half is greater than 2nd Half of the
     list.
     Sample Input Data of the list Array= [ 100, 200, 300, 40, 50, 60],
     Output Arr = [40, 50, 60, 100, 200, 300]
35   Write a method/function COUNTLINES_ET() in python to read lines from a 3
     text file REPORT.TXT, and COUNT those lines which are starting either
     with ‘E’ and starting with ‘T’ respectively. And display the Total count
     separately.
     For example: if REPORT.TXT consists of
     “ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM
     PYTHON. ALSO, IT IS VERY FLEXIBLE LANGUGAE. THIS WILL BE
     USEFUL FOR VARIETY OF USERS.”
     Then, Output will be:
6|Page
     No. of Lines with E: 1
     No. of Lines with T: 1
                                              OR
     Write a method/function SHOW_TODO() in python to read contents from a
     text file ABC.TXT and display those lines which have occurrence of the word
     ‘‘TO’’ or ‘‘DO’’. For example : If the content of the file is
     “THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF
     HARD WORK. WE ALL ARE EXPECTED TO DO HARD WORK. AFTER
     ALL EXPERIENCE COMES FROM HARDWORK.”
     The method/function should display:
     • THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF
     HARD WORK.
     • WE ALL ARE EXPECTED TO DO HARD WORK.
36                                  Table : Employee                               3
      EmployeeId               Name                     Sales           JobId
           E1               Sumit Sinha                 110000           102
           E2            Vijay Singh Tomar              130000           101
           E3               Ajay Rajpal                 140000           103
           E4              Mohit Kumar                  125000           102
           E5               Sailja Singh                145000           103
                                           Table: Job
                 JobId                      JobTitle                 Salary
                 101                       President                 200000
                 102                  Vice President                 125000
                 103             Administrator Assistant             80000
                 104               Accounting Manager                70000
                 105                       Accountant                65000
                 106                  Sales Manager                  80000
     Give the output of following SQL statement:
         (i)     Select max(salary),min(salary) from job;
         (ii)    Select Name, JobTitle, Sales from Employee, Job
                 where Employee. JobId=Job. JobId and JobId in (101,102)
         (iii)   Select JobId, count(*) from Employee group by JobId
7|Page
37   Write a function in python named PUSH(STACK, SET) where STACK is list 3
     of some numbers forming a stack and SET is a list of some numbers. The
     function will push all the EVEN elements from the SET into a STACK
     implemented by using a list. Display the stack after push operation.
                                           OR
     Write a function in python named DEL(QUEUE) where QUEUE is
     implemented by a list of numbers. The function will display the DELETED
     element .
                                       Section-III
38   Quick Learn University is setting up its academic blocks at Prayag Nagar and   5
     planning to set up a network. The university has 3 academic blocks and one
     human resource Centre as shown in the diagram given below:
                                              Technology
                  Business
                                                 Block
                  Law Block                     HR Block
     Centre-to-Centre distance between various blocks is as follows:
      Law block to business block             40 m
      Law block to technology block           80 m
      Law block to HR block                   105 m
      Business block to technology block      30 m
      Business block to HR block              35 m
      Technology block to HR block            15 m
     Number of computers in each of the buildings is as follows:
      Law block                               15
      Technology block                        40
      HR Block                                115
      Business block                          25
     (a) Suggest a cable layout of connection between the blocks.
     (b) Suggest the most suitable place to house the server of the organization
     with suitable reason.
8|Page
     (c) Which device should be placed/ installed in each of these blocks to
     efficiently connect all the computers within these blocks?
     (d) The university is planning to link its sales counters situated in various
     parts of the other cities. Which type of network out of LAN, MAN or WAN
     will be formed?
     (e) Which type of network topology may be preferred between these blocks?
39   Write SQL Commands for the following queries based on the relations             5
     PRODUCT and CLIENT given below.
     Table: Product
      P_ID      ProductName             Manufacturer Price            ExpiryDate
      TP01      Talcum Powder           LAK            40             2011-06-26
      FW05      Face Wash               ABC            45             2010-12-01
      BS01      Bath Soap               ABC            55             2010-09-10
      SH06      Shampoo                 XYZ            120            2012-04-09
      FW12      Face Wash               XYZ            95             2010-08-15
      Table: Client
      C_ID                ClientName          City                 P_ID
      1                   Cosmetic Shop       Delhi                FW05
      6                   Total Health        Mumbai               BS01
      12                  Live Life           Delhi                SH06
      15                  Pretty One          Delhi                FW05
      16                  Dreams              Bengaluru            TP01
      14                  Expressions         Delhi                NULL
     (i)     To display the ClientName and City of all Mumbai- and Delhi-based
             clients in Client table.
     (ii)    Increase the price of all the products in Product table by 10%.
     (iii)   To display the ProductName, Manufacturer, ExpiryDate of all the
             products that expired on or before ‘2010-12-31’.
     (iv)    To display C_ID, ClientName, City of all the clients (including the
             ones that have not purchased a product) and their corresponding
             ProductName sold.
     (v)     To display productName, Manufacturer and ClientName of Mumbai
             City.
40   (a) Create a binary file “employee.dat” that stores the records of employees    5
9|Page
        and display them one by one.
        (b) Display the records of all those employees who are getting salaries
        between 25000 to 30000.
                                             OR
         A binary file “CLUB.DAT” has structure (PNO, PName, Game,Fee).
         The description is given below:
         PNo      :   Player Number          e.g. 365478
         PName :      Player Name           e.g. “Rajat”
         Game    :    Game of Player        e.g. “Basketball”
         Fee      :   Coaching Fee          e.g.12500.00
         Write a function Player_Count() in Python that would read contents of the
         file “CLUB.DAT” and display the details of those players whose fee is above
         7500. Also display number of players paying fee above 10000
10 | P a g e