12 CS 2023-24 QP PB ISM Set123

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

CODE

083/1/1
NUMBER
I I I I SET NUMBER 1

INDIAN SCHOOL MUSCAT


FIRST PRE BOARD EXAMINATION 2023
COMPUTER SCIENCE(083)

CLASS: XII TIME ALLOTED : 3 HRS.


DATE: 30.11.2023 MAXIMUM MARKS: 70

GENERAL INSTRUCTIONS:

• Please check this question paper contains 35 questions.


• The paper is divided into 4 Sections- A, B, C, D and E.
• :SectionA, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.

Ques. Question Marks


No.
SECTION A

1. State True or False: 1


"Identifiers are names used to identify a variable, function in a program".

2. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Count(attribute) (b) Count(*) (c) Avg( ) (d) Sum( )

3. What will be the output of the following statement: 1


print(5+10*1 *2**4-4//4)
(a) 164 (b) 155 (c) 156 (d) 145
4. What will be the output of the following code? 1
print("ComputerProgram" .split("er",2))

(a) ['Computer', 'Program'] (b) ['Comput', 'Program']


(b) ['Comput', 'erProgram'] (d) ['Comput', 'er', 'Program']

5. Which of the following is a DML command? 1


(a) CREATE (b) ALTER (c) INSERT (d) DROP

Page 1 of 9
6. Name the protocol that is used to send emails. 1
(a) SMTP (b) IP (c) TCP (d) FTP

7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)

8. Consider the statements given below and then choose the correct output from the given 1
options:
SS="PYTHON"
print( SS[ :3:])
(a) THON (b) HON (c) PYTH (d) PYT

9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) print(tup1[2]) (b) tupl[2] = 20
(c) print(min(tupl)) (d) print(len(tupl))

10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose", "Jasmine", "Sunflower", "Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")

(a)Rose*Jasmine* (b) Rose*Jasmine* Sunflower*


(c) Rose* (d) No Output

11. Which of these is not an example of unguided media? 1


(a) Optical Fibre Cable (b) Radio wave (c) Bluetooth (d) Satellite

12. Consider the code given below: 1


Which of the following statement should be given in the blank for #Missing Statement, if
the output produced is 240?
y=200
def check(x) :
________ #missing statement
y=y+x*2
check(20)
print(y)
(a) global x=IO0 (b) global x (c) global y (d) global y= 10

13. State whether the following statement is True or False: 1


NameError is raised when a built-in method or operation receives an argument that has the
right data type but mismatched or inappropriate values.

14. Fill in the blank: 1


_______ clause is used to remove duplicate values of the table.
(a) DESCRIBE (b) DISTINCT (c) UNIQUE (d) NULL

Page 2 of 9
15. Fill in the blank: 1
------
is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway

16. To move a file pointer f, 10 bytes ahead from the current position of file, function used is - 1
(a) f.seek(l0) (b) f.seek(lO,0) (c) f.seek(l0,1) (d) f.seek(l0,2)

Ql 7 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
(a) Both A and Rare true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True

17. Assertion (A):- Keyword arguments are related to function calls. 1


Reasoning(R ):- When you use keyword arguments in function call, the caller identifies the
arguments by the parameter name.

18. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.

SECTIONB

19. (i) Expand the following terms: 2


PPP, HTTP
(ii) Give one difference between XML and HTML.

OR

(i) Give one advantage and one disadvantage of bus topology.


(ii) Explain packet switching.

20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOfDigits(num):
s=0
whilenum>0
d==num % 10
s=s+d
num //=10
returns
print(SumOIDigits(1234))

21. Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY= {1:"Sydney" ,2: "Tokyo",3:"Pinkcity" ,4:"Beijing",5 :"Suncity"}
The output should be:
PINKCITY

22. What will be the Output for the following code? 2


Language=["C" "C++" "JAVA" "Python" "VB" "BASIC" "FORTRAN"]
' ' ' ' ' ,
del Language[4]
Language.remove("JA VA")
Language. pop(3)
print(Language)

23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To insert an element 500 at the third position, in the list named, MYLIST.
(ii) To count number of characters in a string named, STRl including spaces.

OR

A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.

24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.

OR

Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID - CHARACTER OF SIZE 3
NAME - CHARACTER OF SIZE 10
SALARY-NUMERIC
Write SQL commands to:
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.

25. Write the output of the code given below: 2


p=200
def callme(q,r=2):
global p
p=r+q**2
print(p, end= '#')
a=5
b=l0
callme( a,b)
callme(r=10,q=3)
Page 4 of 9
SECTIONC

26. What output will be generated when the following Python code is executed? 3
s='criCkeT23'
n = len(s)
m="
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m + s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m=m+s[i-1]
else:
m=m+'#'
print(m)

27. Write the output of the queries (i) to (iii) based on the table, PATIENT given below: 3

Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
PlOl Kavita 52 Surgery 800 F
P102 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M

(i) SELECT DEPARTMENT, COUNT(*) FROM PATIENT


GROUP BY DEPARTMENT HAVING COUNT(*) >2;

(ii) SELECT SUM (CHARGES) FROM PATIENT WHERE GENDER= "M";

(iii) SELECT PNO, NAME FROM PATIENT


WHERE DEPARTMENT IN("Cardiology", "Surgery");

28. Write a function, COUNT_TLINES() in python to read a text file "Report.txt", that counts 3
and displays the number of lines which are starting with 'T' present in the text file.

OR
Write a function, COUNT_WORDS( ) in Python that counts and displays the number of
"DIET" word present in the text file "Health.txt".

29. Table: GRADUATE 3


SNO NAME STIPEND
1 KARAN 400
2 RAJ 500
3 VARUN 1000
4 NISHA 800

Page5 of 9
Based on the data given above answer the following questions:

(i) If 3 columns are added and 1 row is deleted from the table GRADUATE, what will
be the new degree and cardinality of the above table?

(ii) Increase the STIPEND by 20% whose NAME starts with 'R'.

(iii) Insert the following record into the table


SNO - 5, NAME - SHYAM, STIPEND - 700

30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, RoomType, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel'
(i) Push_Cust( CList) - It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )- It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.

For example:
If the nested list contains the following data:
CList= [["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]

The stack should contain:


['Jerry', 1500]
['Sunil', 2000]

The output should be:


['Jerry', 1500]
['Sunil', 2000]
Stack Empty
SECTION D

31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4

Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI

Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA TOI
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW TOI
1003 Digital Cam 12 X 160 '1 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03

Page 6 of 9
(i) Display name, price and company of all the items in descending order of company .

(ii) Display item name and price of all those items, whose price is in the range of 5000and
1 5000. (both values inclusive).

(iii)Display Item name , company and Trader name from tables ITEMS and TRADERS.

(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2

3 2. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( )- To accept and add data of an item to a CSV file 'item.csv'. Each record
consists of a list with field elements as icode, description and price to store item
code, item description and price respectively.
(ii) countrec( )-To count and display the number of items with price less than 1 000.

SECTIONE

33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4 buildings as shown in the diagram below:

MANGLORE OFFICE
DELHI

HEAD OFFICE

TRAINING

RESOURCE

FINANCE

Centre to centre 1stances between vanous bUl·1d·Ill�s 1s as fio11ows:


ADMIN to FINANCE 50m
FINANCE to TRAINING 150m
TRAINING to RESOURCE 25m
ADMIN to RESOURCE 170m
FINANCE to RESOURCE 1 25m
ADMIN to TRAINING 90m
Manglore to Delhi Head office 2 233Km

Page 7 of 9
Number of computers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10

(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.

(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.

(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch

(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?

(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.

34. (i) Differentiate between 'w+' and 'r+' file modes in Python. 2+3=5

(ii) Consider a file, 'Movie.dat', containing records ofthe following structure:


[Movieid, Mname and Mtype]
Write a function, copyData( ), that reads contents from the file 'Movie.dat' and copies
the records with Mtype as "Comedy" to the file named 'Cmovie.dat'. The function
should return the total number ofrecords copied to the file 'Cmovie.dat'.

OR

(i) How are csv files different from text files?

(ii) A binary file "Account.dat" has the following structure:


[Acct_Number, Acct_Type, AcctHolderName, Balance]
Write a function CountBalanceAbove(BAL) that accepts BAL as parameter in Python
that would read contents ofthe binary file "Account.dat" and display the details ofthose
accounts in which Balance is more than BAL. Also display number ofsuch accounts.

35. (i) Define Natural join. 1+4=5

(ii) Vivek wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
.
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost

The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Vivek to write the program in Python.

OR

(i) Give one difference between candidate key and alternate key.

(ii) Ravi has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float

Note the following to establish connectivity between Python and MySQL:


• Usemame - root
• Password - tiger
• Host - localhost

Ravi, now wants to display the records of books whose price is less than 2000. Help
Ravi to write the program in Python.

****END OF THE QUESTION PAPER****

Page 9 of 9
IIII CODE
NUMBER
SET NUMBER
083/1/2
2

INDIAN SCHOOL MUSCAT


FIRST PRE BOARD EXAMINATION 2023
COMPUTER SCIENCE(083)

CLASS : XII TIME ALLOTED : 3 HRS.


DATE: 30.11.2023 MAXIMUM MARKS: 70

GENERAL INSTRUCTIONS:

• Please check this question paper contains 35 questions.


• The paper is divided into 4 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.

Ques. Question Marks


No.
SECTION A

1. State True or False: 1


"Variable declaration is implicit in Python."

2. Which of the following is a DDL command? 1


(a) SELECT (b) ALTER (c) INSERT (d) UPDATE

3. What will be the output of the following statement: 1


print( 10 - 2**1**3 + 16 // 3 - 17 % 3)
(a) 14 (b) 5 (c) 17 (d) 11
4. What will be the output of the following code? 1
print("ComputerScience" .split("er",2))

(a) ['Computer', 'Science'] (b) ['Comput', 'Science']


(c) ['Comput', 'erScience'] (d) ['Comput', 'er', 'Science']

5. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Count(attribute) (b) Count(*) (c) Avg( ) (d) Sum( )

Page 1 of 9
6. Which of these is not an example of unguided media? 1
(a) Optical Fibre Cable (b) Radio wave (c) Bluetooth (d) Satellite

7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)

8. Consider the statements given below and then choose the correct output from the given 1
options:
S="DIGITAL#INDIA"
print(S[-4: 1:-2])
(a) N#AI (b) TG (c) N#AII (d) No Output

9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) print(tupl [2]) (b) tup1[2] = 20
(c) print(min(tup 1)) (d) print(len(tup 1))

10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose", "Jasmine", "Sunflower", "Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")

(a)Rose*Jasmine* (b) Rose*Jasmine*Sunflower*


(c) Rose* (d) No Output

11. We can upload a file to a web server using a protocol called ____ 1
(a) FPT (b) IP (c) TCP (d) FTP

12. Consider the code given below: 1


Which of the following statement should be given in the blank for #Missing Statement, if
the output produced is 240?
y = 200
def check(x) :
________ # missing statement
y = y+x * 2
check(20)
print(y)
(a) global x= I00 (b) global x (c) gl<:>bal
y (d) global y=10

13. State whether the following statement is True or False: 1


The statements inside the finally block are always executed regardless of whether an
exception has occurred in the try block or not.

14. Fill in the blank: 1


________clause is used to remove duplicate values of the table.
(a) DESCRIBE (b) DISTINCT (c) UNIQUE (d) NULL

Page 2 of 9
15. Fill in the blank: 1
------ is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway

16. To move a file pointer f, 10 bytes ahead from the current position of file, function used is - 1
(a) f.seek(l0) (b) f.seek(l0,0) (c) f.seek(l0, l ) (d) f.seek(l0,2 )

Ql7 and 18 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 A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True

17. Assertion (A):- Keyword arguments are related to function calls. 1


Reasoning(R ):- When you use keyword arguments in function call, the caller identifies the
arguments by the parameter name.

18. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.

SECTIONB

19. (i) Expand the following terms: 2


SMTP, VoIP
(ii) Give one difference between XML and HTML.

OR

(i) Give one advantage and one disadvantage of star topology.


(ii) Explain circuit switching.

20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOfDigits(num):
s=0
while num>0
d== num % 10
s=s+d
num//=10
returns
print(SumOfDigits(1234))

21 . Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY={l :"Sydney",2:"Tokyo",3:"Pinkcity",4:"Beijing",5:"Suncity"}
The output should be:
PINKCITY

22. What will be the Output for the following code? 2


Language=["C", "C++", "JAVA", "Python", "VB", "BASIC", "FORTRAN"]
del Language[4]
Language.remove("JAVA")
Language. pop(3)
print(Language)

23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To insert an element 300 at the fifth position, in the list named, LSTl.
(ii) To count number of characters in a string named, STRl including spaces.

OR

A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.

24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.

OR

Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID - CHARACTER OF SIZE 3
NAME - CHARACTER OF SIZE 10
SALARY - NUMERIC
Write SQL commands to
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.

25. Write the output of the code given below: 2


p= l 00
def callme(q,r=2):
global p
p=r+q**2
print(p, end= '#')
a 20
=

b=5
callme( a,b)
callme(r= 1 0,q= 1)
Page 4 of 9
SECTION C

26. What output will be generated when the following Python code is executed? 3
Msgl ="WeLcOME"
Msg2="GUeSTs"
Msg3=""
fo r I in range(0,len(Msg2)+1):
if Msgl [I]>="A" and Msgl[I]<="M":
Msg3=Msg3+Msgl[I]
elif Msgl[I]>="N" and Msgl[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3 +"*"
print(Msg3)

27. Write the output of the queries (i) to (iii)based on the table, PATIENT given below: 3

Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
P lOl Kavita 52 Surgery 800 F
P102 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M

(i) SELECT DEPARTMENT, COUNT(*)FROM PATIENT


GROUP BY DEPARTMENT HAVING COUNT (*)>2 ;

(ii)SELECT SUM (CHARGES)FROM PATIENT WHERE GENDER = "F";

(iii)SELECT PNO, NAME FROM PATIENT


WHERE DEPARTMENT IN("Cardiology", "Surgery");

28. Write a function, DISPLAYLINES( ) in Python to read a text file 'Story.txt' and displays 3
those lines which are not starting with an alphabet 'S'.

OR
Write a function, Count_Dwords( ) in Python that counts and displays the number of words
ending with a digit in the text file named "Message.txt".

29. Table: GRADUATE 3


SNO NAME STIPEND
1 KARAN 400
2 RAJ 500
3 VARUN 1000
4 NISHA 800

Page 5 of 9
Based on the data given above answer the following questions:

(i) If 1 column is added and 2 rows are deleted from the table GRADUATE, what will
be the new degree and cardinality of the above table?

(ii) Increase the STIPEND by 10% whose NAME ends with 'N'.

(iii) Insert the following record into the table


SNO - 5, NAME - SHYAM, STIPEND - 700

30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, RoomType, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel'
(i) Push_Cust( CList)-It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )- It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.

For example:
If the nested list contains the following data:
CList=[["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]

The stack should contain:


['Jerry', 1500]
['Sunil', 2000]

The output should be:


['Jerry', 1500]
['Sunil', 2000]
Stack Empty
SECTION D

31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4

Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI

Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA T0l
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW T0l
1003 Digital Cam 12 X 160 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03

Page 6 of 9
(i) Display name, price and company of all the items in descending order of item names .

(ii) Display item name and price of all those items, whose price is in the range of 10000
and 22000. (both values inclusive).

(iii)Display Item name and Trader name from tables ITEMSand TRADERS.

(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2

32. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( )- To accept and add data of an item to a CSV file 'item.csv'. Each record
consists of a list with field elements as icode, description and price to store item
code, item description and price respectively.
(ii) searchrec( )-To display the records of the those items with price less than 1000.

SECTIONE

33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4 buildings as shown in the diagram below:

MANGLORE OFFICE
DELHI

HEAD OFFICE

TRAINING

RESOURCE

FINANCE

Centre to centre d.IStances between vanous U1 lllJ�s IS as fio11ows:


ADMIN to FINANCE 50m
FINANCE to TRAINING 150m
TRAINING to RESOURCE 25m
ADMIN to RESOURCE 170m
FINANCE to RESOURCE 125m
ADMIN to TRAINING 90m
Manglore to Delhi Head office 2233Km

Page 7 of 9
Number of computers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10

(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.

(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.

(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch

(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?

(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.

34. (i) Differentiate between 'w+' and 'a+' file modes in Python. 2+3=5

(ii) Consider a file, 'Movie.dat', containing records of the following structure:


[Movieid, Mname and Mtype]
Write a function, copyData( ), that reads contents from the file 'Movie.dat' and copies the
records with Mtype as "Comedy" to the file named 'Cmovie.dat'. The function should
return the total number of records copied to the file 'Cmovie.dat'.

OR

(i) How are csv files different from binary files?

(ii) A binary file "Account.dat" has the following structure:


[Acct_Number, Acct_Type, AcctHolderName, Balance]
Write a function CountBalanceAbove(BAL) that accepts BAL as parameter in Python
that would read contents of the binary file "Account.dat" and display the details of those
accounts in which Balance is more than BAL. Also display number of such accounts.

35. (i) Defme equi-join. 1+4=5

(ii) Aamir wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost

The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Aamir to write the program in Python.

OR

(i) Define primary key and foreign key.

(ii) Sanjeev has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float

Note the following to establish connectivity between Python and MySQL:


• Usemame - root
• Password - tiger
• Host - localhost

Sanjeev, now wants to display the records of books whose price is more than 1000.
Help Sanjeev to write the program in Python.

****END OF THE QUESTION PAPER****

Page 9 of 9
CODE NUMBER 083/1/3
SET NUMBER
I 3
I
INDIAN SCHOOL MUSCAT
FIRST PRE BOARD EXAMINATION 2023
COMPUTER SCIENCE(083)

CLASS: XII TIME ALLOTED : 3 HRS.


DATE: 30.11.2023 MAXIMUM MARKS: 70

GENERAL INSTRUCTIONS:

• Please check this question paper contains 35 questions.


• The paper is divided into 4 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.

Ques. Question Marks


No.
SECTION A

1. State True or False: 1


"Variable declaration is implicit in Python."

2. Which of the following is a DDL command? 1


(a) CREATE (b) DELETE (c) INSERT (d) UPDATE

3. What will be the output of the following statement: 1


print(16 - (4 + 2) * 5 + 2**3 * 4)
(a) 21 (b) 12 (c) 18 (d) 16
4. Consider the statements given below and then choose the correct output from the given 1
options:
S="RAINY#SEASON"
print(S[-2:2:-2])
(a) IYSA (b) AN#E (c) OASY (d) No Output

5. All aggregate functions except _____ ignore null values in their input collection. 1
(a) Sum( ) (b) Count(*) (c) Avg( ) (d) Count(attribute)

Page 1 of 9
6. Which of these is not an example of unguided media? 1
(a) Satellite (b) Radio wave (c) Bluetooth (d) Optical Fibre Cable

7. The command to merge the dictionary Book with Library would be: 1
(a) Book+Library (b) Book.add(Library)
(c) Book.update(Library) (d) Book.merge(Library)

8. What will be the output of the following code? 1


print("ComputerScience".split("er",2))

(a) ['Computer', 'Science'] (b) ['Comput', 'Science']


(c) ['Comput', 'erScience'] (d) ['Com.put', 'er', 'Science']

9. Consider a tuple tupl = (10, 15, 25, 30). Identify the statement that will result in an error. 1
(a) tup1[2] = 20 (b) print(tupl [2])
(c) print(min(tup1)) (d) print(len(tup1))

10. Which is NOT the possible output for the following Python code? 1
import random
flowers=["Rose","Jasmine","Sunflower","Lily"]
for I in range(random.randint(0,2)):
print(flowers[I],'*',end=" ")

(a)Rose*Jasmine* (b) Rose*Jasmine*Sunflower*


(c) Rose* (d) No Output

11. Name the protocol which is helpful in Video conference. 1


(a) VoIP (b) IP (c) TCP (d) FTP

12. Consider the code given below: 1


Which of the following statement should be given in the blank for #Missing Statement, if
the output produced is 240?
y = 200
def check(x) :
________ #missing statement
y = y + x *�
check(20)
print(y)
(a) global x= IO0 (b) global x (c) global y=10 (d) global y

13. State whether the following statement is True or False: 1


Programmers can also forcefully raise exceptions in a program using the raise and assert
statements.

14. Fill in the blank: 1


_______clause is used to remove duplicate values of the table.
(a) DESCRIBE (b) DISTINCT (c) UNIQUE (d) NULL

Page 2 of 9
15. Fill in the blank: 1
------ is a device that connects dissimilar networks.
(a) Router (b) Repeater (c) Modem (d) Gateway

16. To move a file pointer f, 20 bytes ahead from the current position of file, function used is - 1
(a) f.seek(20) (b) f.seek(20,0) (c) f.seek(20,1) (d) f.seek(20,2)

QI 7 and 18 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 A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True

17. Assertion (A):- To use a function from a particular module, we need to import the module. 1
Reasoning (R):- import statement can be written anywhere in the program, before using a
function from that module.

L8. Assertion (A):- Keyword arguments are related to function calls. 1


Reasoning(R ):- When you use keyword arguments in function call, the caller identifies the
arguments by the parameter name.

SECTIONB

19. (i) Expand the following terms: 2


FTP, PdP3
(ii) Give one difference between XML and HTML.

OR

(i) Give one advantage of bus topology and one advantage of star topology.
(ii) Explain packet switching.

20. The code given below accepts a number as an argument and returns sum of all digits of a 2
number. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
Def SumOIDigits(num):
s=0
while num>0
d == num % 10
s=s+d
num //=10
return s
print(SumOIDigits(1234))

21. Write a function VOWELS(STR) that takes string STR as an argument and returns the 2
number of vowels in the string.
OR
Write a function countCity(CITY) in Python, that takes the dictionary, CITY as an argument
and displays the names (in uppercase) of the cities whose names are longer than 7 characters.
Page 3 of 9
For example, Consider the following dictionary
CITY= { 1: "Sydney",2: "Tokyo",3: "Pinkcity",4: "Beijing",5: "Suncity"}
The output should be:
PINK.CITY

22. What will be the Output for the following code? 2


Language=["C", "C++", "JAVA", "Python", "VB", "BASIC", "FORTRAN"]
del Language[4]
Language.remove("JAVA")
Language.pop(3)
print(Language)

23. Write the Python statement for each of the following tasks usmg BUILT-IN 2
functions/methods only:
(i) To add elements 10, 60, 90 to the end of the list named, LISTI.
(ii) To count number of characters in a string named, STRl including spaces.

OR

A list named Lstdata stores list of numbers. Write the Python command to import the
required module and (using built-in function) to display the middle value of numeric data in
a list Lstdata.

24. Ms. Shalini has just created a table named CAR containing columns CARID, Model, Maker 2
and Price.
Write SQL commands to :
(i) Add a column FUELTYPE to the table with datatype as varchar with 20 characters.
(ii) To display the structure of the table CAR.

OR

Kamal has created a table named WORKER. The attributes of Worker are as follows:
WORKER ID -CHARACTER OF SIZE 3
NAME -CHARACTER OF SIZE 10
SALARY -NUMERIC
Write SQL commands to
(i) Kamal wants to increase the size of the NAME column from 10 to 20 characters.
Write an appropriate command to change the size.
(ii) Delete the table WORKER.

25. Write the output of the code given below: 2


p=50
def callme(q,r=3):
global p
p=r+q**2
print(p, end= '#')
a= l 0
b=20
callme(a,b)
callme(r=20,q=2)
Page 4 of 9
SECTION C

26. What output will be generated when the following Python code is executed? 3
Msgl ="AuGMenTeD"
Msg2="REality"
Msg3=""
for I in range(0,len(Msg2)+1):
ifMsgl[I]>="A" and Msgl[l]<="M":
Msg3=Msg3+Msgl [I]
elifMsgl[I]>="N" and Msgl[I]<="Z":
Msg3=Msg3+Msg2[1]
else:
Msg3=Msg3+"*"
print(Msg3)

27. Write the output ofthe queries (i) to (iii) based on the table, PATIENT given below: 3

Table: PATIENT
PNO NAME AGE DEPARTMENT CHARGES GENDER
P lOl Kavita 52 Surgery 800 F
P l 02 Ravi 35 ENT 200 M
P103 Sunil 45 Cardiology 250 M
P104 Shikha 40 ENT 300 F
P105 Rakhi 35 ENT 350 F
P106 Varun 30 Surgery 500 M

(i) SELECT DEPARTMENT, COUNT{*) FROM PATIENT


GROUP BY DEPARTMENT HAVING COUNT (*)>2 ;

(ii) SELECT SUM (CHARGES) FROM PATIENT WHERE GENDER = "F";

(iii) SELECT PNO, NAME FROM PATIENT


WHERE DEPARTMENT IN("Cardiology", "Surgery") ;

28. Write a function, DISPLAY( ) in Python to read a text file 'Diary.txt' and displays those 3
lines which are starting with an alphabet 'D'.

OR
Write a function, CountUpper( ) in Python to read a text file "Notes.txt" that counts and
displays the number ofuppercase letters present in the text file.

29. Table: GRADUATE 3


SNO NAME STIPEND
1 KARAN 400
2 RAJA 500
3 VARUN 1000
4 NISHA 800

Page 5 of 9
Based on the data given above answer the following questions:

(i) If 1 column is deleted and 3 rows are added to the table GRADUATE, what will be
the new degree and cardinality of the above table?

(ii) Decrease the STIPEND by 5% whose NAME ends with 'A'.

(iii) Insert the following record into the table


SNO - 5, NAME - SHYAM, STIPEND - 700

30. A list named, CList contains following record of customer as list elements: 3
[Customer_name, Room Type, Advance]
Each of these records are nested together to form a nested list. Write the following user
defined functions in Python to perform the specified operations on the stack named 'Hotel' :
(i) Push_Cust( CList)- It takes the nested list as an argument and pushes a list object
containing name and advance of those customers who are staying in 'Delux' Room
Type.
(ii) Pop_Cust( )-It pops the objects from the stack and displays them. Also, the function
should display "Stack Empty" when there are no elements in the stack.

For example:
If the nested list contains the following data:
CList=[["Sunil","Delux",2000],["Rahul","Standard",1000],["Jerry","Delux",1500]]

The stack should contain:


['Jerry', 1500]
['Sunil', 2000]

The output should be:


['Jerry', 1500]
['Sunil', 2000]
Stack Empty
SECTION D

31. Write queries (i) to (iv) based on the tables TRADERS and ITEMS given below: 4

Table: TRADERS
TCODE TNAME CITY
TOI ELECTRONICS SALES MUMBAI
T02 BUSY STORE CORP DELHI
T03 DISP HOUSE INC CHENNAI

Table: ITEMS
CODE INAME QTY PRICE COMPANY ITCODE
1001 Digital Pad 120 11000 XENITA TOI
1006 LED Screen 70 38000 SANTORA T02
1004 CAR GPS 60 2150 GEOKNOW TOI
1003 Digital Cam 12 X 160 8000 DIGICLICK T02
1005 PenDrive 32GB 600 1200 STOREHOME T03

Page 6 of 9
(i) Display name, price and company of all the items in ascending order of item names.

(ii) Display item name and price of all those items, whose price is in the range of 1 0000
and 40000. (both values inclusive).

(iii) Display Item name, Trader name and City from tables ITEMS and TRADERS.

(iv) Display the number of items, which are traded by each trader.
The expected output of this query should be:
TOI 2
T 03 1
T 02 2

32. Write a Program in Python that defines and calls the following user defined functions: 4
(i) addrec( ) - To accept and add data of a product to a CSV file 'product.csv'. Each
record consists of a list with field elements as pcode, description and price to store
product code, product description and price respectively.
(ii) searchrec( )-To display the records of the those products with price more than 3000.

SECTIONE

33. Bhartiya Connectivity Association located in Delhi has set up its new centre at Mangalore. 5
The Manglore office has 4buildings as shown in the diagram below:

MANGLORE OFFICE
DELHI

HEAD OFFICE

TRAINING

RESOURCE

FINANCE

Centre to centre d.IStances between vanous Ul mi,s IS as f◄o 11ows:


ADMIN to FINANCE 50m
FINANCE to TRAINING 150m
TRAINING to RESOURCE 25m
ADMIN to RESOURCE 170m
FINANCE to RESOURCE 125m
ADMIN to TRAINING 90m
Manglore to Delhi Head office 2 2 33Km

Page 7 of 9
Number ofcomputers in each building is as follows:
ADMIN Building 25
FINANCE Building 50
TRAINING Building 150
RESOURCE Building 10

(i) Suggest and draw the cable layout to economically connect various buildings within
the Mangalore Centre for connecting the digital devices.

(ii) Suggest the most suitable place (i.e. building) to house the SERVER in Manglore
office with a suitable reason.

(iii) Suggest the placement of the following devices in each building at MANGLORE
office with justification:
• Repeater
• Switch

(iv) Which fast and very effective wireless transmission medium should preferably be
used to connect the head office at DELHI with the campus in MANGLORE?

(v) Suggest the type of network (out of LAN, MAN and WAN) to connect Training
Department in Manglore to Delhi Head office with suitable reason.

34. (i) Differentiate between 'r+' and 'a+' file modes in Python. 2+3=5

(ii) Consider a file, 'Movie.dat', containing records ofthe following structure:


[Movieid, Mname and Mtype]
Write a function, copyData(), that reads contents from the file 'Movie.dat' and copies the
records with Mtype as "Comedy" to the file named 'Cmovie.dat'. The function should
return the total number ofrecords copied to the file 'Cmovie.dat'.

OR

(i) How are text files different from binary files?

(ii) A binary file "Account.dat" has the following structure:


[Acct_Number, Acct_Type, AcctHolderName, Balance]
Write a function CountBalanceAbove(BAL) that accepts BAL as parameter in Python
that would read contents ofthe binary file "Account.dat" and display the details ofthose
accounts in which Balance is more than BAL. Also display number ofsuch accounts.

35. (i) Explain cartesian product on two tables. 1+4=5

(ii) Samir wants to write a program in Python to insert the following record in the
table named BOOKS in MYSQL database, LIBRARY:
• bookid - integer
• bookname - string
• bookprice - float
Page 8 of 9
Note the following to establish connectivity between Python and MySQL:
• Usemame - root
• Password - tiger
• Host - localhost

The values of fields bookid, bookname and bookprice has to be accepted from the user.
Help Samir to write the program in Python.

OR

(i) Define Domain and Primary key.

(ii) Ramesh has created a table named BOOKS in MYSQL database, LIBRARY:
• Bookid - integer
• bookname - string
• bookprice - float

Note the following to establish connectivity between Python and MySQL:


• Usemame - root
• Password - tiger
• Host - localhost

Ramesh, now wants to display the records of books whose price is more than 2000.
Help Ramesh to write the program in Python.

****END OF THE QUESTION PAPER****

Page 9 of 9
~

You might also like