0% found this document useful (0 votes)
41 views

Computer Science Sample Paper 1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Computer Science Sample Paper 1

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Time Allowed: 3 hours

Maximum Marks: 70
General Instructions:
This question paper contains five sections, Section A to E.
(ii) All questions are compulsory.
(iii) Section A have 18 questions carrying 01 mark each.
(io) Section B has 07 Very Short Answer type questions carrying 02 marks each.
(v) Section C has 05 Short Answer type questions carrying 03 marks each.
(i) Section D has 03 Long Answer type questions carrying 05 marks each.
(vri) Section E has 02 questions carying 04 marks ench. One internal choice is given in Q35 against part c only
(viii) All programming questions are to be answered using Python Language only.

Section-A
L. State True or False.
'in' is a
logical operator in Python.
2. Which of following is not a decision-making or selection statement?
(A) if-elif statement (B) for statement
(C) if-else statement (D) if statement
3. The for loop in Python is an
(A) Entry Controlled Loop (B) Exit Controlled Loop
(C) Both of the above (D) None of the above
4. What is the output when the following code is executed?
print(rnhello")
(A) a new line and hello (B) nhello
(C) the letter r and then hello (D) Error
5. Which type of bracket is used to define a ist?
(A) [1 (B) ()
(C){} (D)<>
6. What do we call a function defined inside a class?
(A) Module (B) Class
(C) Another function (D) Method

7. Fill in the blank


are also known as positional arguments.
(A) Keyword arguments (B) Default arguments
(C) Required arguments (D) Variable length arguments
8. A relational database is a collection of
(A) Attributes (B) Tables
(C) Records (D) Fields
Sample Question apers

9. Which of the
(A) It following option the correct usage for the tell() of
is
places the file pointer at a
a file obyetcer
(B) returns the entire
It desired offset in a file
(C) Itreturns the byte content of a file
position of the file pointer as an ineger
(D) It tells the details about
the file (11
10. Fill in the blank
A field of a table is
termed as
(A) Row
(C) Key (B) Attribute
(D) Tuple
11. How can you separate the
content in a text file?
(A) whitespace
(B) tab
(C)comma (D) All of these [1
12. Fill in the blank
is not an aggregate function.
(A) AVG
(B) MAX
(C) JOIN (D) COUNT [1
13. Fill in the blank
Switching technique follows the store and forward mechanism
(A) Circuit
(B) Message
(C) Packet
(D) All of these [1]
14. In the following list, which item has the index number of 3?
rJohn", "Harry", "Jesse", "John", "Harry'", "Harry"1
(A) "John" (B) "Harry"
(C) "Jesse" (D) "None of these"
15. Which method of cursor class is used to execute database function or stored procedure in Python ?

(A) cursor.callprocedure(procedurename', [parameters,))


(B) cursor.callproc(procedurename', [parameters,)
(C) cursor.callfunc(procedurename, [parameters,)
(D) cursor.callfunction(procedurename, [parameters,|)
16. is the set of records that are retrieved after execution of SsQL query over an established database
connection.
(A) sqlresult (B) resultset
(C) table (D) tuple
Assertion and Reason:
In the following questions, A statement of Assertion (A) is followed by a statement of Reason (R). Mark the
correct choice as.

(A) Both A and R are true and R is the correct explanation of A.


(B) Both A and R are true and R is not correct explanation of A.
(C) A is true but R is false.
(D) A is false but R is true.
17. Assertion (A): Interactive mode allows execution of individual statement instantaneously.
than one instruction in a file called Python source code file that
Reason (R): Script mode allows us to write more

can be executed.
control condition of the
18. Assertion (A): The while statement executes a block of code repeatedly as long the
as

loop is false.
Reason (R): If the condition of the while loop
is initially false, the body is not executed even once.
46 Cs, C\ass-XII

Sectlon-
19. Identify the errors(s) in the code and write the correct code.
def describe intelligent life form (0:
height input ("Enter the heighe")
raw_input ("ls it correct?")
weight input ("Enter the weight)
favourite-game = input ("Enter favourite game")
print (your height", height, 'and weight', weight)
print ('and your favourite game is", favouritism, ) (2 marks for correct
ansuve)
20. Write any two differences between twisted pair cable and coaxial cable.
OR
18 Gbps is equal to how many bits per second?
21. (a) Write the output of the following Python code:
i-5
j-7
x=0
i=i+ (j-i)
x=j+i
print (x, ": ", i)
j=j**2
x=j+i
i-i+1
print (i, "; ",j)
b) What is the output of the following code
my l i s t = ["Python", "Language"
print ("- " .join (my_list))
22. Consider the tables FACULTY and COURSES with structure as follows.
FACULTY COURSESs
F ID C ID
FName F_ID
LName Cname
Hiredate Fees
Salary
Wiite Python codes to display details of these faculties whose salary is greater than 12000
Z3. (a) Assume that 50 employees are working in an organization. Each employee has been allotted a separae
workstation to work. In this way, all computers are connected through the server and all these worksabons
are distributed over two floors. In each floor, all the computers are connected to a switch. Identify the byp*
of network?
(b) Given below are two addresses.
(i) http://www.abc.com/index.htm
(i) 182.68.9.165
ldentify which one of the above is an IP address and which one is a URL?
24. Suppose the content of "Rhymes.bxt" is
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)
Sample uestion Papers

OR
Suppose the content of "Rhymes.txt" is
Hickory Dickory Dock
The mouse went
up the clock
What will be the
output of the following Python code
F open ("Rhymes.txt")
1
F.readl ines ()
x
["the","ock"
=

for i in L:
for in
w
i.split()
if w in x:
print (w, end ")
25. Write the full forms of DDL and DML. Write any two commands of DML in su
(2
OR
Differentiate between char(n) and varchar(n) data types with respect to databases.

Section C
0.(a) Write appropriate sql statement to display item names and rates of the products having their names ending

WITH soap
below:
(6) Write the output of the queries (i) to (iv) based on the table, Furniture given
Table: FURNITURE

DATEOFPURCHASE COST DISCOUNT


FID NAME
45,000 10
BO01 Double Bed 03-Jan-2018
TO10 Dining Table 10-Mar-2020 51,000
22,000
B004 Single Bed 19-Jul-20016
LongBack Chair |30-Dec-2016 12,000
CO03
15,000 12
TO06 Console Table 17-Nov-2019
28,000 14
BO06 Bunk Bed 01-Jan-2021

FURNITURE WHERE COST>15000;


(i) SELECT SUM (DISCOUNT) FROM
FURNITURE;
(i) SELECT MAX (DATEOFPURCHASE)FROM "

WHERE DISCOUNT>5 AND FID LIKE T%'


(ii) SELECT* FROM FURNITURE
WHERE NAME IN ("'Dining Table", "Console Table")
SELECT DATEOFPURCHASE FROM FURNITURE
iv) [1+2-3]
27. (a) Write a statement in Python to perform the following operations:
text file in write mode.
"MYPETTXT"
(i) To open a read mode.
text file "MYPETTXT" in
(ii) To open a
Write a function that:
(b) diameter of circle in inches.
Asks the user to input
OR
the number of "Me" or "My" words present in a text file "STORY.TXT".
Write a function in Python that counts

contents are as follows:


If the "STORY.TXT"
My first book
was Me and

MyFamily.It
gave me

chance to be
Known to the
world.
function should be:
The output of the
Count of Me/My in file
, Class-XII

28. (a) Consider the table, MOVIEDETAILS given below:


Table: MoVIEDETAILS
MOVIEID TITLE LANGUAGE | RATING | PLATFORM
MO01 Minari Korean Netflix
M
MGR Magan lamil Hostar
M010 Kaagaz Hindi Zee5
MO11 Harry Pbtter and thhe chamber of secrets English Prime video
MO15 Uri Hindi Zee5
M020 Avengers: Endgame Hotstar
English
ldentify the degree and cardinality of the table.
) Consider the following tables EMPLOYEE and DEPARTMENT and answer () and (i) parts.
Table: EMPLOYEE
ECode EName DepCde Salary Age JoinDate
15 Sameer Sharma 123 75000 39 01-Apr-2007
21 Raguvindra K 101 86000 29 11-Nov-2005
34 Rama Gupta 119 52500 43 03-Mar-2010
46 CRMenon 103 67000 38 12-Jul-2004
77 Mohan Kumar 103 63000 55 25-Nov-2000
81 Rajesh Kumar 119 74500 48 11-Dec-2008
89 Sanjeev P 101 92600 54 12-Jan-2009
93 Pragya Jain 123 32000 29 05-Aug-2006
Table: DEPARTMENT

DepCde DepName DepHead


101 ACCOUNTS Rajiv Kumar
103 HR PKSingh
119 IT Yogesh Kumar
123 RESEARCH Ajay Dutta
() Wirite SQL commands for the following statements:
(A) To display all DepName along with the DepCde in descending order of DepCde.
(B) To display the average age of Employees in DepCde as 103.
(i) Give the output of the following SQL queries:
(A) SELECT COUNT (DISTINCT DepCde) FROM EMPLOYEE;
(B) SELECT MAXJoinDate), MIN (JoinDate) FROM BMPLOYEE;
29. Write a function that takes a list that is sorted in ascending order and a number as argument. The function
should do the following
Insert the number passed as argument in a sorted list.
Delete the number from the list.
30. What does the extend() function do? (31
Evaluate the following Postfix notation of expression:
4,2,22,5,6,+/
OR
What is overflow situation in stack?

Write equivalent postfix expressions for the following infix expression:


a+b'd = (a+(b'd))
Sample Question Papers

Sectlon-D
hub at Bengaluru,Asa y company. The company is planning to set up their new offices in India with its
As a
r network adviser, you have to understand their requirements and suggest ne
n queries are mentioned as () to (v) below: Physical Location of the blocks of ABC. A0
Human Resource
Conference Finance
Block to Block Distances
(int Mtr)
| Block (From)
Block (To) Distance
Human Resource Conference 110
Human Resource Finance 40
Conference Finance 80
Expected number of computers to be installed in each block:
Block Computer
Human Resource 25
Finance 120
Conference 90
4) What will be the most
appropriate block, where ABC should plan to install their server
(i) Which type of topology is best suited for above network?
) What will be the best possible connectivity you will suggest to connect the new setup of offices in Chennai
with its London based office.
iv) Which device will be
suggested by you to connect each in each of the
computer buildings?
(VThe company wants internet accessibility in all the blocks. What would the suitable and cost-effective
technology for thae?
32. (a) What will be the result of 5]
following functions?
(i) Unicode (3+2j)
(i) Str (015)
(ii) Complex (3,2)
(iv) Long (5.7)
(b) Consider the table Teacher in which Tina wants to add two rows. For this, she wrote a program in which
some code is missing. Help her to complete the following code.
import mysql.connector
mycon=mysql.connector.connect
database=" test" )
(host="localhost", User="root", passwd="system",
cursor=con.cursor ()
Sql="INSERT Teacher (T_Id, Fname, Lname, Hire_date, Salary, Subject)
VALUSE (*s, $s, *s, 8s, is, ts)"
#Line1
val =[ (101, Vibha', 'Bajpai', '12-10-2021 27000, Python'), (104,
Sharma', '01-01-2022', 27000, 'Math' )1 Rekha',
try:
cursor.executemany (Sql, val)
mycon. () #Line2
except:
mycon.rollback () # Line3
(i) Which function will be filled in the blank at line2?
(i) What should be come in the blank at the linel?
(ii) Which function will be filled in the blank at line3?
[2+3]
OR
(a) Whatdoes the expression 2 +3*4 resultin ? give reasons.
(b) Write Python code to create a table Faculty with following fields.
Id, LastName, FirstName, Locationld, phone, rank, startdate
Rank should be one of the following
ASSO, FULL, ASST,INST
33. How will you open a text file btext.txt in write and read mode?
function that searches
for a given character and reports tho
A text file "PARA.txt" contains a paragraph. Write a
number of occurrence of the character in the file.
OR
Which module is used to rename or delete/remove a file from within a programí

Whrite a funtion to create a text file containing following data:


Neither apple nor pine are in pineapple. Boxing rings are square.
Wnters write, but fingers don't fing. Overlook and oversee are opposites. A house can burn up as it burns down. An

alam goes off by going on.


the screen.
(ci) Kead back the entire file content using read() dr readlines() and display on
Append more text of your choice in thefile and display the content of fle with line numbers prefied to
line.
(ii) Display last line of file.
(iv) Display first line from 10th character onwards

Section- E
34. Consider the following tables Activity and Coach and answer () and () parts of this question:
Table: ACTIVITY

ACode ActivityName Stadium Participants PrizeMoney ScheduleDate


Num
1001 Relay 100 x4 Star Annex 16 10000 23-Jan-2004
1002 High JumP Star Annex 10 12000 12-Dec-2003
1003 Shot Put Super Power 12 9000 01-Jan-2004
1005 Long JumP Star Annex 12 9000 01-Jan-2004
1008 Discuss Throw Super Power 10 15000 19-Mar-2004

Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
Ravinder 1008
Janila 1001
Naaz 1003

G) What all domain names are possible in attribute ACode?


# fresh
(i) Which keyword is used to sort the records of a table in descending order? [CBSE SQP-20201
(i) Write SQL commands for the following statements:
(a) To display the names of all activities with their ACodes in descending order
(b) To display sum of PrizeMoney for the Activities played in each of the Stadium separately [1+1+24
(Option of Part (ii) Only)
OR
(ii) Give the output of the following SQL queries:
(a) SELECT cOUNT (DISTINCT ParticipantsNum) FROM ACTIVITY
(b) Select Max (ScheduleDate), Min (ScheduleDate) From Activity;

35. Abhinav, an intern is Excel Pvt. Ltd, is developing a project using the cvs module in Python. He has partially
developed the code as follows leaving out statements about which he is not very confident. The code also
contains error in certain statements. Help him to find the answer of following questions to read the code to read
the desired CSV File named "Employee.csv"
#CSV File Content
ENO, NAME, DEPARTMENT
Sample Question Papers 51

E1, ROSHAN SHARMA,


ACCOUNTS
E2, AASMA KHALID, PRODUCTION
E3, AMRIK GILL, MARKETING
E4, SARAH WILLIAMS, HUMAN RESOURCE
# incomplete Code With Errors
#Statement-1
import CSV
with open( 'newline=' ') as File:
#Statement-2

#Statement -3
ER= csv.
#Statement-4
for R in range (ER):
#Statement-5
if _== 'ACCOUNTS": #Statement-6
print (
should he write in place of CSVto
(a) Abhnav gets an Error for the module name used in Statement. 1. What
import the correct module? to open the mentioned
file. [1]
the code for blank in the line marked as Statement-2
(6) ldentify missing spaces (21
Abhinav as Error in Statement-4. What should
he write to correct the statement?
(c) gets

You might also like