• Home
  • Courses
  • School
  • Programs
  • Problems
  • Contact Us
  • My account
  • Register

Have any question?

(+91) 98222 16647
info@simplycoding.in
RegisterLogin
Simply Coding
  • Home
  • Courses
  • School
  • Programs
  • Problems
  • Contact Us
  • My account
  • Register

Sample Papers

Class 12 CBSE COMPUTER SCIENCE Sample Question Paper Answer sheet

  • Categories Sample Papers

Class XII
COMPUTER SCIENCE – NEW (083)
SAMPLE QUESTION PAPER (2021 – 22)
Max Marks: 70
Time: 3 hrs

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:
    • Section – I is short answer questions, to be answered in one word or one line.
    • 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
    • Section-I is short answer questions of 2 marks each in which two questions have internal options.
    • Section-II is long answer questions of 3 marks each in which two questions have internal options.
    • Section-III is very long answer questions of 5 marks each in which one question has question has internal option.
Part-A
Section-I
Select the most appropriate option out of the options given for each question. Attempt any 15 questions from question no 1 to 21.

1 . Identify the Python data types?
       a. “And” b. {‘name’: 26} c. [26, 24] d. (‘My’, ‘data’)       
Ans. a. String, b. Dictionary c. List d. Tuple

2 . A twisted pair cable is a pair of_________ wires that are twisted together to improve electromagnetic capability
Ans. Insulated

3 . Rita wants to display a column “TYPE” in table ACCOUNT. Write SQL statement to show which command she should use to select the column and give it an alias “EVENT TYPE”?  
Ans. SELECT TYPE as “EVENT TYPE” from ACCOUNT;

4 . Which is the default sorting order used in ORDER BY clause?
Ans. ASC

5 . Name the Python Library modules which need to be imported to invoke the following functions :
       i. writerow( )
      ii. dump ( )

Ans. 
       i . csv
      ii . Pickle

6 . _____ is the amount of data transmitted via a given communications Channel in a given unit of time.
Ans. bandwidth

7 . What is the value of c after executing these statements?
        c = 7//4
      a. 3         b. 1       c. 1.75        d. The statement is incorrect
Ans. b is correct.

8 . Which command is used to view a table structure?

Ans. DESC or DESCRIBE

9 . What is an Alternate Key?
Ans. A candidate key that is not the primary key is called an Alternate Key.
For example in Student table if there are two candidate keys – StudId and Stud_Name and StudId is the primary Key then Stud_Name is the alternate key.

10 . Give 2 mutable and 2 immutable types in Python?
Ans. Mutable: list, dictionary
          Immutable: string, int, tuples

11 . ___________ is a process of storing data into files and allows it to perform various tasks such as read, write, append, search and modify in files.
Ans. File Handling

12 . Which constraint makes sure that all values in a column satisfy a certain criteria?
Ans. CHECK

13 . Write an SQL query to print details of workers excluding FIRST_NAME, “Ronit” and “Nitin” from WORKER table.

Ans. Select * from WORKER where FIRST_NAME not in  (‘Ronit’ ‘Nitin’);

14 . Which one of these is output of these Python commands? 
           L = [1,3,5,3,1]
           print (L.index(3),L.count(3)))
                a) 12
                b) 1 2
                c) 22
               d) 2 2
Ans. b

15 . What is the output of these Python commands? 
           A = (1,2,(3,4),5)
          print (len(A), A[2])
Ans. 4 (3, 4)

16 . __________command will test the connectivity between two host
Ans.  Ping

17 . What is the output of the following commands?

          score =20
          while score > 1:
             score=score//2-1
             print(score,end=’ ‘)
Ans. 9 3 0

18 . Ronit downloaded a harmless looking game from internet. Soon his computer started abnormal functioning. Sometimes it would restart by itself and sometimes it would stop different applications running on it. Which of the following options out of (i) to (iv), would have caused the malfunctioning of the computer?
         a. Trojan Horse
         b. Spam Mail
         c. Computer Bacteria
        d. Hardware breakdown
Ans. a. Trojan Horse

19 . To read 4th line from text file, which of the following statement is true? 
             a. dt = f.readlines();print(dt[3])
             b. dt=f.read(4) ;print(dt[3])
             c. dt=f.readline(4);print(dt[3])
             d. All of these

Ans. a. dt = f.readlines();print(dt[3])

20 . Which protocol is used for transferring files from one computer to another?
Ans. FTP

21 . Stack is _____ data structure. 
           a. FIFO
           b. LIFO
           c. POP
           d. None of above.
Ans. b. LIFO

Section-II
Both the Case study based questions(22 & 23) are compulsory. Attempt any 4 sub parts from each question. Each sub question carries 1 mark.

22 .Observe the following table carefully and Answer the following questions. 

Table: Store

Item codeItemQtyRate
10Gel pen classic115025
11Sharpener150010
12Ball pen 0.5160012
13Eraser16005
15Ball pen 0.2580020

       a. In the above table, can we have Qty as primary key?
       b. What is the cardinality and degree of the above table?
       c. Write a query to display the structure of table store from Mall Database.
       d. Give the output of following query.
                 Select distinct Item from Store;
       e. If we want to display maximum rate in store from Mall Database. Which command will be use the following:
                a. Select min(rent) from resort;
                b. Select minimum(rent) from mall;
                c. Select min(rent) from mall;
                d. Select minimum(rent) from resort;
Ans.
        a. We cannot use Qty as primary key because there is a duplication of values and primary key value cannot be duplicate.
        b. Degree =4
            Cardinality = 5
        c. Describe store;
        d.

Item
Gel pen classic
Sharpener
Ball pen 0.5
Eraser

        e. a. Select min(rent) from resort;

23 . Nyra has a branch1.csv file which has the name, class and section of students. She receives a branch2.csv which has similar details of students in second branch. She is asked to add the details of branch2,csv into branch1.csv. As a programmer, help her to successfully execute the given task.

__a__ csv
file = open('branch1.csv', __b__ , newline="");
writer = csv. __c__ (file)
with open('branch2.csv','r') as csvfile:
data = csv.reader(csvfile)
for row in data:
writer.writerow(__d__)
file. __e__ ()

a. Name the command she should use to include csv library.
b. In which mode she should open the file to add data into the file
c. Name the csv method which returns the object responsible for converting user’s data into delimited
strings
d. Fill in the blank with the information that needs to be written to csvfile.
e. Fill in the blank to close the file.

Ans.

import csv
file = open('branch1.cs','a', newline="");
writer = csv.writer(file)
with open('branch2.csv','r') as csvfile:
data = csv.reader(csvfile)
for row in data:
writer.writerow(row)
file.close()
Part-B
Section-I

24 . Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

c=dict{}
n=input("enter total number")
i=1
while I <= n:
a=input("enter place")
b=input("enter number")
c[a]=b
i=i+1
print("place","\t","number")
for i in c:
print i + "\t"+ c[i]

Ans.

c=dict{}
n=input("enter total number")
i=1
while I <= n:
a=input("enter place")
b=input("enter number")
c[a]=b
i=i+1
print("place","\t","number")
for i in c:
print i + "\t"+ c[i]

25 . Give full forms of the following? 
             1. VOIP,      2. ARPANET,      3. SMTP,       4. RFID
Ans. 
         1. VOIP- Voice over Internet Protocol
        2. ARPANET – Advanced Research Projects Agency Network)
        3. SMTP- Simple Mail Transfer Protocol
        4. RFID-Radio Frequencies Identification

26 . Define String in Python?     
Ans.  String in Python is formed using a sequence of characters. Value once assigned to a string cannot be modified because they are immutable objects. String literals in Python can be declared using double quotes or single quotes.
        Example:
                print(“Simply Coding”)
                print(‘ Simply Coding ‘)

27 . Find and write the output of the following python code:   

a=['Cat','Dog','cat','Dog']
def manip(f1):
animal={}
for index in f1:
if index in animal:
animal [index] += 1
else:
animal[index] =1
return(animal)
ret = manip(a)
print (ret)
print (len(ret))

Ans. {‘Cat’: 1, ‘Dog’: 2, ‘cat’: 1}
          3

28 . What is the difference between packet switching and circuit switching techniques?
Ans.Circuit Switching In this, first complete physical connection between two computers is established. After that data is transmitted from the source computer to the destination computer.
       e.g. In telephone call, circuit switching is used.
Packet Switching In this, data is divided into packets. And they are sent without any reservation of resources. Each packet has destination address and transmission is done by intermediate routers. It makes it less reliable but there is less wastage of resources.

29 . Which option is NOT the possible outcome(s) executed from the following code?

import random
def main():
p = "MY PROGRAM"
i = 0
while p[i] != "R":
l = random.randint(0,3) + 5
print (p[l],end ="_")
i += 1
main()
CBSE 12 Q29

Ans. (i) will not be printed

30 . Define the following terms : 
          i. Relation
         ii. Tuple
       iii. Attribute
       iv. Domain
Ans. 
      i. Relation: A relation is a two-dimensional table. It contains number of rows (tuples) and columns (attributes).
     ii. Tuple: This is the horizontal part of the relation. One row represents one record of the relation. The rows of a relation are also called tuples.
     iii. Attribute: The columns of a table are also called attributes. The column is the vertical part of the relation.
     iv. Domain: A domain is a pool of values from which the actual values present in a given column are taken.

31 . What is join in SQL? What is difference between Inner-join and Full join?
Ans. Join clause is used to combine rows from two or more tables, based on a related column between them. It is used to merge two tables or retrieve data from there.
         Inner join: Inner Join in MySQL is the most common type of join. It is used to return all the rows from multiple tables where the join condition is satisfied.
         Full Join: Full join returns all the records when there is a match in any of the tables. Therefore, it returns all the rows from the left-hand side table and all the rows from the right-hand side table.

32 . Evaluate the following postfix expression using stack and show the contents of stack after execution of each expression 
         120, 45, 20, + , 25, 15, – , + , *
Ans.

Scanned ElementsOperationStack Status
120Push120
45Push120,45
20Push120,45,20
+Pop twice
45+20=65
Push
120,45,20, 25
25Push

120,65
15Push120, 65, 25,15
–Pop Twice
25-15=10
Push


120,65,10
+Pop Twice
65+10=75
Push


120,75
*Pop twice
120*75=9000
Push


9000

33 . Differentiate between CHAR and VARCHAR datatypes in SQL?

Ans.

charvar char
CHAR stands for “Character”VARCHAR stands for “Variable Character”
fixed lengthvariable length
Uses Static memory AllocationUses Dynamic memory allocation
use when data values in a column are of same length.use when data values in a column are of Variable length.

Section-II

34 . Write a python function to sum the sequence given below. Take the input n from the user.
Ans.

def fact(x):
j=1
res=1
while j<=x:
res=res*j
j=j+1
return res
n=int(input(" the number : "))
i=1
sum=1
while i<=n:
f=fact(i)
sum=sum+1/f
i+=1
print(sum)

35 . Write a function program to do a binary search in an array.
Ans.

def bsearch (AR,ITEM):
beg=0
last=len(AR)-1
while(beg<=last):
mid=(beg+last)//2
if(ITEM==AR[mid]):
return mid
elif(ITEM>AR[mid]):
beg=mid+1
else:
last=mid-1
else:
return False
AR= [2,5,6,7,8,10]
ITEM= int(input("Enter item to be searched"))
index=bsearch(AR,ITEM)
if index:
print("Found")
else :
print("Not Found")

36 .Write a program to count the number of upper-case alphabets present in a text file “PYTHON.TXT”
Ans.

string=input("Enter string:")
count=0
for i in string:
if(i.isupper()):
count=count+1
print("The number of uppercase characters is:")
print(count)

                                                              Or

Write a function which takes in an input file and output file. It copies all lines which starts with vowels from the input file to output file.
Ans. 

def Lower(infile,outfile):
output=open("w")
file=open(infile)
for line in file:
if line[0] in "aeiouAEIOU":
output.write(line)
output.close()
file.close()

37 . Consider the following tables RESORT and OWNEDBY and answer questions.

 Table : RESORT

RCODEPLACERENTTYPESTARTDATE
R001GOA150005 STAR12-JAN-02
R002HIMACHAL90004 STAR20-DEC-07
R003KERALA125005 STAR10-MAR-06
R004HIMACHAL105002 STAR25-NOV-05
R005GUJARAT80007 STAR01-JAN-03
R006GOA180004 STAR30-MAR-08
R007ORISSA75002 STAR12-APR-99
R008KERALA110005 STAR03-MAR-03
R009HIMACHAL90002 STAR15-OCT-08
R010GOA130005 STAR12-APR-06

Table : OWNEDBY
PlaceOwner
GoaRaj Resorts
KeralaKTDC
HimachalHTDC
GujaratMAHINDRA RESORTS
OrissaOTDC

Give output for the following SQL queries:
         1. Select min(rent) from resort where place = ‘KERALA’;
         2. Select type, start date  from resort where type ‘2 STAR’ orderby startdate,
         3. Select place, owner  from ownedby where place like “%a”;

Ans.
        1 .

Min(rent)
11000

        2 .
TypeStart Date
2 STAR1999-04-12
2 STAR2005-11-25
2 STAR2008-10-15

        3 .
PlaceOwner
GoaRaj Resorts
KeralaKTDC
OrissaOTDC

Section III

38 . Write answer of the following
Simply Coding is a computer institute aimed to uplift the standard of computer knowledge in the society. It is planning to setup its training centres in multiple towns and villages pan India with its head offices in the nearest cities. They have created a model of their network with A city, C Town and 3 Villages as given.
As a network consultant, you have to suggest the best network related solution for their issues/problems raised in (i) to (iv) keeping in mind the distance between various locations and given parameters.

CBSE 12 Q38 1

Shortest distance between various locations:

Village 1, 2, 3 to C Town1 to 2 km
Distance between the villages3 – 4 km
City Head Office to C Town50 km

Number of computers installed at various locations are as follows:

C Town50
Village 110
Village 215
Village 38
City Head Office25

1. Suggest the most appropriate location of the SERVER in the HUB (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
2. Suggest the best wired medium for network.
3. Draw the cable layout (location to location) to efficiently connect various locations within the HUB
4. Which hardware device will you suggest to connect all the computers within each location of HUB?
5. Which server/protocol will be most helpful to conduct live interaction of Experts from Head office and people at HUB locations?

Ans.

1. C TOWN as it has the maximum number of computers and it is closest to all other locations.
2. Optical Fiber is recommended as there is going to be live interactions with head office
3. The cable layout:

CBSE 12 Q38 2

4. Switch or Hub
5. Video conferencing or VoIP.

39 . Consider the following tables EMPLOYEE and SALGRADE and answer this question:

Table : Employee

EcodeNameDesignSGradeDOJDOB
101Abdul AhmadExecutiveS0323-Mar-200313-Jan-1980
102Ravi ChanderHead-ITS0212-feb-201022-Jul-1987
103John KenReceptionistS0324-Jun-200924-Feb-1983
105Nazar AmeenGMS0211-Aug-200603-Mar-1984
108Priyam SenCEOS0129-Dec-200419-Jan-1982

Table : SalGrade
SgradeSalaryHRA
S015600018000
S023200012000
S03240008000

Write SQL commands for the following statements
i. To display the details of all employees in descending order of DOJ.
ii. To display NAME and DESIGN of those employees, whose salary grade is either S02 or S03.
iii. To display the content of all EMPLOYEE table, whose DOJ is in between ’09-Feb-2006′ and ’08- Aug-2009′.
iv. To display the details of all employee who has joined before 1985 from employee table.
v. To add a new row with the following data:
        109, ‘Harish Roy’, ‘Head-IT’, ‘S02, ’09-
        Sep-2007′, ’21-Apr-1983’

Ans.
    i. Select * from employee order by doj desc;
   ii. Select name, design from employee where sgrade = “s02” or sgrade = “so3;
  iii. Select * from employee where doj between ’09-feb-2006′ and ’08- aug -2009’
  iv. select * from employee where joindate&lt;’01-jan-1985′;
   v. Insert into employee values(109, “Harish Roy”, “Head-IT”, “S02”, ’2007-09-09′, ’1983-04-21′);

40 . Write a function writefile() to write numbers into a binary file and another function readfile() to read and print the same.
Ans.

import pickle
def writefile():
file= open("data.dat",&'wb')
while True:
x= int(input("Enter number"))
pickle.dump(x,file)
ans=input("Want to enter more data Y/N")
if ans.upper()=='N':
break
file.close()
def readfile():
print ("Reading from file")
file=open("data.dat", 'rb')
while True:
try:
y=pickle.load(file)
print (y)
except EOFError:
break
file.close()
writefile()
readfile()

                            OR

A binary file “phonebook.dat” has structure [Name, PhoneNo].
i. Write a user defined function append_record() to input data for a record and add to phonebook.dat .
ii. Write a function search_record() in Python which takes in a name and prints only those records which matches that name.

Ans.

def append_record():
outfile = open('phonebook.dat', 'ab')
while True:
name = input("Enter name: ")
no = input("Enter Phone No: ")
phoneno = [name,no]
pickle.dump(phoneno, outfile)
ans=input("Want to enter more data Y/N")
if ans.upper()=='N':
break
#close the file
outfile.close()

def search_record():
infile = open('phonebook.dat','rb')
name = input("Enter name to search:")
while True:
try:
phoneno = pickle.load(infile)
if(phoneno[0] == name) :
print (phoneno[0], " ",phoneno[1])
except EOFError:
break
#close the file
infile.close()
append_record()
search_record()
  • Share:
author avatar
Simply Coding

Previous post

Class 12 CBSE COMPUTER SCIENCE Sample Question Paper
July 20, 2021

Next post

Java Data Types
July 20, 2021

You may also like

cbse 12 Specimen
CBSE Class 12 Computer Science Marking Scheme (2020-21)
28 August, 2021

Leave A Reply Cancel reply

You must be logged in to post a comment.

Categories

  • Uncategorized
  • Programs
    • Python
    • Java
  • Problems
    • Python
    • Java
    • Web Development
      • Internet
    • Emerging Technologies
  • Notes
    • General
    • QBasic
    • MS Access
    • Web Development
      • XML
      • HTML
      • JavaScript
      • Internet
    • Database
    • Logo Programming
    • Scratch
    • Emerging Trends
      • Artificial Intelligence
      • Internet of Things
      • Cloud Computing
      • Machine Learning
    • Computer Fundamentals
      • Computer Networks
      • E-Services
      • Computer Hardware
    • Python
    • Java
  • School
    • ICSE
      • Computers Class 9
        • Java Introduction
        • Tokens & Data Types
        • Java Operators
        • Math Library
        • if & switch
        • For & While
        • Nested loops
      • Computer Class 10
        • Sample Papers
        • OOPS concepts
        • Functions in Java
        • Constructors
        • Arrays in Java
        • Strings in Java
    • SSC
      • IT Class 11
        • IT Basics
        • DBMS
        • Web Designing
        • Cyber Laws
      • IT Class 12
        • Web Designing
        • SEO
        • Advanced JavaScript
        • Emerging Tech
        • Server Side Scripting
        • E-Com & E-Gov
      • Computer Science 11
      • Computer Science 12
    • CBSE
      • Computer 9
        • Basics of IT
        • Cyber Safety
        • Scratch
        • Python
      • Computer 10
        • Sample Papers
        • Networking
        • HTML
        • Cyber Ethics
        • Scratch
        • Python
      • Computer Science 11
        • Computer Systems
        • Python 11
          • Python Basics
          • Python Tokens
          • Python Operators
          • Python if-else
          • Python loops
          • Python Strings
          • Python List
          • Python Tuple
          • Python Dictionary
          • Python Modules
        • Data Management
      • Computer Science 12
        • Sample Papers
        • Python 12
          • Python Functions
          • Python File Handling
          • Python Libraries
          • Python Recursion
          • Data Structures
        • Computer Networks
        • Data Management
    • ISC
      • Computer Science 11
        • Introduction to Java
        • Values & Data Types
        • Operators
        • if & switch
        • Iterative Statements
        • Functions
        • Arrays
        • String
        • Data Structures
        • Cyber Ethics
      • Computer Science 12
        • Sample Papers
        • Boolean Algebra
        • OOPS
        • Wrapper Classes
        • Functions
        • Arrays
        • String
Simply Coding Computer Courses for School                Privacy Policy     Terms of Use     Contact Us

© 2021 Simply Coding

Login with your site account

Lost your password?

Not a member yet? Register now

Register a new account

Are you a member? Login now