0% found this document useful (0 votes)
26 views8 pages

Cs Model Exam 2024 Question Paper

Uploaded by

jackychan56687
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)
26 views8 pages

Cs Model Exam 2024 Question Paper

Uploaded by

jackychan56687
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/ 8

MODEL EXAMINATION-1 (2024-2025)

Cs-1 COMPUTER SCIENCE Time: 3hrs

CLASS: XII Marks: 70 •

General lnstructio~s:
• Please check this Question Paper contains 37 questions.
• The paper is divided into 4 Sections - A, B, C, D and E.
• Section A, consists of 21 questions ( I to 21 ). Each ques~ion carries 1 Mark.
• Section B, consists of 7 questions (22 to 28). Each question carries· 2Marks.
• Section C, consists of 3 questions (29 to 31). Each question carries 3 Marks.
• Section D, consists of 4 questions (32 to 35). Each question carries 4 Marks.
• Section E, consists of 2 questions (36 to 37).' Each question carries 5 Marks.

I Q
• All programming questions are to be answered using Python Language only.
• In case of MCQ, text of the correct answer should also be written.
.. Marks
Section-A (21 x 1 = 21 Marks)
No.
State True or False:
1. In a nested loop, a break statement tenninates all the nested loops in one go. [l]
Which of t~e foil owing function returns the total n:um~er of values ?
2. .a)MIN b)MAX c)COUNT d)SUM ' [I]
.
Evaluate the following expression and identify the correct answer.
3., 16 // (4 + 2) * 5 + 2**3 * 4 [1]
( a) 42 b)46 c) 18 d) 32.
Which SQL keyword is used to sort the result-set?
4. a)ORDERBY b) SORT c)ALIGN d)GROUPBY [l]
The set of records retrieved after executing an SQL query over an established
5. database connection is called . [l]
a) table b) resultset c) sqlresult d) result
6. Which of the following method is used to combine two lists in Python? [I]
a) add() .b) append() c) merge() d) extendO
7. Assume that the position of the file pointer is at the beginning of 3rd line in a text file. (I]
Which of the following option can be used to read all the remaining lines?
a) myfile.read(n-3) b) myfile.readlines()
c) myfile.read(n) d) myfile.readlineO
Give the ouiput of the following
8. L= (1,2,3,4,5,6,7,8,9] [l]
print(L[: -1])
I 9.
What happen~ if you try to open a file in 'w' mode that already exists?
a) The file will be opened, and data will be appended to it
b) The file will be opened, and the contents will be cleared [I]
c) An error will be raised
d) The file will be opened for reading

1
. ftuples from the two relations -~
The operation whose result contains alll pairs oa•ch ,
• 'b te va ues m ~ • [l]
· ) Join - . d) Cartesian product
10. regardless of whether thetr at~ u _
_Ja~)~ln~t~ers~e~c~ti~on~_;b~)~S;et~di~ffi~e;r;en~c~e-~
the following Pythonboiicc>
;ifcc;wii·ng]Pyt co e <lle---~--1------.--..
L What error occurs when you execute -
[IJ
. .
11. Snippet ? apple = mango c) ValueErr or d) TypeErro r
a) SyntaxError b) NameError.
• • . • CSV file module in Python. During examinatio1 - - -
Rohit a stuqent of class I~ ts 1earning CSV file 'studeritcsv'. [I]
12. He has been assigned an incomplete code to creahte ad . d CSV File
Help him in completing the code which creates t e estre •
import csv
fh=open( , ,newline='')
Predict the output of the following: [I]
I3. L=[ 1,2,3]
L[0:2]='one'
..
print(L)
Identify the module to which the following function load Obelong to?
14. a) mysql b) ~sv c) p_ic_k_le__•_ _d~)_·s~ys_ _--::-:-- -:---:-- -;--[I_]-i
Which is the valid syntax to write an object onto a binary file opened in the write [I] •
15. mode? .
a·. pickle.dump(<object.to be written>, <file handle of open file>)
b. pickle.dump(<file handle of open file>, <object to be written>)
c. dump. pickle(<object>, <file handle>)
d. None of the above
16. . Choose the correct output for the following stack operation (* top position)
Push(5)
Push(8)
Pop() [I]
Push(2)
Push(5)
PopO
Push(l)
(a) 8 5 2 5 l *. . (b) 8 5 5 2 I* (c) 2 5 5 1• (d) 5 2 l •
17.- If my_diet is a dictionary as defined below, then which of the following stateme~ts
will raise an exception? my_diet= {'apple': Io, 'banana': 20, 'orange': 30} • [I]
a) my_dict.get('orange')
b) print(my_dict['apple', 'banana'])
c) ·my_dict['apple']=20
d) print(str(my_diet))
Which of the f oHowing conun ands is used to remove a table from a database ?
a)Erase b) Kill c) Drop d) Delete [I]
18.
Predict the output of the fallowing:
[I]
19. a) str='CBSE 2024'
\
for a in range(2):
print(str,end=' ')
I
2
Q20 and Q21 are Assertion(A) and Reason(R) 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
Assertion (A): Python does not allow programmers to develop the software for
20. several computing platforms by writing a program only once. [I]
Reasoning (R): Python is a cross platform language.
Assertion (A) : If the arguments in the function call statement match the number
21. and order of arguments as defined in the function definition, such arguments are [I]
called positional arguments.
Reasoning (R) : During a function call, the argument list first contains default
argument(s) followed by1he positional argument(s).
Section-B ( 7 x 2=14 Marks)
22. Explain seek( ) method in python. [2]
Give the output of the following :
23. Sum= 0
fork in range( 10, 1, -2): [2]
Sum= Sum+k
print(Sum)
Predict the output ,vith respect to the list L=[40,20,30, i 0,50]
24
• a) >>>print(len(L)) [2]
b) >>>L.pop(); print(L)
c) >>>L.append(70); print(L)
d)>>>L.sort(); print(L)
25. Considering the content stored in file "WORLDCUP.TXT", ,vrite the output·
India won the Cricket world cup of 1983
f=open("WORLDCUP. TXT") [2]
print(f.read(2))
print(f.read(2))
print( f. read(4))
print(f. tell())
f.close()
26. What _possible output(s) are expected to be displayed on screen at the time of
execution of the program from the foil owing code? Also specify the 1naximum [2]
values that can be assigned to each of the variables FROM and TO
import random
AR= [20,30,40,50,60, 70];
FROM=random.randint( 1,3)
TO=random.randint(2,4)
for Kin range(FROM,TO,l):
print(AR[K],end =''#")

3
a)l0#40#70# b) 50#60#70#
c) 40#50#70# d) 30#40#50#
27. A table named School (containing data of students of the whole school) is created,
where each record consists of several fields including AdmissionNo (Admission [2]
Number), RollNo (Roll Number), Name. Which field out of these three should be
set as. the primary key and why?
28. Raj is a ~atabase progrannner, He has to write query from EMPLOYEE table to
search for the employee who are not getting any commission, for this he has written
the query as: [2]
SELECT * FROM Efvfi>LOYEE WHERE co1nmission =null;
But the query is not producing the correct output. Help Raj and correct the query so
that he gets the desired output.
Section-C ( 3 x 3 = 9 Marks)
29. Write read contents from story. txt and count no: of independent words
uto" in the file.
OR (3]
Write a function countVowels() in Python, which should read each character of a
text file "myfile.txt", count the nun1ber of vowels and display the count.
Example: If the "1nyfile.txt" contents are as follows:
This is my first class on Con1puter Science.
The output of the function should be:
Count of vowels in file: l 0
30. Write a Python code to in1ple1nei1t a stack to manage different city names with the
details given below:
MyStack: A stack as a list to hold the city nmnes
MakePush(l\1yStack): To push a city nmne at the top of the stack.
Display(MyStack): Tq display the following.
(i) Top1nost city name (3)
(ii) All the city names of the stack
MakePoP(MyStack) : To remove a city name from the top of the stack. If the stack
is e1npty, display the 1nessage "Underflow" else display the popped out item.
OR
You have a stack nan1ed ORDERS that contains records of orders. Each order record
is represented as a list containing order_no, order_date and address.
Write the follo\ving user-defined functions in Python to perform the specified
operations on the stack ORDERS:
(I) push_order(ORDERS, REC): This function takes the stack ORDERS and a new
order record REC as arguments and pushes the new order record REC onto the
stack.
(II) pop_book(ORDERS): This function pops the topmost order record from the
stack and returns it. If the stack is already en1pty, the function should display
"Underflow".

4
(III) peep(ORDERS)· This fun .
without deleting it th
st
If
~tion displays the topmost element of the stack
. • e ~ck is empty, the function should display 'None'.

31. Find and write the output of the foil • Pyth


def changer(p,q= 10): owing on code:
p=p/q
q=p%q
print(p,"#" ,q)
return p ,
a=200
b=20 (3)
a=changer(a,b)
print{a,"$",b) \
a=changer(a)
print(a,"$" ,b)
OR

Give the output of the following


L= [l,2,3,4~5,6,7,8,9]
print(L.count(2))
print(L.index(2)
print(L[ l :4])

Section-D ( 4 x 4 = 16 Marks)
32.. Write SQL commands for the following on the basis of given table STUDENT
No. N•m• Stl,-nd Stream AvgMart< · Gr•d• c,...
'
1 : Karan 400~00
.. Medical 7.8.5 B 1·2B
2 Olvakar - 4'$().00· ·eommerce 89.2 A 11c
3 Otvya 300.00 Commerce 68.6 C 12C:
;
4 Arun 360;00 Hu.manlltu 73~1 B 1·2e
. ; '

5 : Sabina 500~00· Nonrnadlcal 90.6 A t1A

8 John 400.00 Medtcal. 76~·◄ a 128


!
;
. '
:

t Robert 260.00 HumanlUes 64."4 C 11A [4]


t

8 ·F,tubtn·• 450~00 N'Of't'medlcal


.
88.6 A 1·2A
.. ',

9 Vlkas 500.00· Nonmedlcal 92.0 A. 12A


I

10 Mohan 300.00 Commerce 6.7.S C 12.C


. Select all the Nonmedical stream students from STUDENT.
I.
.. List the names of those students who are in class 12 sorted by Stipend.
11.
... List all stude'nts sorted by 14--vgMark in descending order.
Ill.
. Display a report~ listing Name, Stipend, Stream and amount of stipend
IV.
received in a year assuming that the Stipend is paid every 1nonth.

OR

5
- .
-
. . .; i
I
.' .. . .
Given Table :CLUB SEX
COACH- AGE SPORTS DATOFAPP- PAY
COACHNAME
ID .
. .
KARATE 1996/03/27 1000 M
I KUKREJA· 35

2 34 KARATE 1998/01/20 1200 F


RAVINA

3 KARAN 34 SQUASH 1998/02/19 2000 M

4 TARUN 33 BASKETBALL 1998/01/01 1500 M

5 ZUBIN 36 SWIMMING 1998/01/12 750 M

\
6 KETAKI 36 SWIMMING 1998/02/24 800 F

39 SQUASH 1998/02/20 2200 F


7 ANKITA

37 KARATE 1998/02/22 1100 F


8 ZAREEN

9 KUSH 41 SWIMMING 1998/01/13 900 M

37 BASKETBALL 1998/02/19 1700 M


10 SHAILYA
I
.
l. SELECT COUNT(DISTINCT SPORTS) FROM Club;
..
11. SELECT MIN(Age) FROM CLUB WHERE Sex = 'F' ;
...
111. SELECT AVG(Pay) FROM CLUB \y'I-IERE Sports = 'KARATE' ~
lV. SELECT SUM(Pay) FR0~1 CLUB WHERE Datofapp> '1998-01-3 l' ;
33. Write a progra1n to read all content of "student.csv" and display records of only
those students who scored 1nore than 80 marks.
[4]
Also display total number of records in student.csv .
Records stored in students is in the fonnat :[Rollno, Name, Marks].
34. Ms. Sushama has been working with a school 1nanagement in Delhi. She needs to
access some information from tables TEACHER and JOINING for their Staff
database.Help her to extract the following informati9n by writing _the desired SQL
queries as mentioned below.
Table: TEACHER ..

T- ID· Name Education Departme nt DOJ Salary.


A0l Shubham PGT Computer 2015-06-10 52000
Kumar
A02 Alok Mishra TGT Mathe1natics 2010-06-24 48000
A03 Manisha Paul PGT Physics 2008-04-15 44000
A04 Nishant Kis·hore TGT Physics 2009-02-11 55000 [4]
A05 . Abhishek Sinha TGT Chemistry 2012-09-24 49000
A06 Sushant Das PGT Computer 2016-05-04 55000
: ;

Table: JOINING
J-ID Department Posting Designation Incentive
JOI Mathematics Agra HOD 8000
J02 Physics Nainital Dean 10000
]03 Chemistry Varanasi Incharge 7500
]04 Computer Kanpur Coordinator 7000

6
- a) Display the total number of departments in the table teacher.
b) Display the details of such teachers who become the most junior and the most
senior.
c) Display the names of the teachers and their departments whose posting is in
Kanpur.
d) Display the details of all physics teachers whose salary is Rs.50,000 or more
and posted in Nainital.

a) Write .a python code to view all the tables which are available-in database named
35. mydatabase. [4]
b) Write a python code to view the structure of a table (say, Company) which is
available in database na1ned mydatabase.
.. SECTION E (2 X S = 10 Marks)
36. a) Write a program to write contents to a binary file stud.dat with record format
[rollno.,name,marks]
[5]
b) Write a program to read contents from the file stud.dat and display those
records whose 1narks >90. Assume stud.dat existing in the system with the record
format [rollno,name,marks]
37. Indian School, in Mwnba.i is starting up the network between its different wings.
There are four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as
shown below:

ADMIN [5]

I JUNIOR I I HOSTEL I

.IL---_s_EN_ro_R___.j

.
ADMIN TO SENIOR . 200m
ADMIN TO JUNIOR 150m
ADMIN TO HOSTEL 50m
SENIOR TO JUNIOR 250m .
SENIOR TO HOSTEL 350m
JUNIOR TO HOSTEL 350m
The distance between various buildings is as follo,vs
SENIOR 130
JUNIOR ' 80
ADMIN 160
HOSTEL 50

7
J \

. the buildings. (l)


1. Suggest the cable layout of connections between
.. to house the server of this
11. Suggest the most suitable place (i.e., building) (I)
schqol, provide a suitable reason. (2)
with justification.
•••
Ill. Suggest the place~ent of the following devices
a. Repeater·· b.Hub/Switch
. ther city about 50-60 km
IV. The organisation also has inquiry office in ano
ssion media to interconnect
away in hilly region. Suggest the suitable transmi (I)
:
to school and inquiry office out of the following
a) Fiber optic cable ·-
b) Microwave
c) Radiowave

You might also like