Computer Science Sample Paper 1
Computer Science Sample Paper 1
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
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 ?
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
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
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í
Section- E
34. Consider the following tables Activity and Coach and answer () and () parts of this question:
Table: ACTIVITY
Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
Ravinder 1008
Janila 1001
Naaz 1003
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
#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