[go: up one dir, main page]

0% found this document useful (0 votes)
34 views13 pages

Computer Science (083) Class XII (2024-25) Time Allowed: 3 Hours Maximum Marks: 70 General Instructions

Uploaded by

Priyansu
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)
34 views13 pages

Computer Science (083) Class XII (2024-25) Time Allowed: 3 Hours Maximum Marks: 70 General Instructions

Uploaded by

Priyansu
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/ 13

Computer Science (083)

Class XII (2024-25)

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: [1]
The max() and min() when used with tuples, can work if elements of the tuple are
all of the same types.

2. Which of the following function 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 d) All of these


interfaces.

4. s = ' ' (single space). Then s.isalnum( ) will return . [1]


a) false b)error c) True d) Nothing [1]
5. What will be the output of following code if a = "abcde".
>>> a[1:1] == a[1:2]
>>> type(a[1:1]) == type(a[1:2])

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 [1]
file?

a) wb+ b) wb

c) w d) w+

8. fetchone() method fetches only one row in a ResultSet and returns a . [1]

a) String b) Tuple

c) Dictionary d) List

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 removing [1]
leading and trailing whitespaces.

11. State true or false: [1]


State True or False.
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 .

a) 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? [1]
A. @
B. %
C. +
D. #

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) Fibre 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. [1]
Reason (R): The try block may contain the statements which throw different type
of exceptions.
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
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 [1]
file.
Reason (R): In the case of rb+ mode, the file pointer exists at the end of the file.

a) Both A and R are true and R is b) Both A and R are true but R is
the correct explanation of A. 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 [1]
number.
Reason (R): The python all() function doesn't accept an iterable object.

a) Both A and R are true and R is b) Both A and R are true but R is
the correct explanation of A. 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 Age strode Points Grade
101 Amit 16 1 6 NULL
102 Arjun 13 3 4 NULL
103 Zaheer 14 2 1 NULL
104 Gagan 15 5 2 NULL
105 Kumar 13 6 8 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? [2]
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

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. 2
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#
OR
Write a program that reads an integer N from the keyboard computes 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]
OR
Write a function Revstring () to read a textfile "Input.txt" and prints the words starting
with 'O' in reverse order. The rest of the content is displayed normally.
Example:
If content in the text file is:
UBUNTU IS AN OPEN SOURCE OPERATING SYSTEM
Output will be:
UBUNTU IS AN NEPO SOURCE GNITAREPO SYSTEM
(words 'OPEN' and 'OPERATING' are displayed in reverse order)

28. What is raw input? [2]

Section C
29. Write a function which takes two string arguments and returns the string [3]
comparison result of the two passed strings.

OR
Write the term suitable for following descriptions:
i. A name inside the parentheses of a function header that can receive value.
ii. An argument passed to a specific parameter using the parameter name.
iii. A value passed to a function parameter.
iv. A value assigned to a parameter name in the function header.
v. A value assigned to a parameter name in the function call.
vi. A name defined outside all function definitions.
vii. A variable created inside a function body.

30. Write separate user defined functions for the following: [3]
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

OR
Write the following user defined functions:
i. pushEven(N) - This function accepts a list of integers named N as parameter. It then
pushes only even numbers into the stack named EVEN.
ii. popEven(EVEN) - This function pops each integer from the stack EVEN and
displays the popped value. When the stack is empty, the message "Stack Empty" is
displayed.
For example:
If the list N contains
[10,5,3,8,15,4]
Then the stack, EVEN should store
[10,8,4]
And the output should be
4 8 10 Stack Empty

31. What do you understand by the local and global scope of variables? How can you [3]
access a global variable inside the function, if the function has a variable with the
same name?

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
Section D
32. Write a program to implement a stack for these book details (book no., book name). [4]
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.
OR
Each node of a STACK contains the following information :
i. Pin code of a city,
ii. Name of the city.
Write a program to implement the following operations in the above stack
i. PUSH( ) To push a node into the stack.
ii. POP( ) To remove a node from the stack.

33. Consider the file p2.txt created above. Now predict the output of following code [4]
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))

34. Consider the following tables CABHUB and CUSTOMER and answer the [4]
following parts of this question :
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 ;
OR
Consider the following tables PRODUCT and CLIENT. Write SQL commands for the
following statements.
Table: PRODUCT
P_ID ProductName Manufacturer Price
TP01 Talcum Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95
Table: CLIENT
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi FW05
06 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty Woman Delhi FW12
16 Dreams Banglore TP01
i. To display the details of those Clients whose City is Delhi.
ii. To display the details of Products whose Price is in the range of 50 to 100 (Both
values included).
iii. To display the ClientName, City from table Client, and ProductName and Price from
table Product, with their corresponding matching P_ID.
iv. To increase the Price of all Products by 10.

35. Create following table using Python code. [4]


Table Name = Customer
Database - xyzcorp.
Userid - Adminxyz
Password - Axydm12

CUSTNUMB CUSTNAME ADDRESS BALANCE CREDLIM SLSRNUMB


481 Tilak
TINA lane, CP,
124 ADAMS 41800.75 50,000 3
Delhi

215
256 R VENKAT Mylapore, 100000.75 80,000 6
Chennai

808, Bala
BHUVNA Nagar,
567 BALAJI 57,000.75 50000 6
Hyderabad

149, Plot
PRATHAM 182, sec-9
622 JAIN Dwarka, 57500.75 80,000 12
Delhi

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

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

37. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), [5]
which are based on the tables.

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 display TNAME, 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 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 )
viii. SELECT DISTINCT CNO FROM TRANSACTION

You might also like