You are on page 1of 7

CLASS: XII SESSION: 2023‐24

COMPUTER SCIENCE (083)


SAMPLE QUESTION PAPER (THEORY)
Maximum Marks: 70 Time Allowed: 3 hours

General Instructions:

1. This question paper contains five sections, Section A to E.


2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice isgiven in Q35 against part c only.
8. All programming questions are to be answered using Python Language only.

1. State True or False 1


“A Python program and a Python module means the same.”
2. What will be the output of the following Python Code? 1
tp=5
tp1=tp * 2
print(len (tp1))
(a) 0 (b) 2 (c)1 (d)Error
3. Which of the following are valid strings in Python? 1
(a) This is a string (b) {This is a string}
(c)(This is a string) (d) “This is a string”
4. State True or False 1
“A void function also returns a value i.e, None to its caller.
5. What is the output of the following snippet? 1
def fun(n) :
if ( n > 100 ):
return n – 5
return fun (fun(n+11)
print (fun (45))
(a)50 (b) 100 (c) 74 (d) infinite loop

6. Fill in the blank: 1


The first line of a function definition is called ___________.

7. A table is also called as ____________. 1


(a) Field (b) Relation (c) Attribute (d) Key

ORANGE EDUCATION 1
8. Which of the following is a DDL command? 1
(a) SELECT (b) ALTER (c) INSERT (d) UPDATE

9. By default, Python names the segment with top‐level statements (main program) as _________. 1
10. Which of the following SQL commands displays the structure of a table? 1
(a) MODIFY (b) ADD PRIMARY (c) DESCRIBE (d)SHOW DATA

11. Which of the following functions will read lines of a text file as list elements. 1
(a) read() (b) get( ) (c) readline() (d) readlines( )

12. _________ command removes a table from a database permanently. 1


13. NIC stands for 1
(a) Network Information Centre (b) Network Integration Card
(b) Network Interface Card (d) Network Integration Centre

14. Which of the following will be the output of the statement given below? 1
print([12,34,56,78,90].pop())
(a) 78 (b) 90 (c)12 (d) 12,34,56,78,90
15. The aggregate functions can only be used in the select list or _________ clause of a select query. 1
16. For the HAVING clause, which of the following phrases is /are ture? 1
(a) Acts EXACTLY like a WHERE clause.
(b) Acts like a WHERE clause but is used for columns rather than groups.
(c) Acts like a WHERE clause but is used for groups rather than rows.
(d) Acts like a WHERE clause but is used for rows rather than columns.
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is false but R is True
17. Assertion (A):‐ Multiple text files may be opened together for processing. 1
Reasoning (R):‐ Python allows creation and association of multiple file objects linked to text files.

18. Assertion (A): A user‐defined function that accepts 3 parameters where no parameter carries a default 1
value must be called with 3 parameters.
Reason (R): Since, there are no defaults parameters, 3 parameters must be passed to the function.
Section‐B
19. Consider the following code and write the flow of execution for this. Line number have been given for 2
your referencing.
1 def power (b,p):
2 y=b**p
3 return y
4
5 def calcSquare(x):
6 a=power(x,2)
7 return a
8
9 n=5
10 result=calcSquare(n)
11 print(result)

ORANGE EDUCATION 2
20. Write one advantages and one disadvantage of bus topology. 2
OR
Write two advantages of using an optical fibre cable over an Ethernet cable to connect two service
stations, which are 190 m away from each other.

21. Consider the code below and answer the questions that follow: 2
def multiply(number1, number2):
answer=number1*number2
return(answer)
print(number1,’times’,number2,’=’,answer)
output=multiply(5,5)
(i) When the code above is executed, what gets printed?
(ii) What is variable output equal to after the code is executer?
22. What is Primary key? Give a Suitable example of Primary Key from a table containing some 2
meaningful data.
23. (a) Write the full forms of the following: 2
(i) PPP (ii) POP
(b) What is RJ‐45 connector?
24. Predict the output of the Python code given below: 2

x=[1,2,3,4]
counter=0
while counter <len(x):
print(x[counter]*'$')
for y in x:
print(y*'*')
counter+=1
OR
Predict the output of the Python code given below:
empdict={'Eno':[1,2,3,4], 'Ename':[ 'Amar', 'Akash', 'Nitin', 'Vijay',], 'Sal':[5000, 6000, 7000, 8000 ]}
print(empdict[‘Ename’][0].empdict['Sal'][0])
25. Explain the terms Cardinality and Degree in table. 2
OR
Explain DDL and DML . Write any two commands of both.

Section‐C
26. (a) Consider the following tables – Student and Fees: 1+2
Table: Student
Roll_No Name Class
1 Anita 12th
2 Prerna 11th
3 Krisha 10th
Table: Fees
Roll_No Fees
1 9000
2 8500
3 8000
What will be the output of the following statement?
SELECT * FROM Student NATURAL JOIN Fees;

ORANGE EDUCATION 3
(b) Write the output of the queries (i) to (iv) based on the table,TEACHER given below:
No. Name Age Department Salary
1. Akash 34 Computer 12000
2. Aditya 31 History 20000
3. Sandeep 35 Maths 30000
4. Amit 36 History 25000
5. Vijay 37 Maths 30000
6. Neeraj 34 Computer 21000
7. Narinder 35 Maths 20000
(i) To count the number of teachers with Age<23.
(ii) To insert a new row in the TEACHER table with the following data: ,
8,”Lalit”,27,”History”,18000.

27. Write a program to accept a filename and a position. Using the inputs, call a function 3
SearchFile(Fname, pos) to read the contents of the file from the position to the end. Now, display all
those words that start with “U” or “u”.
OR
Write a program in Python to open a text file “lines.txt” and display all those words whose length is
greater than 5.
28. Consider the following table CLUB. Write SQL commands for the following statements. 3
Table: CLUB
COACH‐ID COACHNAME AGE SPORTS DATEOFAPP PAY SEX
1. Abhinav 35 JUDO 27/03/1996 1000 M
2. Kirti 34 JUDO 20/01/1998 1200 F
3. Kartik 34 SQUASH 19/02/1998 2000 M
4. Munish 33 BASKETABLL 01/01/1998 1500 M
5. Yuvraj 36 SWIMMING 12/01/1998 750 M
6. Sonali 36 SWIMMING 24/02/1998 800 F
7. Rekha 39 SQUASH 22/02/1998 2200 F
8. Preeti 37 JUDO 22/02/1998 1100 F
9. Mohit 41 SWIMMING 13/01/1998 900 M
10. Amit 37 BASKETBALL 19/02/1998 1700 M

(I) To show all information about the Judo coaches in the club.
(II) To list names of all coaches with their date of appointment (DATEOFAPP) in descending order.
(III) To display a report, showing caochname , pay, age and bonus(15% of pay) for all the coaches.
(IV) To insert a new row in the CLUB table with the following
data:11,”PRAKASH”,37,”SQUASH”,{25/002/98},2500,”M”.

29. Write a user defined function to accept a string and check whether it is palindrome or not. (A 3
palindrome is a string that is same as its reverse).

30. A linear stack called status contains the following information. 3


Phone number of Employee
Name of Employee
Write the following methods to perform given operations on the stack status.
(i) Push_element() To Push an object containing Phone number of Employee and Name of Employee
into the stack.
(ii) Pop_element() To Pop an object form the stack and to release the memory.
OR
Write a function to pop an element from a stack “s” using a function stackpop()
ORANGE EDUCATION 4
Section‐D

31. The Cyber Mind Organization has setup its new branch at Mizoram for its office and web 5
based activates. It has four wings of buildings as shown in the diagram.

Centre to centre distances between various blocks:

(i) Suggest the suitable layout to connect the wings. (1)


(ii) Suggest the most suitable place (i.e. wing) to house the server of this organization
with a suitable reason, with justification. (1)
(iii) Suggest the placement of the following devices with justification. (1)
(a) Repeater
(b) Hub/Switch
(iv) The organization is planning to link its head office situated in New Delhi with the
offices at Mizoram. Suggest an economic way to connect it, the company is ready
to compromise on the speed of connectivity. (2)
Justify your answer.
32. What will be the output of the following code? 2+3
(i)def increment(n):
n.append([40])
return n[0], n[1], n[2], n[3]
L=[23,35,47]
m1,m2,m3,m4=increment(L)
print(L)
print(m1,m2,m3,m4)
print(L[3]==m4)

(ii) Given below is a table item in database Register.

Sr.No ItemName Quality Price


1 A 4 100
2 B 5 50
3 C 7 49
4 D 9 45
Jasleen created this table but forget to add column Purchasing Date. Can she add this column after
creation of table? If yes, write the code where user’s name and password are system and test
respectively.
Note the following to establish the connection between Python and MYSQL.
Host: localhost
Username:record
Password: entry
ORANGE EDUCATION 5
Database: Register
Or
(i) Find the output of the following code:
def Change(P, Q=50):
P=P+Q
Q=P‐Q
print(P, "#", Q)
return(P)
R=200
S=300
R=Change(R,S)
print(R,"#”,S)
S=Change(S)
(ii) Define fechmany([size]). How does fetchone() method differ from fetchall() method?
33. Write a program to write into file “one.csv” Rollno, Name and Marks separated by comma. It should 5
have header row and then take in input from the user for all following rows. The format of the file
should be as shown if user enters 2 records.
Roll.No, Name, Marks
20, ronit, 67
56, nihir, 69
Or
Write a program to read all content of “student.csv” and display records of only those students who
scored more than 80 marks. Records stored in students is in format : Rollno, Name, Marks.

34. Ajay creates a table RESULT with a set of records to maintain the marks secured by students 1+1+2
in Term 1and Term2 and their position. After creation of the table, he has entered data of 7
students in the table.
Table Name :‐ Result
ROLL_NO Name Term 1 Term2 Position
1 Amar 370 412 I
2 Aditya 320 340 I
3 Vijay 415 425 I
4 Mohit 350 357 I
5 Aarushi 120 95 IV
6 Raj 150 205 II
7 Karan 475 440 I
Based on the data given above answer the following questions:
(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If two columns are added and 2 rows are deleted from the table result, what will be the
new degree and cardinality of the above table?
(iii) (a) Write the statements to Insert the following record into the table
Roll No‐ 8, Name‐ Aastha, Term 1‐ 470, Term 2‐444, Position – I.
(b) Increase the term 2 marks of the students by 3% whose name begins with ‘A’.
OR (Option for part iii only)
(iii) (a)Write the statements to Delete the record of students securing IV division.
( b) Add a column REMARKS in the table with datatype as varchar with 50 characters

ORANGE EDUCATION 6
35. Anita Rani has been given following incomplete code, which takes a student’s details (rollnumber, 4
name and makrs) and write into a binary file stu.dat using pickling.
Import pickle
sturno=int(input(“Enter roll number:”))
stuname=input(“Enter name:”)
stumakrs=float(input(“Enter Marks:”))
Stuq={“RollNo.”:sturno,”Name”:stuname,”Marks”:stumarks}
with__________________as fh: # Fill_Line1
__________________ # Fill_Line2
________________________as fin: # Fill_Line3
___________________ # Fill_Line4
print(Rstu)
if Rstu[“Marks”]>=85:
print(“Eligible for merit certificate”)
else:
print(“Not eligible for merit certificate”)
Help Anita to complete the code as per the following instructions.
(a) Complete Fill_Line1 so that the mentioned binary file is opened for writing in fh object using a
with statement.
(b) Complete Fill_Line2 so that the dictionary Stu1’s contents are written on the file opened in
step(a)
(c) Complete Fill_Line3 so that the earlier created binary file is opened for reading in a file object
namely fin, using a with statement.
Or
Complete Fill_Line4 so that the contents of open file in fin are read into a dictionary namely
Rstu.
(d) After completion of the code , what output will be produced , if the following details are input:
Enter roll number : 24
Enter name :Megha
Enter Marks: 76

ORANGE EDUCATION 7

You might also like