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

TAS computer science

Tas cs u

Uploaded by

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

TAS computer science

Tas cs u

Uploaded by

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

The Adarsh School

KirtiNagar, New Delhi - 110015


Class : 12 Mid Term Examingtions
Subject : Computer Science Time :3 Hrs M.M:70
1. State
2. The True or False : SECTION A(1 Mark each)
"In
3.
primary key is
selected fromPython, tuple is a mutable data type:
a) composite keys the set of 1
What will be the b) alternate keys
(A)-14.0 output of the following c) candidate keys (D) foreign keys
4. Select the correct output of the (B) 14.0 statement ?
print(6+5/4*"2//5+8) 1
(C) 14 (D)14
S="text#next" code:
1

5. In
print(S.s(A)tripext#nex
("t")
SQL, which B) ex#nex
a) UPDATE command will be used to add a new (C) text#nex (D) ext#next
6. 'L' in b) ADD record in a table ?
7. HTML stands for: (A) Large c) INSERT
1
Identify the valid Python (B) Language (C)
Long
d) ALTER TABLE

statementsidentifier
3. Consider the (A) 2user (D) Laser 1
given below (B) user@2 (C) user 2
Game="World Cup 2023" and then choose the (D)user 2 1
correct output from the given
9.
print(Game[-6::-1])
(A)CdrW (B) ce o
options : 1

Predict the output of the (C) puC lroW


following
>>>import statistics as s Python statements:
(D) Error
>>>s.mode ((10, 20, 10, 30, 10, 20, 30]) 1
a) 30 b) 20
10. Which of the c) 10 d) 18.57
following
import random output will never be
obtained when the given
Shuffle =random.randrange(10)+1 code is executed ? 1
Draw = 10*random.randrange(5)
print ("Shuffle", Shuffle, end="#)
print ("Draw", Draw)
a) Shuffle 1 # Draw 0 b)
11. Ethernet card is also Shuffle 10 # Draw 10 c) Shuffle 10 # Draw 0 d)
12. What will be the
knowNn as: (A) LIC (B) MIC Shuffle 11 # Draw 50
output of the given code ? (C) NIC (D) OIC 1
a=10
1
def convert(b=20):
a=30
C=a+b ( S.
print<a,c)(3o so)
convert(30)
print(a)
13. For the following Python statement :N= (25) What shall be the type of N?
a) Integer b)String c) Tuple d) List
1
14. Mr. Ravi is creating a field that contains
alphanumeric values and fixed lengths. Which MysoL data
type should he choose for the same ?
1
a) VARCHAR b) CHAR c) LONG NUMBER
15. Fill in the blank : The full form of WwWis wa t3ae t, )
1
16. files are stored in a computer in a sequence of bytes. a) Text b) Binary ) CSV d) Notepad 1
Oos 17 and 18are Assertion (A)and Reason (R) type questions. Select the most suitable option
a) Both (A) and (R) are true and (R) is the correct explanation of (A).
b) Both (A)and (R)are true, but (R)is not the correct explanation of (A).
c) (A)is true, but (R) is false.
d) (A) is false, but (R)is true.
program.
Assertion (A):Global variables are accessible in the whole
17. e iR) Local variables are accessible only within a function or block in which it is declared. into
numeric data are to be written to a text file, the data needs to be convertedd 1
Assertion (A):If to the file.
18. a string before writing file.
write() method takes astring as an argument and writes it to the text
Reason (R):
SECTION B(2 Marks each)

19. (0) Expand the following terms URL, XMI


(u) Give one difference between HITPand fTP
20. Rewrite the belowcode after removing allsyntactical errors, Underline all the corretitts
def 1fun)
ainput("Enter anumber")
if a>33:
print("Promoted to next class")
ELSE
print("Repeat")
21.Write the definition of a method/function SearchOut(Teachers, TNarne)tosearch for TNarnefrorn aliet
Teachers, and display the position of its presence.
For example: If the Teachers contain ("Ankit", "Siddharth", "Rahul", "Sangeeta", "rahul"] and TNarne
contains "Rahul" The function should display Rahul at 2 rahul at 4
22. Predict the output of the following code : 2
d=("ND":"DEL" "SRI:"COL","CHI":"BEI")
str1="
(o.)
for iin d:
str1=str1 +str(d[i])+"@"
str2=str1[::-1]
print (str2)
23.Write the Python statement for each of the following tasks using BUILT-IN functions only : 2
a) To delete an element 10 from the list Ist.
b) To replace the string "This"'with "That'in the string str1.
24. Ms. Rita is a database administrator at a school. She is working onthe table, student containing the
columns like Stud_id, Name, Class and Stream. She has been asked by the Principal to strike off the record
of a student named Rahul with student_ jd as 100 from the school records and add another student who has
been admitted with the following details : Stud_id - 123 Name - Rajeev Class - 12 Stream-Science
Help her by writing SQL queries for both tasks.
25. Predict the output of the following code : 2
def Total (Num=10):
Sum=0
for Cin range(1,Num+1):
if C%2!=0:
Continue
Sum+=C
return Sum
print(Total(4),end="$")
print(Total(),sep="@")

SECTION C(3marks each)


26. Predict the output of the Python code given below:
3
s="India Growing"
n= len(s)
m="
for iin range (0, n) : 3
if (sli] >= 'a' and s[i] <='m'):
m= m+s [i].upper() o t
elif (s(i) >s '0' and si] <='z): eou)a
m= m +s [i-1]
elif (s[i].isupper()):
m= m + s[i].lower()
else:
m = m + '@'
print (m)
7 Write a method/function COUNTWORDS() in Python to read contents from a text file DECODE. TXT.
to count and return the occurrence of those words, which are having 5 or more characters.
28 Write a function c_words()that separately counts upper and lower case alphabets from the file words. txt. 3
eonsider
the table
ITEMNo Stationery ITEMgiven below and write the output of the s l
DISTRIBUTOR
queries that folloy
PRICE QTY
401 Reliable Stationers 100 16
Ball Pen 0.5
402 Gel Pen Premium Classic Plastics 150 20

403 Clear Deals 210 10

404 Eraser Big Clear Deals 200


Eraser Small 150
405 Sharpener Classic
Classic Plastics
15
Classic Plastics 100
406 Gel Pen Classic DISTRIBUTOR;
a) SELECT STATIONERY GROUP BY
b) SELECT DISTRIBUTOR, SUM(QTY)
ITEMNO, ITEM FROM STATIONERY
FROM

vVnERE DISTRIBUTOR "Classic Plastics" AND PRICE > 10;


STATIONERY
oELLET ITEM, OTY * PRICE As"AMOUNT" FROM
WHERE ITEMNO = 402; queries for the following: 3
30. Consider the table Rent_cab, given below. Based on the given table, write SQL
Color Charges
Vcode VName Make
White 15
Big car Carus
101
10
Polestar Silver
102 Small car
Black 20
103 Family car Windspeed
White 30
104 Classic Studio
Trona Red
105 Luxury
column name Vcode.
a) Add a primary key to a
cabs by 10%.
b) Increase the charges of all the
maker name is "Carus".
c) Delete all the cabs whose

SECTION D(4Marks each)


following : 4
PLAYERS given below. Write SQL queries for the
31. Consider the tables GAMES and
Table: GAMES PrizeMoney
GameName Type Number
GCode
Indoor 2 5000
101 Carrom Board
2 12000
102 Badminton Outdoor
Table Tennis Indoor 4 NULL
103
Indoor 2 9000
104 Chess
Lawn Tennis Outdoor 25000
105
Table: PLAYERS
PCode Name GCode

1 Nabi Ahmad 101


2 Ravi Sahai 108
3 Jatin 101
Nazneen 103
of games played in each type.
a) Display the game type and average number tables Games and Players.
Kl Dienlay prize money, name of the game, and name of the players from the
games without repetition.
c) Display the types of game and prize money of those games whose prize moneyis known.
name of the
d) Display the
Programmer working in aschool. He has to maintain the records of the sports students.
a Python
32. Mr. Miscreated a csv file named:sports.csv. Structure of sports.csv is :(sport_id, competition, prize_won]
is
He has
id, is Sport id (integer) competition is competition name (string) prize_won ("Gold", "Silver",
wheresport wants to write the following user-definedfunctions: csv".
"Bronze"). Mr. M accept the detail of a student and add to a csv file, "sports.
to
Add detail(): to displaythe name of competitions in which students have wo "Gold"medal.
4
Count Medal(): Helphim in writingthe code of both the functions.
SECTION E(5 Marks each)
33. Logistic Technologies ttd. is expanding its office set-up to Ambala, At Ambala officece
planning to have 3different blocks for HR, Accounts and Logistics related work. As acarnpus,
networtthey are
are
have tosuggestthe best network related solutions for them for issues/problems raised in 0o
Distances between various blocks/locations :
HR Block to Accounts Blocks M00 meters
Accounts Block to logistics Block |200 meters
Logistics Block to HR Block 150meters
Delhi Head Office to Ambala Office 220 Km

Number of computers installed at varlous blocks are as follows :


|HR Block 70
Accounts Block 40

Logistics Block 30

i) Suggest the most appropriate block/location with reason to house the SERVER in the Ambala office
i) Suggest the best wired medium to efficiently connect various blocks within the Ambala office.
i) Draw an ideal cable layout (Block to Block) for connecting these blocks for wired connectivity.
iv)The company wants to schedule an online conference between the managers of Delhi and Ambala
offices. Which protocolwill be used for effective voice communication over the Internet?
v) Which ind of network will it be between Delhi office and Ambala office ? 5

34. () What is the main purpose of seek()and tell()method ? 2


(iüi) Consider a binary file, Cinema.dat containing information in the following structure:
[Mno, Mname, Mtype]
Write a function, search copy(), that reads the content from the file Cinema.dat and copies
all the details of the "Comedy" movie type to file named movie.dat.
3

35Mashanshi is a Python programmer. She has written a code and created a binary file "book.dat" that has
(BookNo, Book_ Name,Author, Price]. The following user defined function CreateFile() is structure
a record and add to book.dat and another user defined created to take input data for
function CountRec(Author) which accepts the Author
name as parameter and count and return number of books by the given
complete the following code based on the requirement given above: Author.
As aPython expert, help her to
import #statement1
def createFile():
fobj =open("book.dat"" ") #statement2
BookNo =int(input("Book number:"))
Book Name =input("Book Name:")
Author =input(|"Author:")
Price =int(input("Price:")
rec = (BookNo, Book_Name, Author, Price]
pickle. #statement3
fobj.close()
def Count Rec(Author):
fobj = open("book.dat", "rb")
num =0

try:
while True:
rec = pickle.
if Author = #statement4
rec[2]:
num=num+1
except:
fobj.close()
return num
Which module should be imported in the
::) AWritethe correct statement program? (Statement 1)
required to open a file named book dat. (Statement 2)
ih Which statenment shouid be Tlled in Statement 3 to write the
data into the binary file, book.at.
Ihl A/hich statement should be rilled in Statement 4 to read the data
from the file, book.dat?

You might also like