0% found this document useful (0 votes)
471 views10 pages

XII-Preboard II - Computer Science-Jan 2023

This document provides instructions and questions for a Computer Science exam. It includes 5 sections with multiple choice and other types of questions. Section A has 18 one-mark questions testing basic concepts. Section B has 7 two-mark questions involving short programs or explanations. Section C has 5 three-mark short answer questions. Section D has 3 five-mark long answer questions. Section E has 2 four-mark questions. Programming questions must be answered in Python.

Uploaded by

Junaid Siddiqui
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)
471 views10 pages

XII-Preboard II - Computer Science-Jan 2023

This document provides instructions and questions for a Computer Science exam. It includes 5 sections with multiple choice and other types of questions. Section A has 18 one-mark questions testing basic concepts. Section B has 7 two-mark questions involving short programs or explanations. Section C has 5 three-mark short answer questions. Section D has 3 five-mark long answer questions. Section E has 2 four-mark questions. Programming questions must be answered in Python.

Uploaded by

Junaid Siddiqui
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/ 10

नवोदय व ालय सिमित

NAVODAYA VIDYALAYA SAMITI


SECOND PRE-BOARD EXAMINATION -2022-23
COMPUTER SCIENCE (083)- (THEORY)
Class: XII
Time: 3 Hours Max. Marks: 70
Roll No.

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.
8. All programming questions are to be answered using Python Language only.
SECTION- A
1. State True or False (1)
“Text file stores information in ASCII or Unicode characters”.
2. Consider the given expression: (1)
not True and False or True
Which of the following will be correct output if the given expression is evaluated?
a. True b. False c. NONE d. NULL
3. For a given declaration in Python as S=”WELCOME” (1)
Which of the following will be the correct output of print(S [1: :2])?
a. WEL b. COME c. WLOE d. ECM
4. Find the invalid identifier from the following: (1)
a. name b. CLass c. section d. break
5. Which of the following is not a correct Python statement to open a text file “Notes.txt” to write
content into it? (1)
a. F=open(‘Notes.txt’, ‘w’) b. F=open(‘Notes.txt’, ‘a’)
c. F=open(‘Notes.txt’, ‘A’) d. F=open(‘Notes.txt’, ‘w+’)
6. Which of the following statement(s) would give an error after executing the following code?
(1)
S= “Welcome to class XII” #Statement 1
print (S) #Statement 2
S= “Thank You” #Statement 3
S[0]= ‘@’ #Statement 4
S=S+ “Thank You” #Statement 5
Page |1
a. Statement 3 b. Statement 4 c. Statement 5 d. Statement 4 and 5
7. Given a list A = [34,234,20,70,30,67]. What will be the correct statement to take out the 3 rd
element from the list? (1)
a. A.pop(2) b. A.find(2) c. A.pop(-1) d. A.del(20)
8. Riya wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth
technology to connect both the devices. Which type of network (PAN/LAN/MAN/WAN) will be
formed in this case? (1)
9. The …………… command can be used to remove all records of a table along with the table
structure. (1)
a. Delete Table b. Drop Table c. Remove Table d. None of these
10. For a function header as follows: (1)
def Calc(X, Y=20):
Which of the following function calls will give an error?
a. Calc(15,25) b. Calc(X=15,Y=25) c. Calc(Y=25) d. Calc(X=25)
11. Select the correct output of the code: (1)
a= 5
b = a = 15
c = (a < 15)
print(“a = “, a)
print(“b = “, b)
print(“c = “, c)
a. a = 15 b. a=5
b = 15 b = 15
c= False c = True
c. Both a and b d. None of these

12. …………..command is used to remove primary key from a table in SQL. (1)
a. update b. remove c. alter d. drop
13. ……………is a communication methodology designed to deliver both voice and multimedia
communications over Internet Protocol. (1)
a. VoIP b. SMTP c. PPP d. HTTP
14. ……………is a non-key attribute, whose values are derived from the primary key of some
other table. (1)
a. Primary Key b. Alternate Key c. Foreign Key d. Candidate Key
15. The correct syntax of seek() is: (1)
a. file_object.seek(offset[,reference_point]) b. seek(offset[,reference_point])
c. seek(offset,file_object) d. seek.file_object(offset)
16. Name the List method/function available in Python which is used to remove the last element
from a list implemented Stack. Also, write an example using Python statements for removing the
last element of the list. (1)
Page |2
Q.17 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): A Python function that accepts parameters can be called without any
parameters.
Reasoning (R): Functions can carry default values that are used, whenever values are not
received from calling function . (1)
18. Assertion (A): The readline() method reads one complete line from a text line.
Reasoning (R): The readline() method reads one line at a time ending with a newline(\n). It
can also be used to read a specified number of bytes of data from a file but maximum upto the
newline character(\n). (1)
SECTION- B
19. Rewrite the following program, after removing all the syntactical errors with each error
underlined.
Def execmain( ): (2)
x=int(input(“Enter a number:”))
if(abs(x)=x):
print “You entered a positive number”
else:
x=*-1
print “Number made positive” x
execmain( )
20. Write two points of difference between Circuit Switching and Packet Switching. (2)
OR
Write two points of difference between XML and HTML.
21. a. Given is Python string declaration: (1)
Subject= “@@Computer Science Python 2023@@”
Write the output of: print(Subject[ : : -2])
b. Suppose the content of “Rhymes.txt” is: (1)
“Good Morning Madam”
What will be the output of the following Python code?
F=open (“Rhymes.txt”)
L=F.read().split()
for W in L:
if W.lower()==W[ : : -1].lower():
print (W)
22. Differentiate between char (n) and varchar (n) data types with respect to databases. (2)

Page |3
23. a. Write the full forms of the following: (1)
i. PPP ii. CDMA
b. What is the use of a repeater? (1)
24. What will be the output of the following Python code? (2)
W=25
def Fun (Ch):
W=50
print (W, end=Ch)
W*=2
print (W, end=Ch)
print (W, end= “*”)
Fun ( “!”)
print (W)
OR
Find the output of the following Python code:
D={1: “One”, 2: “Two”, 3: “Three”}
L=[ ]
for K,V in D.items( ):
if V[0]== “T”:
L.append(K)
print (L)
25. What is join? What are the different kind of join? (2)
OR
Categorize the following commands as DDL or DML:
CREATE TABLE, INSERT, UPDATE, ALTER
SECTION- C
26. a. Consider the following tables: Student_Details and Branch (1+2)
Table: Student_Details
RNo Name Subject
101 Akhil Maths
102 Preeti Physics
103 Rudra Physics

Table: Branch
RNo City
101 Delhi
102 Mumbai
101 Nagpur
What will be the output of the following statement?
SELECT * FROM Student_Details NATURAL JOIN Branch;

Page |4
b. Write the output of the queries (i) to (iv) based on the table STUDENT given below:
Table: STUDENT
RollNo Name Class DOB Gender City Marks
1 Nandan 10 06-06-1995 M Agra 551
2 Saurabh 12 07-05-1993 M Mumbai 462
3 Sonal 11 06-05-1994 F Delhi 400
4 Trisha 12 08-08-1995 F Mumbai 450
5 Stuart 12 08-10-1995 M Delhi 369
6 Marina 11 12-12-1994 F Dubai 250
7 Neha 10 08-12-1995 F Moscow 377
8 Nishant 10 12-06-1995 M Moscow 489

(i) Select Count (*), City From STUDENT


Group by City Having Count (*)>1;
(ii) Select Max (DOB), Min (DOB) from STUDENT;
(iii) Select Name, Gender From STUDENT
Where City= ‘Delhi’;
(iv) Select Name, DOB From STUDENT
Where Marks>400 and Name Like ‘N%’;
27. Write a function countmy( ) in Python to read the text file “DATA.TXT” and count the number
of times “my” occurs in the file. (3)
Example: If the file “DATA.TXT” contains:
“This is my website. I have displayed my preferences in the CHOICE section.”
The countmy( ) function should display the output as:
“my occurs 2 times”.
OR
Write a method COUNTLINES( ) in Python to read lines from text file “TESTFILE.TXT” and
display the lines which are not starting with any vowel.
Example: If the file content is as follows:
An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.
The COUNTLINES( ) function should display the output as:
The number of lines not starting with any vowel: 1
28. a. Write the outputs of the SQL queries (i) to (iv) based on the relations Stationery and
Consumer given below: (2+1)
Table: Stationery
S_ID Stationery_Name Company Price
DP01 Dot Pen ABC 10
PL02 Pencil XYZ 6
ER05 Eraser XYZ 7
Pl01 Pencil CAM 5
GP02 Gel Pen ABC 15

Page |5
Table: Consumer
C_I Consumer_Nam Address S_ID
D e
1 Good Learner Delhi PL01
6 Write Well Mumbai GP02
12 Topper Delhi DP01
15 Draw Well Delhi PL02

(i) SELECT count (Distinct Address) From Consumer;


(ii) SELECT Company, Max(Price), Min(price), Count(*) from Stationery GROUP BY
Company;
(iii) SELECT Consumer.Consumer_Name, Stationery.Stationery_Name, Price
FROM Stationery, Consumer WHERE Consumer.S_ID=Stationery.S_ID
(iv) SELECT * From Consumer ORDER BY Consumer_Name;
b. Write the command to view all tables in a database.
29. Write definition of a method OddSum (NUMBERS) to add those values in the list of
NUMBERS, which are odd. (3)
30. Write PushClient(Client) and PopClient(Client) methods in python to add a new Client and
delete a Client from a List of Client Names, considering them to act as Push and Pop
operations of the stack data structure. (3)
OR
Find the final contents of a stack :
7,11,*,80,+,50,+
SECTION- D
31. Eduminds University of India is starting its first campus in a small town Parampur of Central
India, with its admission office in Delhi. The University has 3 major Buildings comprising of
Admin building, Academic Building and Research building in the 5 Km area campus. (5)

Eduminds University Campus


Delhi
Admission
Office EdumindsUniversityCampus
Delhi
Admission Research
Office ResearchBu
Building
Academic ilding
Academic
Building Admin
Building
Building

Page |6
Expected Wire distances between various locations:
Research Building to Admin Building 90 m
Research Building to Academic Building 80 m
Academic Building to Admin Building 15 m
Delhi Admission Office to Parampur 1450 Km
Campus

Expected number of computers to be installed at various locations in the university are as


follows:
Research Building 20
Academic Building 150
Admin Building 35
Delhi Admission office 5

(i) Suggest to the authorities, the cable layout amongst various buildings inside the
university campus for connecting the buildings.
(ii) Suggest the most suitable place (i.e. building) to house the server of this organisation
with a suitable reason.
(iii) Suggest an efficient device to be installed in each of the buildings to connect all the
computers.
(iv) Suggest the most suitable (very high speed) service to provide data connectivity
between Admission Building located in Delhi and the campus located in Parampur.
(v) Which type of network is formed by connecting the computers of the three buildings
inside the university campus?
32. a. Find and write the output of the following python code: (2+3)
Msg1= “WeLcOME”
Msg2= “GUeSTs”
Msg3= “ ”
for i in range(0, len(Msg2)+1):
if Msg1[i]>="A" and Msg1[i]<="M":
Msg3=Msg3+Msg1[i]
elif Msg1[i]>="N" and Msg1[i]<="Z":
Msg3=Msg3+Msg2[i]
else:
Msg3=Msg3+ “*”
print (Msg3)
b. The code given below inserts the following record in the table Student:
RollNo- integer
Name- string
Marks- integer
Note the following to establish connectivity between Python and MySQL:
 Username is root
 Password is tiger
 The table exists in a MySQL database named school
 The details(RollNo, Name and Marks) are to be accepted from the user
Page |7
Write the following missing statements to complete the code:
Statement 1- to form the cursor object
Statement 2- to execute the command that inserts the record in the table Student
Statement 3- to add the record permanently in the database.
import mysql.connector as mysql
def sql_data( ):
con1=mysql.connect(host=“localhost”,user=“root”,password=“tiger”,database=“school”)
mycursor=………………………………………. #Statement 1
rno =int (input(“Enter Roll Number::”))
name =input( “Enter name::”)
marks =int (input(“Enter Marks::”))
query=”insert into Student values({ }, ‘{ }’, { })”.format(rno, name, marks)
…………………………………………………… #Statement 2
…………………………………………………… #Statement 3
print ( “Data Added Successfully”)
OR
a. Find and write the output of the following Python code:
def Display(str):
m= “ ”
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('[email protected]')
b. The code given below reads the following record from the table named Student and
displays only those records who have marks greater than 75.
RollNo- integer
Name- string
Marks- integer
Note the following to establish connectivity between Python and MySQL:
 Username is root
 Password is tiger
 The table exists in a MySQL database named school
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object

Page |8
Statement 2 – to execute the query that extracts records of those students whose
marks are greater than 75.
Statement 3- to read the complete result of the query (records whose marks are
greater than 75) into the object named data, from the table Student in the database.
import mysql.connector as mysql
def sql_data( ):
con1=mysql.connect(host=“localhost”,user=“root”,password=“tiger”,database=“
school”)
mycursor=………………………………………. #Statement 1
print (“Students with marks greater than 75 are”)
…………………………………………………… #Statement 2
data= ……………………………………………. #Statement 3
for i in data:
print(i)
print ( )
33. What is the advantage of using a CSV file? (2+3)
Write a program to create a CSV file to store student data (Rollno, Name, Marks). Obtain
data from user and write 5 records into the file.
OR
Write a Program in Python that defines and calls the following user defined functions:
a) ADD() – To accept and add data of an student to a CSV file ‘record.csv’. Each record
consists of a list with field elements as rollno, name and marks to store student rollno,
student name and student marks respectively.
b) COUNTR() – To count the number of records present in the CSV file named ‘record.csv’
whose marks is more than 75.
SECTION- E
34. A departmental store MyStore is considering to maintain their inventory using SQL to store
the data. As a database administrator,Abhay has decided that: (4)
Name of the database: mystore
Name of the table: STORE
The attributes of STORE are as follows:
Itemno: numeric
Itemname: character of size 20
Scode: numeric
Quantity: numeric
Table:STORE
Itemno Itemname Scode Quantity
2005 Sharpener 23 60
Classic
2003 Ball Pen 0.25 22 50
2002 Gel Pen Premium 21 150
2006 Gel Pen Classic 21 250
2001 Eraser Small 22 220
2004 Eraser Big 22 110
2009 Ball Pen 0.5 21 180
Page |9
i. Identify the attribute best suitable to be declared as a primary key.
ii. Write the degree and cardinality of the table STORE.
iii. Write SQL statements to:
a. Insert the following data into the attributes:
Itemno=2010, Itemname=”Note Book”, Scode= 25, Quantity=50
b. Increase the quantity to 500 of those items whose Itemname begins with ‘E’

35. Neetu works as an IT expert in VV Infotech Ltd. She has been assigned the job of generating
a report to count total number of records of Staff using ‘Staff.csv’ file. She has written a
program to read CSV file ‘Staff.csv’ which contains details of all the staff members. She has
written the following code. As an IT expert help her to successfully execute the given task.
(4)
import #Line 1
def CountStaff ( ): #To read data from the CSV file
with (‘Staff.csv’, newline= ‘ ’) as f : #Line 2
csv_reader=csv. (f) #Line 3
rows = [ ]
values = 0
for i in csv_reader:
if csv_reader.line_num = =0:
continue
rows.append (i)
values = len ( (csv_reader)) #Line 4
print (“No. of Records are:”, values)
a. Name the module she should import in Line 1.
b. Write the method that she should use to open the file to read data from it.
c. Fill in the blank in Line 3 to read data from a csv file.
d. Fill in the blank in Line 4 with the method to convert the data from the file into list.

*****************************************************

P a g e | 10

You might also like