Class 12 TH Computer Science PRE BOARD 1
Class 12 TH Computer Science PRE BOARD 1
Class 12 TH Computer Science PRE BOARD 1
General instructions:
1 Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, Dand E.
3 Section A, consists of 18 questions (1 to 18). Each question carries 1Mark.
4. Section B,consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question caries 3 Marks.
6 Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8 Allprogramming questions are to be answered using Python Language only.
SECTIONA
a) 130 b) 1026
c) 258 d) 68
a) Def b) false
True d) print
Q3. Given a string s ="Happy Diwali',what will be the value of string slice s[:-21? 1
a) iai pa b) HpyDwl
c) lwDypH d) iaiypH
Q4 Which among the following is/are mutable data types in python? 1
a) list b) tuple
c) string d) boolean
Computer Science/XTISet-/AGRO-I | P.T.O.
Which python statement will delete all elements of adictionary named d
a) ddeleteçal) b) ddelete( )
dclear) d) dempty)
Q6 The retun type of the printo tunction is:
string b) integer
list d) None
result in an
Q7 Consider atuple t (10, 15, (20, 25), 30, 35), ldentity the statement that will
1
Q10. Which of the following connector is used for Ethemet cables in a LAN?
a) RJ11 b) RJ45
c) ETHO d) FConnector
1
Q11. Which two of the following queries are not valid in MySQL?
a select gender, count(") form students having age >15;
b) select gender, count() from students where age>15 group by gender;
select gender, sum(age) from students group by gender having sum(age)>25;
d) select gender, max(age) from students group by gender order by max(age);
Q12. Which of the following is not a DDL Command in SQL?
a) ALTER b) UPDATE
c) DROP d) CREATE
Computer ScienceNTISer-VAGRO-I
I31
Q13. Ifa MySQL table named Ahas 5 columns and 6 rows and another table Bhas 3 columns and
4rows, then what will be the degree and cardinality of the cartesian product of Aand B? 1
a) 15, 24 b) 8, 10
8, 24 d) 5,24
Q14. Which of the following is the unit used to measure data transfer rate of a computer
network? 1
a) mps b) bps
c) Hertz (Hz) d) None of these
Q15. Which of the following keyword is used along with try block to handle exceptions. 1
a) catch b) handle
) follow d) except
Q16. Which of the following are not correct ways of opening a text file in python? 1
Both Aand Rare true and Ris the correct explanation for A
b Both Aand Rare true and Ris not the correct explanation for A
A is True but R is False
Assertion (A): Number of arguments passed to a function may not match the number of
parameters in the function definition.
foreach x in L:
if xin D:
D[x]= +1
Else:
D()=1
and n is a numenc
Q21. Write afunction modifyList(Ln) in Python, which accepts a list Lof numbers
value. Function should: 2
Write a user defined function palindrome(s) - which takes a string 's' as arqument and returns
True if it is a palindrome and False if it is not.
Computer ScienceXIISet-IA GRO-I
(A palindrome is a word, phrase, or sequence that reads the same backwards as forwards
-example : madam)
Q22. Predict the output of following python code: 2
S= "BHARAT"
D=)
for i in range(len(S):
if i%2==0:
D[SÜ]=i+1
else:
D[SI] = i-1
for kv in Ditems0: print(k,v,sep="#")
Q23. Consider a List L= [10,20,30,[40,50,60],70,80] 2
Write a single line python statement (using List methods only) to:
i. Insert an element 55 as the second last element of the inner list, so that L becomes
[10,20,30,[(40,50,55,60], 70,80]
ii. Delete the inner list so the Lbecomes [10,20,30,70,80]
Q24. Consider a MySQL table named "Students" with columns - RollNo, Name, Marks. 1x2=2
Write SQL commands to:
() Add a new column named 'Phone' to store the phone number of the students.
(i) Set RollNo as the primary key of the table.
OR
Consider aMysQL table named "Books" with columns - BookID, BookName, Pages, Price,
Rating. The rating column has data type INT.
Write SQL commands to:
) Change the data type of rating column to allow for floating point values (1.0 to 5.0)
(1) Delete the pages column from the database.
Computer Science/XIWSer-I/AGRO-I
Q25. Write the output of the following python code. 2
def runme(x=1,y=2):
X= X+y
y+=1
print(x,'S. y)
return x,y
a,b = runme)
print(a, #,b)
runme(a,b)
Section - (C)
for i in range(0,n):
if not msg[).isalpha):
new_msg = new_msg + @'
else:
if msg[i].isupper):
new_msg = new_msg + msg*2
else:
new_msg=new_msg + msg[]
return new_msg
Neha has asked you to help her count the number of failed login attempts. Wite a function
countFailedAttempts() in python to count the number of lines containing the word failed in
the text file log_report.tot.
OR
Rajat is working on a language statistics project. He has to analyze the writings of afamous
English novelist. He has downloaded a text file named 'russel.txt' containing major wnitings
of the author. He is stuckat the problem of counting the number of wods starting with th'
or Th. Being acomputer science student, help Rajat by writing afunction countWords( )in
python to count the number of words starting with Th' or th' in the text fle 'usseltxt!
Computer Science/XIISet-IWAGR0-1
Q29. Consider the table Employees Given below and write SQL. queries () to (i) based on it. 3
Table: Employees
emp id name dob gender salary
101 26000
Simar 1994-01-15
1995-10-18 M 17000
102 Alok
1996-08-21 M 25000
103 Hasan
35000
104 Kriti 1993-01-12 F
1994-02-20 M NULL
105 Gulab
1993-12-01 16500
106 Jaya
mot, Pen, 10, 120), (105, 'Marker, 30, 130), (106, Sharpener, 5, 110|| Top
The output after Pop_Items0 should be
(106, Sharpener, 5, 110j
(105, Marker', 30, 130)
[101, Pen', 10, 120)
Stack Empty
SECTIOND
031. Write theoutput of SQL queries () to (v) based on the relations Employees and Departments
given below: 4
Table :Employees
empid name dob gender salary dept id
101 Simar 1994-01-15 F 26000
Table: Departments
Sales GF-006
3 Analysis SF-204
4 Training FF-102
Computer Science/XII/Set-I/AGRO-I
i.
Display the Average Salary for Male and Female Ernployees.
Display the Employee Name and Department Name for all employees in descending
order of their salary.
after 31 December 1995.
Display the maximum salary of employees born
departments having more
iV. Display the department id and number offemployeesfor all
than 1employee.
csv file 'FOOTBALL.CSV to store player name, matches anid goais scored.
o Vjay has created a
that defines and calls following user defined functions.
wmte d program in python
matches, goals) : Three parameters - name of the player, matches
addPlayer(name, list
scored are passed to the function. The function should create a
played and goals
object and append it to the csv file.
The function should read the csv file and display the name of the
ii. highestAverage( ):
player with the highest average goals (goals/matches).
SECTIONE
Noida. The company campus will have
Q33. Stalwart Solutions Pvt Ltd. is setting up its campus in
company has consulted you
four blocks - Shivaji(S), Tagore (T), Ashoka (A) and Raman (R). The
their questions (a) to (e)
for networking at the campus. Suggest the best possible solutions for
based on the information given below:
1x5=5
No. of Distance
Block Blocks
Computers (m)
Shivaji (S) 75 Shivajito Tagore 25
Tagore (T) 125 Shivaji to Ashoka 150
Ashoka(A) 25 Shivajito Raman 125 R
Computer Science/XTIISet-I/AGRO-I
cable layout
Suggest the best economical wired transmission medium and drawthe
diagram to connect the four blocks.
connecting the computers
The company doesn't want to use any wired media for
provide wirelessaccess, given
withinthe Raman block.. Which device can be usedto
that allthe machines in this block are wi-fi enabled.
the LAN established. Keeping
trafficin
e) The company wishes to minimize the broadcast
connect the computersinside every
this in mind, which device will you suggest to
block - hub or switch? Why? 2+3a5
files and binary files?
Q34. ) What is the difference between text 'PASSWORDS.DAT The
binary file named
passwords in one
Shweta had stored allher
format:
passwords were stored in following
app_name, username, password]
and
title as a parameter and displays the username
that accepts
Write a function search(app)
password for that particular app.
OR
Computer Science/XII/Se-I/AGRO-1
I 12 1
Username - heerakh
Password -happy
The columns of the CRICKET table are described below:
pid (Player ID) - integer
pname (Player Name) -string
innings (nnings Played) -integer
runs (Runs Scored) - integer
wickets (Wickets taken) - integer
Help her write a program, which will accept the player details from user and inserta new roW
into the table.
OR
) What do you mean by term domain in context of RDBMS? What will be the domain for
an attribute called 'age' of voters of a village?
() hesnav wants to write a program in python to display some records from the CRICKET
Table of SPORTSDatabase. The MySOL serveris running on LOCALHOST and the login
credentials are as following:
Username - keshav
Password - karma
Help him write a program, which willdisplay the name (only name) of all players who
have player 10Q or more innings.
Computer ScienceXIU/Ser-I/AGRO-I