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

ComputerScience-SQP

Uploaded by

rs0504434
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

ComputerScience-SQP

Uploaded by

rs0504434
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Rameshwaram International Academy

PRE-BOARD - III
Class: XII Session: 2024-25
Computer Science (083)
Maximum Marks: 70 Time Allowed: 3 hours
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in somequestions. Attempt only
one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

SECTION A
1. State True or False 1
“Python identifiers are dynamically typed.”
2. Which of the following is an invalid operator in Python? 1
(a)- (b) //= (c)in (d) =%
3. Given the following dictionary 1
employee={'salary':10000,'age':22,'name':'Mahesh'}
employee.pop('age')
print(employee)
What is output?
a. {‘age’:22} b. {'salary': 10000, 'name': 'Mahesh'}
c. {'salary':10000,'age':22,'name':'Mahesh'} d. None of the above
4. Consider the given expression: 1
True and False or Not True
Which of the following will be correct output if the given expression is evaluated?
(a) True (b) False (c) NONE (d) NULL
5. What will the following code print? 1
print(max("zoo 145 com"))
a. 145 b. 122 c. z d. zoo
6. Which of the following statements is incorrect regarding the file access modes? 1
(a) ‘r+’ opens a file for both reading and writing. File object points to its beginning.
(b) ‘w+’ opens a file for both writing and reading. Overwrites the existing file if it exists and creates a
new one if it does not exist.
(c) ‘wb’ opens a file for reading and writing in binary format. Overwrites the file if itexists and creates a
new one if it does not exist.
(d) ‘a’ opens a file for appending. The file pointer is at the end of the file if the fileexists.
7. All aggregate functions except ignore null values in their inputcollection. 1
a) Count (attribute) (b) Count (*) (c) Avg () (d) Sum ()
8. Which of the following SQL commands will change the attribute value of anexisting tuple in a table? 1
(a) Insert (b) Update (c) alter (d) change
9. Fill in the blank: 1
An attribute or set of attributes in a table that can become a primary key is termed as ………….

Page 1 of 8
(a) Alternate key (b) Candidate key (c) Foreign key (d) Unique key
10. Fill in the blank: 1
The SELECT statement when combined with clause, is used for pattern matching
(a) Order by (b) Distinct (c) like (d) between
11. Observe the following code snippet 1
file = open(“station.txt”,”r”)
try:
……..
except EOFError: # When will this line execute
……..
When will the line underlined execute?
(a) When the file is closed.
(b) This is a text file.
(c) When the file pointer is at the beginning of the file.
(d) When the file pointer has reached the end of file.
12. Consider the following code that inputs a string and removes all special characters from it after
converting it to lowercase.
s = input("Enter a string")
s = s.lower()
for c in ',.;:-?!()\'"':
________________
print(s)
For eg: if the input is 'I AM , WHAT I AM", it should print i am what i am
Choose the correct option to complete the code.
(a) s = s.replace(c, '') (b) s = s.replace(c, '\0') (c) s = s.replace(c, None) (d) s = s.remove(c)
13. is a standard network protocol used to transfer files from one host to another host over a TCP- 1
based network, such as the Internet.
(a) TCP (b) IP (c) FTP (d) SMTP
14. What will the following expression be evaluated to in Python? 1
2**3**2+15//3
(a) 69 (b) 517 (c) 175 (d) 65
15. Identify the invalid SQL aggregate function from the following 1
(a) sum (b) max (c)min (d) add
16. Identify the invalid method to get the data from the result set of query fetched by acursor object 1
mycursor.
(a) mycursor.fetchone() (b) mycursor.fetchall() (c) mycursor.fetchmany() (d) mycursor.fetchnow()
17. Pushing an element into stack already having five elements and stack size of 5, then stack becomes
___________
(a) Overflow (b) Crash (c) Underflow (d) User flow
18. How can you execute multiple statements under a single if block in Python?
(a) Separate statements with a semicolon (b) Indent the statements to the same level
(c) Use the and keyword between statements (d) Use the elif keyword
19. Identify the correct syntax of List to add element in given position/index function:
(a) insert(index,element) (b) insert(element,index)
(b) insert(index,element, after index) (d) append(element,index)

Page 2 of 8
Q20 and 21 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
20. Assertion (A):-global keyword is used inside a function to enable the function alter the value of a global 1
variable.
Reasoning (R):- A global variable can not be accessed by a function without the use of global keyword.
21. Assertion (A): The ‘with’ block clause is used to associate a file object to a file. 1
Reason (R): It is used so that at the end of the ‘with’ block the file resource is automatically closed.
SECTION B
22. Shraddha wrote the code that, prints the sum of numbers between 1 and the number, for each number 2
till 10. She could not get proper output.
i=1
while (i <= 10): # For every number i from 1 to 10
sum = 0 # Set sum to 0
for x in range(1,i+1):
sum += x # Add every number from 1 to i
print(i, sum) # print the result
a) What is the error you have identified in this code?
b) Rewrite the code by underlining the correction/s.
23. Write two points of difference between star and bus topology. 2
OR
Differentiate Web browser and Webserver.
24. a) Write the output of the code snippet. 2
txt = "Time, will it come back?"
x = txt.find(",")
y = txt.find("?")
print(txt[x+2:y])
b) The score of a student in a test is stored as a Python tuple. The test had 3 questions, with some
questions having subparts whose scores are recorded separately. Give the output of the code snippet.
score = (6, (5, (2, 1), 8), (4, 3, (1, 3, 2)))
print (score [2][2])
25. Which is the correct outcome executed from the following code? Write minimum value of n1 and 2
maximum value of n2.
import random
n1= random.randrange(1, 10, 2)
n2= random.randrange(1, 10, 3)
print (n1,"and",n2)
(a) 2 and 7 (b) 3 and 4 (c) 8 and 10 (d) 8 and 9
26. (a) Write the full forms of the following: 2
(i) SMTP (ii) URL
(b) Differentiate http and https protocols.
27. Predict the output of the Python code given below: 2
value = 50
def display(N):
global value
value = 25
if N%7==0:

Page 3 of 8
value = value + N
else:
value = value – N
print(value, end="#")
display(20)
print(value)
OR
Predict the output of the Python code given below:
l=[]
for i in range(4):
l.append(2*i+1)
print(l[::-1])
28. Differentiate between drop and delete commands in SQL with appropriate example. 2
OR
What is the use of order by clause in SQL ? Give example.
SECTION C
29. Write a function sumcube(L) to test if an element from list L is equal to the sum of the cubes of 3
its digits i.e. it is an ”Armstrong number”. Print such numbers in the list.
If L contains [67,153,311,96,370,405,371,955,407]
The function should print 153,370,371,407
OR
(ii) (a) Predict the output of the Python code:
nested_list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
removed_element = nested_list[2].pop()
print(removed_element)
(b) a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = []
for val in a:
if val not in b:
c.append(val)
print(c)
30. print ("Handling exception using try...except...else...finally") 3
try:
numerator=50
denom=int(input("Enter the denominator: "))
quotient=(numerator/denom)
print ("Division performed successfully")
except ___________________: #Statement1
print ("Denominator as ZERO is not allowed")
except ______________: #Statement2
print ("Only INTEGERS should be entered")
else:
print ("The result of division operation is ", quotient)
________: #Statement3
print ("OVER AND OUT")
Fill in the blank exception name.
31. Write a Python function which reads a text file “poem.txt” and prints the number of vowels in each line 3

Page 4 of 8
of that file, separately.
Eg: if the content of the file “poem.txt” is
The plates will still shift
and the clouds will still spew.
The sun will slowly rise
and the moon will follow too.
The output should be
6
7
6
9
OR
Write a Python program that writes the reverse of each line in “input.txt” to another
text file “output.txt”. Eg: if the content of input.txt is:
The plates will still shift
and the clouds will still spew.
The sun will slowly rise
and the moon will follow too.
The content of “output.txt” should be:
tfihs llits lliw setalp ehT
.weps llits lliw sduolc eht dna
esir ylwols lliw nus ehT
.oot wollof lliw noom eht dna
SECTION C
32 (a) Write the functions to perform the required operations on csv files and call the functions appropriately. 4
(i) Newgadget() to add the details of new gadgets in csv file gadget.csv which stores records in the
format.Deviceno, name, price, brand. Get the input from the user.
(ii) Countgadget() to read the csv file ‘gadget.csv’ and count the devices whose brand is “Samsung”
OR
(b) Write the functions to perform the required operations on csv files and call thefunctions
appropriately.
(i) Namelist() to add the participants for Music competition in a csv file “music.csv” where each record
has the format Name, class, age
(ii) Display() to read the csv file ‘music.csv’ and display the participants under 15 years of age
33. In a database School, there are two tables given below: 4
STUDENTS
RNO NAME CLASS SEC ADDRESS ADMNO PHONE
1 MEERA 12 D A-26 1211 3245678
2 MEENA 12 A NULL 1213 NULL
3 KARISH 10 B AB-234 1214 4567890
4 SURAJ 11 C ZW12 1215 4345677
SPORTS
ADMNO GAME COACHNAME GRADE
1215 CRICKET RAVI A
1213 VOLLEYBALL AMANDEEP B
1211 VOLLEYBALL GOWARDHAN A
1214 BASKET TEJASWINI BBALL
Based on the given information answer the questions which follows,
(i) Identify the attribute used as foreign key in table sports

Page 5 of 8
(ii) What is the degree of the table students?
(iii) Write SQL statements to perform the following operations
a) To display the name and game played by sports students
b) To change the address and phonenumber of “Meena ” to B 54, 8864113
(iv) a) Select NAME,GAME from STUDENTS S,SPORTS T where S.ADMNNO=T.ADMNNO;
OR
(a) Write the outputs of the SQL queries (i) to (iii) based on the tables VEHICLES andTRAVELS
Table: VEHICLE
VCODE VEHICLETYPE PERKM
V01 VOLVO BUS 150
V02 AC DELUXEBUS 125
V03 ORDINARY BUS 80
V04 CAR 18
V05 SUV 30
Table: TRAVEL
CNO CNAME TRAVELDATE KM VCODE NOP
101 Arun 2015-12-13 200 V01 32
102 Balaji 2016-06-21 120 V03 45
103 Vignesh 2016-04-23 450 V02 42
104 Selva 2016-01-13 80 V02 40
105 Anupam 2015-02-10 65 V04 2
106 Tarun 2016-04-06 90 V05 4
● PERKM is Freight Charges per kilometer.
● Km is kilometers Travelled
● NOP is number of passengers travelling in vehicle.
(i) SELECT VCODE, COUNT(*) AS NUMTRIPSFROM TRAVELGROUP BY VCODE;
(ii) SELECT CNAME, TRAVEL.VCODE, VEHICLETYPEFROM VEHICLE, TRAVEL WHERE
VEHICLE.VCODE = TRAVEL.VCODE AND NOP >= 30;
(iii) SELECT MAX(TRAVELDATE), MIN(TRAVELDATE) FROM TRAVEL ;
(iv) SELECT VEHICLETYPE FROM VEHICLE WHERE VEHICLETYPE LIKE “%BUS”;
(b) Write the command to view the structure of the table TRAVEL.
34. Vikram has a list containing 10 integers. You need to help him to create a program with separate user 4
defined functions to perform the following operations based on this list.
● pushnum() to Traverse the content of the list and push the numbers that are divisible by 5 into a stack.
● popnum() to Pop and display the content of the stack and display “Stack underflow” if the stack is
empty.
For Example:
If the sample Content of the list is as follows:
N=[10, 13, 34, 55, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
35
55
10
OR
Write a function in Python, Push(Ride) where , Ride is a dictionary containing the details of Cab ride ,
Ride={driver: billamt }.
The function should push the names of those driver names in the stack, INCENTIVE who have billed
greater than 400. Also display the count of names pushed into the stack

Page 6 of 8
For example:
If the dictionary contains the following data: Ride={‘Raghu’:389,’Anbu’:560,’Siraj’:768,’Syed’:450 }.
The stack INCENTIVE should contain [‘Anbu’,’Siraj’,’Syed’]
The output should be:
The count of Drivers in the stack is 3
35. The code given below inserts the following record in the table Player: 4
PNo – integer
Name – string
NoofGames– int
Goals – integer
Note the following to establish connectivity between Python and MYSQL:
a. Username is root
b. Password is sport
c. The table exists in a MYSQL database named Football.
d. The details (Pno,Name,NoofGames,Goals) are to be accepted from the user.
Write the python code to create function Insert() for add new record and showAll() function display all
record.
SECTION E
36. Aditi is a Python programmer. He has written a code and created a binary file employee.dat with 5
employeeid, ename and salary. The file contains 10 records.
He now has to update a record based on the employee id entered by the user and update the salary. The
updated record is then to be written in the file temp.dat. The records which are not to be updated also
have to be written to the file temp.dat. If the employee id is not found, an appropriate message should to
be displayed.
31 University of Correspondence in Allahabad is setting up the network between its different wings 5
(units). There are four wings named as Science(S), Journalism(J), Arts(A) and HomeScience(H).

Distance between various wings Number of Computers in each wing


Wing A to Wing S 100 m
Wing A to Wing J 200 m Wing A 150
Wing A to Wing H 400 m Wing J 5
Wing S to Wing J 300 m Wing S 10
Wing S to Wing H 100 m Wing H 50
Wing J to Wing H 450 m
(a) Suggest the suitable topology and draw the cable layout to efficiently connectvarious blocks / wings
of network.
(b)Where should the server be housed ? justify your answer.
(c) What kind of network (LAN/MAN/WAN) will be formed?
(d)Suggest the fast and very effective wired communication medium to connectanother sub office at
Kanpur, 670 km far apart from above network.
(e) Suggest the placement of the following devices in the network.
i. Hub/ Switch
ii. Repeater

Page 7 of 8
Page 8 of 8

You might also like