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

XII

Uploaded by

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

XII

Uploaded by

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

DELHI WORLD PUBLIC SCHOOL

(Affiliated to CBSE-2132580) Greater Noida


PRE-BOARD EXAMINATION SESSION: 2024-25
CLASS: XII
Date: 24.12.2024 Subject: COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
This question paper contains 37 questions.
All questions are compulsory. However, internal choices have been provided in
some questions. 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:
The max() and min() when used with tuples, can work if elements of the tuple are all of
the same types. [1]
2. Which of the following functions returns the total number of values? [1]
a) MIN b) MAX
c) COUNT d) SUM
3. What is the advantage of DBMS over File Processing System? [1]
a) Redundancy is controlled. b) It provides backup and recovery.
c) It provides multiple user interfaces. d) All of these
4. s = ' ' (single space). Then s.isalnum( ) will return . [1]
a) False b) Error c) True d) nothing
5. What will be the output of the following code if a = "abcde".
>>> a[1:1] == a[1:2]
>>> type(a[1:1]) == type(a[1:2]) [1]
6. Which of the following is not the possible ways of data exchange? [1]
a) Multiplex b) Simplex
c) Half-duplex d) Full-duplex
7. Which of the following is mode of both writing and reading in binary format in file? [1]
a) wb+ b) wb
c) w d) w+
8. fetchone() method fetches only one row in a Result Set and returns a . [1]
a) String b) Tuple
c) Dictionary d) List
pg. 1
9. Which operator tests the column for the absence of data (i.e., NULL value)? [1]
a) IS NULL operator b) NOT operator
c) IS EMPTY operator d) EXISTS operator
10. Write a single loop to display all the contents of a text file poem.txt after [1]
removing leading and trailing whitespaces.
11. State true or false: [1]
Comments are not executed by interpreter.
12. When a stack, implemented as an array/list of fixed size, is full and no new element [1]
can be accommodated, it is called an .
OVERFLOW b) NOFLOW
c) EXTRAFLOW d) UNDERFLOW
13. Name any two DDL commands. [1]
14. A is a network spread across states, countries or whole world. [1]
a) PAN b) LAN
c) WAN d) MAN
15. Which two operators can be used on numeric values in Python?
A. @
B. %
C. +
D. #
[1]
a) B, D b) B, C c) A, C d) A, D
16. Aggregate functions are also known as [1]
a) group functions b) Add function
c) group method d) sum function
17. Which of the following is the fastest media of data transfer? [1]
a) Fiber Optic b) Telephone Lines
c) Untwisted Wire d) Co-axial Cable
18. Protocol that enables transfer of voice over internet to make phone calls? [1]
a) POP3 b) VOIP
c) PPP d) FTP
19. Assertion (A): We can declare multiple exceptions in except statement.
Reason (R): The try block may contain the statements which throw different type of
exceptions. [1]
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.
20. Assertion (A): In the case of rb mode, the file pointer exists at the beginning of the file.
Reason (R): In the case of rb+ mode, the file pointer exists at the end of the file. [1]
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.

21. Assertion (A): The python abs() function is used to return the absolute value of a
pg. 2
number.
Reason (R): The python all() function doesn't accept an iterable object. [1]
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.
Section B
22. How is Coaxial cable different from Optical Fibre? [2]
23. Consider the table Student whose fields are [2]
SCODE Name strode Points Grade
101 Amit NULL
102 Arjun NULL
103 Zaheer NULL
104 Gagan NULL
105 Kumar NULL
Write the Python code to update grade to A for all these students who are getting more than
8 as points.
24. What are data types? What are Python's built-in core data types? [2]
OR
Find the errors in the following code and write the correct code. s =
[11, 13, 15]
for n in len(s) :
tot = tot + s[n]
print(tot)
i. Underline the corrections.
ii. Write the reason! error next to it in the comment form.
25. Which record will get inserted in the table by the following code?
import mysql. connector as sqltor
mycon = sqltor .connect(host = "localhost”, user = "learner”, passwd = "fast”,
database=”test")
cursor = mycon.cursor()
query = "INSERT INTO books (title, isbn) VALUES(%s, %s)".%
(fUshakaalJ, '12678987036')
cursor.execute(query)
mycon.commitO [2]

26. Write a method in python to display the elements of list thrice if it is a number and
display the element terminated with if it is not a number.
pg. 3
For example, if the content of list is as follows:
List =['41', 'DROND', 'GIRIRAJ', ’13', 'ZARA']
The output should be 414141
DROND# GIRIRAD# 131313 ZARA# [2]
OR
Write a program that reads an integer N from the keyboard computers and displays
the sum of the numbers from N to (2 * N) if N is nonnegative. If N is a negative
number, then it's the sum of the numbers from (2 * N) to N. The starting and ending
points are included in the sum.
27. Write a function in Python to count the number of lowercase and uppercase
characters in a text file "Book.txt". [2]
28. What is raw input? [2]
Section C
29. Write a function which takes two string arguments and returns the string comparison
result of the two passed strings. [3]
30. Write separate user defined functions for the following:
i. PUSH(N) - This function accepts a list of names, N as parameter. It then pushes only
those names in the stack named OnlyA which contain the letter 'A'.
ii. POPA(OnlyA) - This function pops each name from the stack OnlyA and
displays it. When the stack is empty, the message "EMPTY" is displayed. For
example:
If the names in the list N are
['ANKITA', 'NITISH', 'ANWAR', 'DIMPLE', 'HARKIRAT']
Then the stack OnlyA should store
['ANKITA', 'ANWAR', 'HARKIRAT']
And the output should be displayed as
HARKIRAT ANWAR ANKITA EMPTY
31. What do you understand by the local and global scope of variables? How can you access
a global variable inside the function, if the function has a variable with the same name?
[3]
OR
Write the definition of a function Sum3(L) in Python, which accepts a list L of integers
and displays the sum of all such integers from the list L which end with the digit 3.
For example, if the list L is passed [123, 10, 13, 15, 23]
then the function should display the sum of 123, 13, 23, i.e. 159 as follows:
Sum of integers ending with digit 3 = 159

pg. 4
Section D
32. Write a program to implement a stack for these book details (book no., book name).
That is, now each item node of the stack contains two types of information - a book
no. and its name. Just implement Push and display operations. [4]
33. Consider the file p2.txt created above. Now predict the output of following code that
works with p2.txt. Explain the reason behind this output.
fp1 = open("p2.txt", "r") print(fp1.readline(20)) s1 = fp1.readline(30) print(s1)
print(fpl.readline(25)) [4]
34. Consider the following tables CABHUB and CUSTOMER and answer the
following parts of this question: [4]
Table: CABHUB
Vcode VehicleName Make Color Capacity Charges
100 Innova Toyota WHITE 7 15
102 SX4 Suzuki BLUE 4 14
104 C Class Mercedes RED 4 35
105 A-Star Suzuki WHITE 3 14
108 Indigo Tata SILVER 3 12

Table: CUSTOMER
CCode CName Vcode
1 Hemant Sahu 101
2 Raj Lai 108
3 Feroza Shah 105
4 Ketan Dhal 104
Give the output of the following SQL queries :
i. SELECT COUNT (DISTINCT Make) FROM CABHUB ;
ii. SELECT MAX(Charges), MIN(Charges) FROM CABHUB ;
iii. SELECT COUNT(*), Make FROM CABHUB ;
iv. SELECT VehicleName FROM CABHUB WHERE Capacity = 4;

pg. 5
35. Create following table using Python code.
Table Name = Customer
Database - xyzcorp.
Userid - Adminxyz
Password - Axydm12
[4]
CUSTNUMB CUST ADDRESS BALANCE CREDLIM SLSR
NAME NUMB
TINA 481Tilak
124 ADAMS lane, CP, 41800.75 50,000 3
Delhi
215
256 R VENKAT Mylapore, 100000.75 80,000 6
Chennai
BHUVNA 808, Bala Nagar,
567 BALAJI Hyderabad 57,000.75 50000 6
149, Plot
PRATHAM 182, sec-9
622 JAIN Dwarka, Delhi 57500.75 80,000 12

pg. 6
Section E
36. Learn Together is an educational NGO. It is setting up its new campus at Jabalpur
for its web-based activities. The campus has 4 compounds as shown in the diagram
below: [5]

Center to center distances between various Compounds as per architectural drawings


(in Metre) is as follows:
Main Compound to Resource Compound 110 m
Main Compound to Training Compound 115 m
Main Compound to Finance Compound 35 m
Resource Compound to Training Compound 25 m
Resource Compound to Finance Compound 135 m
Training Compound to Finance Compound 100 m
The Expected Number of Computers in each Compound is as follows:

Main Compound 5
Resource Compound 15
Training Compound 150
Accounts Compound 20
i. Suggest the most suitable place (i.e., compound) to house the server for
this
NGO. Also, provide a suitable reason for your suggestion.
ii. Suggest the placement of the following devices with justification:
a. Repeater
b. Hub/Switch
iii. The NGO is planning to connect its international office situated in Mumbai,
which out of the following wired communication link, you will suggest for
very high-speed connectivity?
a. Telephone Analog Line
b. Optical Fiber
c. Ethernet Cable
pg. 7
37. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to
(viii),which
are based on the tables. [5]
TRAINER
TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998-10-15 90000
102 ANAMIKA DELHI 1994-12-24 80000
103 DEEPTI CHANDIGARH 2001-12-21 82000
104 MEENAKSHI DELHI 2002-12-25 78000
105 RICHA MUMBAI 1996-01-12 95000
106 MANIPRABHA CHENNAI 2001-12-12 69000

COURSE
CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 0 LEVEL 18000 2018-07-25 105

i. Display the Trainer Name, City & Salary in descending order of their Hiredate.
ii. To display the TNAME and CITY of Trainer who joined the Institute
in the month of December 2001.
iii. To displayTNAME, HIREDATE, CNAME, STARTDATE from tables
TRAINER and COURSE of all those courses whose FEES is less than or
equal to 10000. (iv) To display number of Trainers from each Ans. city.
iv. SELECT TID. TNAME, FROM TRAINER WHERE CITY NOT IN
('DELHT', 'MUMBAI');
v. SELECT DISTINCT TID EROM COURSE;
vi. SELECT TID, COUNT(*), MIN (FEES) FROM COURSE. CROUP
BY TID HAVING COUNT(*)>1;
vii. SELECT COUNTS), SUM(FEES) FROM COURSE WHERE
pg. 8
STARTDATE< '2018-09- 15';
OR
Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii),
Which are based on the table.
Table: CUSTOMER
CNO CNAME ADDRESS
101 Richa Jain Delhi
102 Surbhi Sinha Chennai
103 Lisa Thomas Bangalore
104 Imran Ali Delhi
105 Roshan Singh Chennai
Table: TRANSACTION
TRNO CNO AMOUNT TYPE DOT
T001 101 1500 Credit 2017-11-23
T002 103 2000 Debit 2017-05-12
T003 102 3000 Credit 2017-06-10
T004 103 12000 Credit 2017-09-12
T005 101 1000 Debit 2017-09-05

i. To display details of all transactions of TYPE Credit from Table


TRANSACTION.
ii. To display the CNO and AMOUNT of all Transactions done in the
month of September 2017 from table TRANSACTION.
iii. To display the last dale of transaction (DOT) front the table TRANSACTION
for the customer having CNO as 103.
iv. To display all CNO CNAME and DOT (date of transaction) of those
CUSTOMERS fron, tables CUSTOMER and TRANSACTION who have
done transactions more than or equal to 2000.
v. SELECT COUNT(*), AVG (AMOUNT) FROM TRANSACTION WHERE
DOT >
= '2017-06-01'
vi. SELECT CNO, COUNT(*), MAX (AMOUNT) FROM TRANSACTION
GROUP BY CNO HAVING COUNT (*)> 1
vii. SELECT CNO, CNAME FROM CUSTOMER WHERE ADDRESS
NOT IN ('DELHI', BANGALORE )

pg. 9
viii. SELECT DISTINCT CNO FROM TRANSACTION

pg. 10

You might also like