Screenshot 2024-09-18 at 10.52.42 PM

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

PRINCE ASHOKRAUEGAEKWAD SCHOOL, VADODARA

1" TERMINAL EXAMINATION - 2023-2024


Subject: Computer Science Marks: 70
Class: XI| Date: 27/09/2023
General Instructions:
This question poper contoins fourSections Aond D. tach section Is compulsory
Both sections B and Chave intenal holces.
Section Acontalns Q,ltoQ.20 carries l mark cach.
Section Bcontains Q.21to Q. 30carrles 2 marks cach.
Section Ccontans Q.31 toQ.36 carrles 3 marks coch.
Section Dcontains Q.37to Q.39 carrles 3 narks each.
All programming questlons are to be answered using PythonLanguage only.
SECTION- A
Q.1 State True or False. (1]
"The continue statement is used to pass the control to the next iterative statement."
Q.2 Which of the following symbols are used for comments in Python?
(A) // (B) " (C) /**/ (D) #
Q.3 How to find the last element of list in Python? Assume 'bikes' is the name of list.

(A) bikes(0] (B) bikes(-1] (C) bikes[lpos] (D) bikes[:-1]


Q.4 access mode opens a binary file in writing and reading mode. (1]
a) rb b/wb+ c)ab d)wb
Q.5 load() is a method of (1]
a) File object b) csv module e/ pickle module d) math module

Q.6A text file "muthu.txt" is stored on a computer. Identify the correct option out of the
following options to open the file for reading. (1]
i) f-open("muthu.txt") ii) f=open("muthu.txt",'r)
ii) f=open("muthu.txt",'rb') iv) f=open("muthu.txt",'r+b')
a) (i),(ii)and (iv) b) (i) and (iv) e) (i) and (ii) d) (i),(ii) and (ii)
Q,7 Which SQL command is used to view structure of the table student? ):tibe hd in [1]
Q.8 The SELECT Statement when combined with clause, returns records
without repetition. (1]
(a) DESCRIBE (b) UNIQUE (c) DISTINCT (d) NULL
Q.9 Which of the following is an immutable data type in Python?
a) Lists b)Integer e)Dictionary d) Allthe above
Q.10 Write the output of the following code: (1]
d={ 'name':'rohan', dob': "2002-03-11','Marks' :98')
dl={ 'name': 'raj')
dl=d. copy ()
print ("d1 :", dl)
a) d1:('name': 'rohan, 'dob': '2002-03-11", Marks': '98')
D) d1= ('name': 'rohan 'dob', '2002-03-11', 'Marks':"987
C) {'name': 'rohan', 'dob':'2002-03-11', 'Marks': "98|
a) (d1:{name': 'rohan', dob': "2002-03-11', 'Marks': '98))
Ql1 What is the possible output of the program given below: (1]
import random
X = random.
random ()
print (int (x) )
a) 0 b) 1 c) 0.2 d) -0.1
Q.12 Avariable declared outside all the functions in a pvthon
statements which are True in the context of the variable. program, then mention te
[1)
1. This variable wil have
global scope.
2.This variable willnot be
accessible from anywhere in the prog.
3. This variable will have a large
lifetime than local variable.
4. This variable will be
referred as Local variable.
a) Only 182 b) Only 1 c) Only 18&3 d) Only 3
Q.13 In F-open("MyFile.txt"),name of fileobject is (1]
a.open b.MyFile.txt e.F d.F=open()
0.14 In which format does the readlines( )
function give the output? [1]
a. Integer type b. list type C. string type d. tuple type
Q.15 Afunction in python begins with which
keyword? (1]
a) void b) return c) int d def
Q.16 If column "Salary" contains the data set {15000,
the output after the execution of the given
25000, 10000, 15000}, what will be
query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
a)65000 b) 25000 c) 35000 d) 50000
a.17 Which SQL function is used to count the number of
rows in a SQL query? [1]
a) COUNT () b) NUMBER () c)SUM () d coUNT (*)
Q.18 SQL applies conditions on the groups through
clause after groups have been
formed.
(1])
a) Group by b)With c) Where d) Having
0.19 and 20 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 Aand R are true and R is not the correct explanation for A
(c) Ais True but Ris False
(d) A isfalse but Ris True
Q.19 Assertion (A): CSV (Comma Separated Values) is a file format for data storage which
looks like a text file.
[1
Reason (R): The information is organized with one record on each line and each field is
separated by comma.
Q 20 Assertion (A) In Python, retun statement isused toexit from afunc ion
Reasoning(R). The fetun statement passes back an expression to the (aller
SECTION N
Q21 How ae teN files dt dtfercot roon thn linary iles?
Q2?What is detault augumentIxplain with exanple
OR
What is lobal scope of varialble?(xplainwitlh exanple
Q.*1 Piedict the output of the Python code given below.
tuplel- (|1,22, , 44, 53 , 6.)
list| iat (L uplel)
lew list ||
lor i in listl:
if i82e -0:
new list.append(1)
new tuple tuple(new list)
print (new tuple)
syntactical
carefully and rewrite it after removing all
Q.24 Observe the following Python code very [2]
errors with each correction underlined.
import math
DEF exe cmain ():
") )
X=int (input ( "Enter a number:
if fabs (x) = X:
positive number")
print ("You entered a
else:
x -1
print "Number made positive: ", X
execmain ()
not. His code is
number and check whether it is prime or
Q.25 Rao has written a code to input a [2]
and underline the corrections made.
having errors. Rewrite the correct code
de f prime () :
:: ")
n=int (input ("Enter number to check
for i in range (2, n//2):
if n&i=0:
print ("Number is not prime \n")
break
elif:
print ("Number is prime \n)
following code? Also, specify the
0.26 What are the possible outcome(s) executed from the [2]
SEL.
maximum and minimum values that can be assigned to variable
import random
SEL=random. randint (0, 3)
ANIMAL = ["DEER", "Monkey", "COW", "Kangaroo"];
for A in ANIMAL:
SEI)
tor AA in range (1.
print (A, end =)
print ()
()

DEERDER

MOeEYMONKEY
VONKEVMONKEY
KANGAYOWANGAOOKANGARO0
COWCOIW DEHAA0VKEVCOVW (0W

KANGAROONANAO KANGAR00

|2|
Q27 Predict the output ot the code given below
8"Wolcome'cn"
nle(s)

for i in ange (0, n):


if (s|i) >'a' and |1) <'m'):
m- m ts(i). upper ()
elif (s|i] > 'n' and s|i) <= 'z'):
m = m +s[i-1]
elif (s[i] .isupper() ):
m = m + s[i).lower ()
else:
= m +'&!

print (m)

Q.28 What is Default constraint? Explain with example. (2]


OR
Define terms: a) Data Redundancy b)Attribute
Q.29 ldentify DDL and DML commands from following: (2)
ALTER, SELECT, DROP, UPDATE
Q.30 Observe the below table and answer the following questions. (2]
Table: COMPANY
CHD NAME CIY PRODUTNANE
111SONY DELHI TV
222 NOKIA MUMBAIMOBILE
333 ONIDA DELHI TV if==afccitoD"
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
cbe
666 DELL DELHI LAPTOP corohine
(i) What is degree and cardinality of the table?
(ii) Which field can be a primary key?
SECTION-C

0.31 Write a function in python showthe() to read the text file "hello.txt" and find out how many
lines begin with the word "The" or "THE", (3]
OR

Write a function in python, vowelCount() that count and displays the number of vowels in the text
file name "student.txt".

a.32Write a Program in Python that defines and calls the following user defined functions: (3]
i) ADDO- loaccopt and add data of an omployeo ta a (V filo
list with tield elements as emnpld, nane and mobilo to 'rocotdcsv 1ach record conists of a
storo cmployee id, employoe narne arnd
employee salary respectively.
()COUNTRO -To count the number of records preseot in the C5v le named 'record csv
Q33A binary tle "salary.DAT" has structure lomoloee ld. emolovee name, alaryl. Write a function
countrec) in Python that would read content of the file "salary DAr" and display the detals of thorn
employee whose salary is above 20000. (3|
OR
Atile sports.dat contains information in following format (event, participant). Write a progran that
would read the contents from file and copy only those records from sports.dat where the event
name is "Athletics" in new file named Athletics.dat
Q.34 Write a function ShowNum() to accept a list as parameter and returns the sum of all the even
numbers in the list. (3)
OR
Write afunction SQUARE LIST(L), where Lis the list of elements passed as argument to the function.
The function returns another list named 'newlist' that stores the square of all elements of L
For example: IfL contains [12,4,0,11]
The newList will have -[144,16,0,12 1]

(3)
Q.35 Give the output of the following SQL queries based on CABHUB table.
Table: CABHUB ir
ColourCapadtyCharges
VcodeVehicleName Mal 15
100 Innova Toyota WHITE
4 14
Suzuki BLUE
102 SX4 35
Mercedes RED
104 CClass 14
WHITE 3
105 A-Star Suzuki
3 1
Tata SILVER
108 Indigo

1 SELECT COUNT(DISTINCT Make) FROM CABHUB;


CABHUB WHERE Capacity=4;
2 SELECT Vehicle,Charges*2 "New Charges" FROM ('Suzuli,'Tata');
Make IN
3. SELECT Vehicle, Colour, Capacity where
[3]
Q,36 Write the statements for following:
Ename,
named "Employee" containing columns Ecode,
(a) Mr. Gupta wants to create a table
key to Ecode. Help him in writing an SQL
Department and Salary. He decided to assign primary
command to create table.
following record in the table:
(b) Write the command to insert the
Department: Production Salary: 26900
Ecode- 999 Ename- Shweta
varchar with 50 characters.
(c) Add acolumn REMARKS in the table with datatype as
SECTION- D
CUSTOMER
to (e) [any four] based on the relation
0.37 Write SQL Commands for the following (a) [4]
given below:
(a) Modify the qty to 30 whose custid is 101.
(b) Increase the PRICE by 3% whose name begins with 'S.
(c) Delete the record of CUSTOMER having ClID 222.
(d) Display all details of 'ARUN SINGH
(e) Display name and price in order of price.
NAM
ROLANSARNA
DLTMK KUMAR
OLANAUMAR
AULANAI
NTLA SONI
ONAL AGGARWA
ARUN SNGH S0,000

Q38 Consider the tollowint tables SCHOOL and ADMIN and answer the questions 4|
Tables ACCLSORIS
No Name
A01 Mother Bostd 12000 01
Ilard Disk S000
A03 Keyboard S02
Table: SHOP
A04 Mouse 01
Id SNane Area A05 Mother IBoard 13000
S01 ABC omputronlcs CP AO06 Keyboard 400
SO02 All Inlotech Media GK II A07 LCD 6O00
SO03 Tech Shop CP TO8 LCD 5800 SO5
S004 Gecks Tecno Soft Nehru Place TO9 Mouse 390
So05 Hitech Tch Store Nehru Place T10 Hard Disk 4300 S03

Write SQL statements for the following:


a) To display Minimum and Maximum Price of each Name of Accessories.
b)To display Name, Price of all Accessories and their respective SNane where they are available.
c) To display details of motherboard and keyboard from accessories.
d) To display all records of shop table.
Q.39 Arun, during Practical Examination of Computer Science, has been assigned an
incomplete search() function to search in a pickled file student.dat. The File student.dat is
created by his Teacher and the following information is known about the file. [4]
"File contains details of students in [roll_no,name, marks] format.
" File contains details of 10 students (i.e. from roll_no 1 to 10) and separate list of each
student is written in the binary file using dump().
Arun has been assigned the task to complete the code and print details of roll number 1.
def search ():
f = open ("student.dat", ) #Statement-1
while True:
rec = pickle. #Statement-2
if( ): #Statement-3
print (rec)
# statement -4
1. In which mode Arun should open the file in Statement-1?
2. ldentify the function(with argument), to be used at blank space in line marked as
Statement-2.

3. What willbe the suitable code for blank space in line marked as Staternent-3.
4. Which statement Arun should use at blank space in line marked as Statement4 to close
the file.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy