0% found this document useful (0 votes)
2K views

Sample Questions Paper (FINAL) 1

This document contains instructions for a Class XII Computer Science sample paper. It has two parts: Part A has short answer and case study questions. Candidates must attempt any 15 questions from Section I and any 4 sub-parts from each case study in Section II. Part B is descriptive and has questions in three sections - short answer questions of 2 marks, long answer questions of 3 marks, and very long answer questions of 5 marks. All programming questions must be answered using Python.

Uploaded by

VijayaBabu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Sample Questions Paper (FINAL) 1

This document contains instructions for a Class XII Computer Science sample paper. It has two parts: Part A has short answer and case study questions. Candidates must attempt any 15 questions from Section I and any 4 sub-parts from each case study in Section II. Part B is descriptive and has questions in three sections - short answer questions of 2 marks, long answer questions of 3 marks, and very long answer questions of 5 marks. All programming questions must be answered using Python.

Uploaded by

VijayaBabu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

CLASS XII COMPUTER SCIENCE (083)

SAMPLE PAPER – 1 (THEORY) (2020-21)


(SOLVED)
Maximum Marks: 70 Time Allowed: 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:
(a) Section I is short answer questions, to be answered in one word or one line.
(b) Section II has two case study questions. Each case study has 5 case-based sub-parts. An examinee is
to attempt any 4 out of the 5 sub-parts.
4. Part B is Descriptive Paper. Part B has three sections:
(a) Section I is short answer questions of 2 marks each in which two questions 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 options.
5. All programming questions are to be answered using Python language only.

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 and write the name of the module to which the following functions belong: (1)
(i) ceil() (ii) dump()
Ans. (i) ceil() – math module (ii) dump() – json module or pickle
2. Write the type of tokens from the following: (1)
(i) if (ii) roll_no
Ans. (i) Key word (ii) Identifier
3. Which of the following is a valid arithmetic operator in Python: (1)
(i) // (ii) ? (iii) < (iv) and
Ans. (i) //
4. Which command is used to convert text into integer value? (1)
Ans. int()
5. Write the necessary command to incorporate SQL interface within Python. (1)
Ans. import MySQLdb
OR
import mysql.connector
OR
import pymysql
6. Which is the correct form of declaration of dictionary? (1)
(i) Day={1:'monday',2:'tuesday',3:'wednesday'}
(ii) Day=(1;'monday',2;'tuesday',3;'wednesday')
(iii) Day=[1:'monday',2:'tuesday',3:'wednesday']
(iv) Day={1'monday',2'tuesday',3'wednesday']
Ans. (i) Day={1:'monday',2:'tuesday',3:'wednesday'}
7. Identify the valid declaration of L: (1)
L = [1, 23, 'hi', 6]
(i) List, (ii) Dictionary, (iii) Array, (iv) Tuple.
Ans. (i) List
8. Find and write the output of the following Python code: (1)
x = "abcdef"
i = "a"
while i in x:
   print(i, end = " ")
Ans. aaaaaa----- OR infinite loop
9. ............................. is an example of Public cloud. (1)
Ans. Google Drive or any other correct example.
10. .................................. is a network of physical objects embedded with electronics, software, sensors and
network connectivity. (1)
Ans. Internet of Things OR Internet
11. Find and write the output of the following Python code: (1)
a=10
def call():
  global a
  a=15
  b=20
  print(a)
call()
Ans. 15
12. Write any 1 advantage and 1 disadvantage of Bus topology. (1)
Ans. Advantage: Since there is a single common data path connecting all the nodes, the bus topology uses a
very short cable length which considerably reduces the installation cost.
Disadvantage: Fault detection and isolation is difficult. This is because control of the network is not
centralized in any particular node. If a node is faulty on the bus, detection of fault may have to be
performed at many points on the network. The faulty node has then to be rectified at that connection
point.
13. Write the category of the following functions used in SQL: sum(), max(), min(), and count(). (1)
Ans. Aggregate functions
14. Which of the following is a DML command? (1)
(i) SELECT (ii) ALTER
(iii) CREATE (iv) DROP
Ans. (i) SELECT
15. Name the most suitable wireless transmission media for connecting to hilly areas. (1)
Ans. Radiowaves
16. List out various modes of opening of Python files. (1)
Ans. ['r','r+','w','w+','a','a+'] (Any four)
Computer Science with Python–XII

17. Observe the following code and answer the questions that follow: (1)
File = open("Mydata","a") __________#Blank1
File.close()
(i) What type (Text/Binary) of file is Mydata?
(ii) Fill in Blank 1 with a statement to write “ABC” in the file “Mydata”.
Ans. (i) Text File (ii) File.write("ABC")
18. Write a query in SQL to display the list of existing databases. (1)
Ans. show databases;
19. Write the expanded form of SMTP. (1)
Ans. Simple Mail Transfer Protocol

A.2
20. Which of the following type(s) of table constraints will ensure that the field should not be left blank? (1)
(i) NULL (ii) Distinct
(iii) Unique (ii) NOT NULL
Ans. (iv) NOT NULL
21. The following is a 32-bit binary number usually represented as 4 decimal values, each representing 8 bits,
in the range 0 to 255 (known as octets) separated by decimal points. (1)
  140.179.220.200
What is it? What is its importance?
Ans. It is an IP (Internet Protocol) Address. It is used to identify the computers on a network.

 Section II
Both the case study-based questions are compulsory. Attempt any 4 sub-parts from each question. Each sub-part
carries 1 mark.

22. A shop called Trends Garments that sells school uniforms maintains a database SCHOOL_UNIFORM as
shown below.
It consists of two relations — UNIFORM and PRICE

Uniform_Code Uniform_Name Uniform_Color


1 Shirt White
2 Trouser Grey
3 Skirt Blue
4 Tie Grey
5 Socks Blue and Grey checks
6 Belt Blue

Uniform_Code Size Price


1 XL 600
1 L 680
2 L 780
2 M 560
2 XXL 900
3 S 1000
3 M 170
3 L 150
4 XL 210
4 XXL 210
5 M 110
5 S 150
Sample Papers (Theory) (Solved)

6 L 160
6 XL 620
(a) Identify the attribute best suitable to be declared as a primary key. (1)
Ans. Uniform_Code.
(b) Write the degree and cardinality of the table UNIFORM. (1)
Ans. Degree – 3, cardinality – 6.
(c) The PRICE relation has an attribute named Price. In order to avoid confusion, write SQL query to
change the name of the relation PRICE to COST. (1)
Ans. ALTER TABLE PRICE
CHANGE Price COST integer; A.3
(d) The owner wishes to remove the existing table PRICE for the new session from the database
SCHOOL_UNIFORM. Which command will he use from the following? (1)
(i) DELETE FROM SCHOOL_UNIFORM; (ii) DROP TABLE PRICE;
(iii) DROP DATABASE SCHOOL_UNIFORM; (iv) DELETE PRICE FROM SCHOOL_UNIFORM;
Ans. DROP TABLE PRICE;
(e) Now the owner wants to display the structure of the table UNIFORM, i.e., name of the attributes and
their respective data types that he has used in the table. Write the query to display the same. (1)
Ans. desc UNIFORM;
   OR
describe UNIFORM;
23. Deepesh works as a programmer with Delta Technologies. He has been assigned the job of generating
salary of all employees using the file “employee.csv”. He has written a program to read CSV file
“employee.csv” which will contain details of all the employees. He has written the following code. As a
programmer, help him to successfully execute the given task.
import______ # Line 1
def readCsvEmp( ): # to read data from the CSV file
   with ______('employees.csv', newline='') as f: # Line 2
     reader = csv.______ (f) # Line 3
     data_list = ______(reader) # Line 4
   ____ (data_list) # Line 5
(a) Name the module he should import in Line 1. (1)
Ans. import csv
(b) Write the method that he should use to open the file to read data from it. (1)
Ans. open
(c) Fill in the blank in Line 3 to read the data from a csv file. (1)
Ans. reader
(d) Fill in the blank in Line 4 with the method to convert the data read from the file into list. (1)
Ans. list
(e) Write the command to display the contents read from the csv file. (1)
Ans. print

PART B – Section I
24. Rewrite the following code in Python after removing all syntax error(s). Underline each correction done
in the code. (2)
Num = int(("Number:"))
Sum = 20
for i in range(10,Num,3)
  Sum+=i
  if i%2=0:
    print i*2
Computer Science with Python–XII

  else:
  print i*3
  print Sum
Ans. Num = int(input("Number:"))
Sum = 0
for i in range(1,Num,3):
  Sum+=i
  if i%2==0:
    print (i*2)
   else:
    print (i*3)
A.4 print (Sum)
25. Differentiate between star topology and bus topology. (2)
      OR
Compare freeware and shareware.
Ans.
Star topology Bus topology
A central hub is required to connect all computers A long cable known as backbone is used to connect
with each other. all computers with each other.
Data is transmitted from the sender to the Data is transmitted through a long cable from the
receiver by passing through the hub. sender to the receiver.
No collision takes place through transmission of Collision can take place as the data can be
data. transmitted from both ends at the same time.
If the central hub fails, the entire network shuts If there is a fault in a cable or terminator, no
down. transmission takes place.
OR
Freeware is a computer software that is available for use without any cost or for an optional fee. The
author usually restricts one or more rights—to copy, distribute and make derivative works of the
software.
Shareware is a software that provides a trial version for a particular duration. Once the trial period is over,
the program may stop running until a licence is purchased. Shareware is often offered without support,
updates or help menus which only become available after the purchase of a licence.
26. Expand the following terms: (2)
(i) CDMA (ii) GSM
(iii) LAN (iv) WLL
Ans. (i) Code Division Multiple Access (ii) Global System for Mobile Communications
(iii) Local Area Network (iv) Wireless Local Loop
27. Ram was asked to accept a list of odd numbers but he did not put the relevant condition while accepting
the list of numbers. You are required to write a user-defined function oddtoeven(L) that accepts the
List L as an argument and convert all the even numbers into odd by multiplying them by 2 and plus 1.
(2)
      OR
Write a program to read a number and print its factorial values.
Ans. def oddtoeven(L):
  for i in range(len(L)):
  if (L[i]%2==0):
   L[i]=L[i]*2+1
      OR
f=1
n=int(input("Enter number"))
for i in range(2,n+1):
  f=f*i
Sample Papers (Theory) (Solved)

print("Factorial value = ",f)


input = 5
output
factorial value = 120
28. Write a user-defined function in Python that counts the number of lines starting with ‘H’ in the file ONE.txt.
Eg. if the file contains: (2)
Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
A.5
Then the line count should be 2.
Ans. def countH():
  f = open ("ONE.txt", "r")
  lines =0
  l = f.readlines()
  for i in l:
   if i[0] = = 'H' :
   lines=lines+1
  print("no. of lines is",lines)
  f.close()
29. Study the following program and select the possible output(s) from options (i) to (iv) following it. Also,
write the maximum and the minimum values that can be assigned to the variable Y. (2)
X= random.random()
Y= random.randint(0,4) print(int(X),":",Y+int(X))
(i) 0 : 0 (ii) 1 : 16
(iii) 2 : 4 (iv) 0 : 3
Ans. (i) and (iv) are the possible outputs. Minimum value that can be assigned is – Y = 0. Maximum value that
can be assigned is – Y = 3.
30. What do you understand by local and global scope of variables? How can you access a global variable
inside the function if function has a variable with the same name? (2)
Ans. A global variable is a variable that is accessible globally. A local variable is one that is only accessible to
the current scope, such as temporary variables used in a single function definition.
A variable declared outside of the function or in global scope is known as global variable. This means
global variable can be accessed inside or outside of the function whereas local variable can be used only
inside of the function. We can access a global variable by declaring it as global A.
31. What are the aggregate functions in SQL? (2)
Ans. Aggregate functions are those functions that return single value from a group of values of a column. These
functions are also called multiple row functions or group functions. There are several group functions
such as:
SUM(), AVG(), MAX(), MIN(), COUNT().
32. What do you understand by Transmission Medium? Give its types with examples. (2)
Ans. The medium over which the data or signal can travel from one computer to another for communication
is called a Transmission Media or Channel. Its types: Guided Media and Unguided Media.
(i) Guided Media use wires for transmitting data from one device to another. They are also known as wired
media. They use various types of cables, e.g., Twisted Pair Cable, Coaxial Cable.
(ii) Unguided Media are the wireless media that transport electromagnetic waves without using a physical
conductor. Signals are broadcast through air. This is done through radio waves, microwaves, satellite
communication and cellular telephony.
33. Find and write the output of the following Python code: (2)
Computer Science with Python–XII

Lst1 = ["20","50","30","40"]
CNT = 3
Sum = 0
for I in [7,5,4,6]:
  T = Lst1[CNT]
  Sum = float (T) + I
  print (Sum)
  CNT-=1
Ans. 47.0
35.0
54.0
A.6 26.0
 Section II
34. Consider a pickled file FACTORY.DAT that consists of a field FCTID. Write a program in Python to search
a record based on factory Id, i.e., if FCTID is matching with the value–105, the entire record is to read
from the file, and if found, should call a Display() function to display the output. (3)
Ans. import pickle
file=open('FACTORY.DAT','rb')
try:
  while True:
  f=pickle.load(file)
  if f.FCTID==105:
   f.Display()
except EOF Error:
   pass
file.close ( )
35. Write a MySQL-Python connectivity to retrieve data, one record at a time, from city table for employees
with id less than 10. (3)
      OR
What are the basic steps to connect Python with MySQL using table Members present in the database
‘Society’?
Ans. import MySQLdb as my
try:
  db = my.connect(host="localhost", user="root", passwd="",
          database="company")
  cursor = db.cursor()
  sql = "select * from city where id < 10"
  number_of_rows = cursor.execute(sql)
  print(cursor.fetchone()) # fetch the first row only
  db.close()
except my.DataError as e:
  print("DataError")
  print(e)
      OR
import MySQLdb
conn = MySQLdb.connect(host="localhost", user='root', password =' ',
              database="Society")
cursor= conn.cursor()
cursor.execute('SELECT COUNT(MemberID) as count FROM Members
WHERE id = 1')
row = cursor.fetchone()
conn.close()
print(row)
36. Consider Table COACHING as shown below. Write commands in SQL for the following queries: (3)
Sample Papers (Theory) (Solved)

ID Name AGE CITY FEE PHONE


P1 SAMEER 34 DELHI 45000 9811076656
P2 ARYAN 35 MUMBAI 54000 9911343989
P4 RAM 34 CHENNAI 45000 9810593578
P6 PREMLATA 36 BHOPAL 60000 9910139987
(a) Write query details from coaching table where fee is between 30000 and 40000.
Ans. Select * from coaching where fee between 30000 and 40000;
(b) Write a query to find the average fee grouped by age from customer table.
Ans. Select avg(fee) from coaching group by age; A.7
(c) Write a query to display name in descending order whose age is more than 23.
Ans. Select name from coaching where age>23 order by name desc;
37. Write a function in Python, do_Push(Num) and do_Pop(Num) to add a new Number and delete a
Number from a List of Numbers, considering them to act as push and pop operations of the
Stack data structure. (3)
OR
Write a function in Python, INSERT_QUEUE(List1,data) and DELETE_QUEUE(List1) for performing
insertion and deletion operations in a Queue. List1 is the list used for implementing queue and data is the
value to be inserted.
Ans. def do_Push(Num):
  a=int(input("Enter number: "))
  Num.append(a)
def do_Pop(Num):
  if (Num==[]):
  print("Stack empty")
  else:
   print ("Deleted element",Num.pop())
      OR
def INSERT_QUEUE():
  data=int(input("Enter data to be inserted: "))
  List1.append(data)
def DELETE_QUEUE(List1):
  if (List1==[]):
   print( "Queue empty")
  else:
   print "Deleted element is: ", List1 [0])
   del(List1 [0])

 Section III
38. Keep Well Medicos Centre has set up its new centre in Dubai. It has four buildings as shown in the diagram
given below: (5)

Accounts Research Lab

Store Packaging Unit



Distances between various buildings are as follows:
Accounts to Research Lab 55 m
Computer Science with Python–XII

Accounts to Store 150 m


Store to Packaging Unit 160 m
Packaging Unit to Research Lab 60 m
Accounts to Packaging Unit 125 m
Store to Research Lab 180 m

Number of computers:
Accounts 25
Research Lab 100
Store 15
A.8 Packaging Unit 60
As a network expert, provide the best possible answer for the following queries:
(i) Suggest the type of network established between the buildings.
Ans. LAN (Local Area Network)
(ii) Suggest the most suitable place (i.e., building) to house the server of this organization.
Ans. Research Lab as it has the maximum number of computers.
(iii) Suggest the placement of the following devices with justification:
(a) Repeater (b) Hub/Switch.
Ans. (a) Repeater: It should be placed between Accounts to Store, Store to Packaging, Accounts to Packaging
and Store to Research Lab as the distance between all is greater than 70m.
(b) Switch should be placed in each of the buildings for better traffic management.
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or from the network.
Ans. Firewall.
(v) Suggest the most suitable wired medium for efficiently connecting each computer installed in every
block out of the following network cables:
• Coaxial Cable
• Ethernet Cable
• Single Pair Telephone Cable
Ans. Ethernet Cable
39. Write commands for SQL queries (i) to (iii) and output for (iv) and (v), which are based on the tables
TRAINER and COURSE. (5)
            TRAINER
TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998-10-15 90000
102 ANAMIKA DELHI 1994-12-24 80000
103 DEEPTI CHANDIGARH 2001-12-21 82000
104 MEENAKSHI DELHI 2002-12-25 78000
105 RICHA MUMBAI 1996-01-12 95000
106 MANIPRABHA CHENNAI 2001-12-12 69000

            COURSE
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105
Sample Papers (Theory) (Solved)

(i) Display the Trainer Name, City and Salary in descending order of their Hiredate.
Ans. SELECT TNAME,CITY,SALARY FROM TRAINER ORDER BY HIREDATE DESC;
(ii) To display number of trainers from each city.
Ans. SELECT CITY, COUNT(*) FROM TRAINER GROUP BY CITY;
(iii) To display the TNAME and CITY of trainer who joined the institute in the month of December 2001.
Ans. SELECT TNAME,CITY FROM TRAINER WHERE HIREDATE BETWEEN '2001-12-01' AND
'2001-12-31';
(iv) SELECT TID, TNAME, FROM TRAINER WHERE CITY NOT IN('DELHI', 'MUMBAI');
Ans. TID TNAME
103 DEEPTI
106 MANIPRABHA A.9
(v) SELECT TID, COUNT(*), MIN(FEES) FROM COURSE GROUP BY TID HAVING COUNT(*)>1;
Ans. TID COUNT(*) MIN(FEES)
101 2 12000
40. Write a program to delete the third record from a file “Result.dat” which stores Roll number, Name and
Percentage of all the students. Records inside the file are separated by lines as shown below: (5)
12 Hazel 67.75
15 Jiya 78.5
16 Noor 68.9
17 Akshra 78.9
18 Naksh 78.0
23 Jivin 89.5
             OR
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).
Ans. import os
Fin = open("Result.dat", "r")
Fout = open ("temp.dat", "w")
count = 0
rec = " "

while rec:
   rec = Fin.readline()
     count = count + 1
    if count == 3:
      pass
    else:
      Fout.write(rec)
Fin.close()
Fout.close()
os.remove("Result.dat")
os.remove ("temp.dat", "Result.dat")
      OR
def Readfile():
   i = open("Employee.dat","rb+")
   x = i.readline()
    while(x):
Computer Science with Python–XII

      I = x.split(':')
      if((float(I[2])>=20000)and(float(I[2])<=40000)):
        print(x)
  i.close()

A.10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy