KEMBAR78
Comp Sample | PDF | Table (Database) | Computer Data
0% found this document useful (0 votes)
72 views13 pages

Comp Sample

This document contains a sample paper for Class XII Computer Science subject. It has four sections - A, B, C and D with a total of 70 marks. Section A contains short answer type questions carrying 1 or 2 marks each. Section B contains 4 marks questions. Section C contains short answer type questions. Section D contains 10 marks questions. The paper tests knowledge of Python programming, SQL commands and other Computer Science concepts. It provides instructions regarding duration of exam, maximum marks and distribution of questions in different sections.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views13 pages

Comp Sample

This document contains a sample paper for Class XII Computer Science subject. It has four sections - A, B, C and D with a total of 70 marks. Section A contains short answer type questions carrying 1 or 2 marks each. Section B contains 4 marks questions. Section C contains short answer type questions. Section D contains 10 marks questions. The paper tests knowledge of Python programming, SQL commands and other Computer Science concepts. It provides instructions regarding duration of exam, maximum marks and distribution of questions in different sections.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

DELHI PUBLIC SCHOOL

NAVI MUMBAI
SAMPLE PAPER 2022-2023

Class –XII M.Marks-70


Subject - Computer Science(083) Duration- 3 Hours

General Instructions :

(i) All questions are compulsory.

(ii) Question paper is divided into four sections - A, B, C and D.


• Section A : 30
• Section B : 15
• Section C : 15
• Section D : 10

SECTION A
1. (a) Which of the following is a valid variable(s) name in Python ? Justify
reason for it not being a valid name. 1
(i) Total marks
(ii) Name#list
(iii) _Classlist
(iv) Name123
(b) Which of the following are not valid relational operators in Python ? 1
(i) !=
(ii) >
(iii) =>
(iv) ==
(c) Name the Python Library modules which need to be imported to
invoke the following functions : 1
(i) ceil()
(ii) random()
(d) Rewrite the following code in Python after removing all syntax
error(s). Underline each correction done in the code. 2
B= = “welcome”
for i in B.upper():
if B NOT IN ‘aeiou’
print(‘y’)
else:
print('Not Ok')
(e) Find and write the output of the following Python code : 2
def fun(M,N):
for i in range(N):
L[i]=L[i+1]
L=[‘apple’,’grapes’,’banana’]
fun(L,2)
for i in L :
print(i,end='#')
(f) Find and write the output of the following Python code : 3
def FUN(P,Q=50):

P=P-Q
Q=P*Q
print(P,'@',Q)
return Q
R=10
S=20
S=FUN(R,S)
print (R,'@',S)
S=FUN(S)
print(R,'@',S)

P.T.O.
g. Consider the following code: 2
import random
x=random.random()
y=random.randint(0,4)
print(int(x),":",y+int(x))
Choose the possible output(s) from the given options. Also
write the least and highest value that may be generated.
i. 0:0
ii. 1:6
iii. 2:4
iv. 0:3

2. (a)
Write the type of tokens from the following. i. _Var ii. in 1

(b) Write a Python statement to declare a Dictionary named marks with


Keys as maths,phy,chem and corresponding values as 23,22,25
respectively. 1

(c) Which of the following symbol is used in Python for Multiline comments line
comment?
1. /*** 2. /* 3. “”” 4. # 1

(d) Write the output of the following Python code : 1


x = [[10.0, 11.0, 12.0],[13.0, 14.0, 15.0]]
y = x[1][2]
print(y)
(e) Write the output of the following Python code : 1
L= [10, 15, 20, 25, 30]
L.insert( 3, 4)
L.insert( 2, 3)
print(L[-5])
(f) Differentiate between ‘‘r’’ and ‘‘r+’’ file modes used in Python.
Illustrate the difference using suitable examples. 2
(g)
Deepesh works as a programmer with Delta Technologies. He has been assigned
the job of creating the file “employee.csv”. Help him to write a program to create
the CSV file “employee.csv” which will contain eno,name and salary for five
employees. 2
P.T.O.
OR
Consider the file employees.csv given in the previous question with the
given records. Write a program to read the file and display each record in
a different line 2

(h) Write a function Show() in Python to read the content of a text file
'NOTES.TXT' and display each word in different lines
Example, if the file contains : 2
"This is a test file"
Then the function should display the output as :
This
is
a
test
file

OR

Write a function Show_lines() in Python to read the content of a


text file 'NOTES.TXT' and display each line of the file a f t e r
r e v e r s i n g i t . Example, if the file contains : 2
Hello welcome
to DPS
Then the function should display the output as :
emoclew olleH
SPD ot
(i) Write a readb() function to search in a pickled file book.dat. The File book.dat is
created and the file contains details of books in [bno,name,price,author] format. The
function has to accept an author name and display all the books of that author
whose price is greater than 1000 . 3

OR

P.T.O.
Write a function createfile( ) to add a record in a binary file books.dat having record
of the format [ bookno , bookname , authorname , price] Write another function
check() that accepts an authorname as argument. It counts the number of books of
that author and returns the count.. If no record is found appropriate message has to
be displayed . 3

(j) Create a dictionary with the country name as key and its capital as value. Write a
program, with separate user defined functions to perform the following operations: ●
Push the keys (name of the country) of the dictionary into a stack, where the
corresponding value (capital) is ending with ‘it’. ● Pop and display the content of the
stack 4

OR

Accept a list containing 10 integers. You need to help him create a program with
separate user defined functions to perform the following operations based on
this list. ● Traverse the content of the list and push the numbers ending with 3
into a stack. ● 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, 33, 38]
Sample Output of the code should be: 33 13 4
SECTION B
Q3 a. 4
Write a program to create a text file ‘reports’ with five lines in it.
Display the count of the digits and sum up all the digits in it.

(d) (i) Consider a tuple T = (10, 15, 25, and 30). Identify the statement that will result in an
error. 2
1. print(T[2]) 2. T[3] = 19 3. print(min(T)) 4. print(len(T))

(ii) Pick one the following statements to correctly complete the function body in the given
code snippet.

def f(number):

# Missing function body

print(f(5))

(a) return "number" (b) print(number) (c) print("number") (d) return number
(c)Which of the following commands is used to write into a binary file. ‘f’ is the file
object and s is a list 1
(i) pickle.write(f ,s) (ii) pickle.write(s,f)
(iii)pickle.dump(s,f) (iv) pickle.dump(f,s)

(d) Evaluate : 6*3-5**2%6//3 1

(e) Write the definition of a function AddUp(L) in Python in which all even
indexed elements (i.c. 0,2,4,..) of the list L should be added with its next
element and odd indexed elements (i.e 1,3,5,..) should be incremented by 10.
Example: if the list L contains 10,20,30,40,50,60
Then the list L should become 30,30,70,50,110,70
2Example :

f. Write two differences between actual and formal parameters .Explain with an example. 2

g. A text file newtext has the following contents. 2


'''Welcome to the world of python'''

Give the output of the following code

f=open('newtest')
c=2
f.seek(c*4)
print(f.read(2), f.tell())
f.close()

h. Write the relative path of the file tigers.gif if animals is the current working directory. 1
SECTION C
3. (a)Which SQL command is used to add primary key to an existing a table ? 1

(b)Which SQL command is used to remove tuples from an SQL table 1

(c)Which clause is used with a SELECT command in SQL to display the values in
a column without duplication ? 1

(d) Classify the commands as DDL and DML : 1


ALTER TABLE ,UPDATE , DELETE , CREATE TABLE

(e)Observe the following table WATCHES carefully and answer the questions that
follow : 2

What is the degree and cardinality of the given table. If two more columns are added to this
table what will be the degree and cardinality.
(i) Which can be considered as primary key and foreign key in table
EMPLOYEES ? Justify.

(ii) Define degree and cardinality . What is the degree of department table.

OR
Define cartesian product with an eample.

(f) Write down one difference between 2

→ group by and order by

→ where and having

(g) Observe the table ITEMS and TRADERS and answer the questions given below
(h)Based on the above tables give the output of the queries given below 4
SECTION D

4. (a) Which attribute can be considered as primary key. Why? 1

(b) What is the difference between fetchone and fetchmany. 1

(c)
(i) To display NO, NAME, TDATE from the table TRAVEL in descending order of NO.

(ii) To display the NAME of all the travellers from the table TRAVEL who are
travelling by vehicle with code 101 or 102.

(iii) To display the NO and NAME of those travellers from the table TRAVEL
who travelled between ‘2015-12-31’ and ‘2015-04-01’.

(iv) To display all the details from table TRAVEL for the travellers, who have
travelled distance more than 100 KM in ascending order of NOP.

(v) SELECT COUNT (*), CODE FROM TRAVEL


GROUP BY CODE HAVING COUNT(*)>1;

(vi) SELECT DISTINCT CODE FROM TRAVEL;


(vii) SELECT A.CODE,NAME,VTYPE
FROM TRAVEL A,VEHICLE B
WHERE A.CODE=B.CODE AND KM<90;

(viii) SELECT NAME,KM*PERKM


FROM TRAVEL A, VEHICLE B
WHERE A.CODE=B.CODE AND A.CODE=‘105’;
(d) Write a python connectivity code to do the following: 2

Create a table member with memid , name and phone as attributes

Insert 5 records using a loop and take the input from the user.

Display all the records inserted.

You might also like