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

GR12-CS

Uploaded by

kr200725
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)
76 views

GR12-CS

Uploaded by

kr200725
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

Class: XII Sub:-COMPUTER SCIENCE

Time: 3 Hours 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 3 questions (31 to 33). Each question carries 5 Marks.
Section E, consists of 2 questions (34 to 35). Each question carries 4 Marks.
All programming questions are to be answered using Python Language only.
SECTION A

1 State True or False


A variable that is declared in top-level statements is called a global variable
2 Consider the following statement:
SELECT * FROM product ORDER BY rate ________, item_name ______;
Which of the following option should be used to display the ‘rate’ from greater to smaller and
‘name’ in alphabetical order?
(a) ASC, DESC (b) DESC, ASC
(c) Descending, Ascending (d) Ascending, Descending
3 What will be the output of the following statement
print(len(str(16/4))
(a) 5 (b) 4 (c) 3 (d) 1
4 What will be the output of the following code segment?
myList=[1,2,3,4,5,6,7,8,9,10]
for I in range(0,len(myList)):
if i%2 == 0:
print(myList[i],end=”#”)
(a) 0#2#4#6#8#10# (b) 1#3#5#7#9#
(c) 1#3#5#7#9 (d) 0#2#4#6#8#10

5 If column “Marks” contains the data set {25, 35, 25, 35, 38}, what will be the output after
the execution of the given query? SELECT DISTINCT MARKS FROM STUDENTS;
(a) 25, 35, 25, 35, 38 (b) 25, 25, 35, 35 (c) 25, 35, 38 (d) 25, 25, 35, 35

6 What is the full form of NIC?


(a) Network Interchange Card (b) Net Interconnect Card
(c) Network Interface Card (d) Network Interconnection Card

7 Which SQL statement do we use to find out the total number of records present in the
table EMP?
(a) SELECT * FROM EMP; (b) SELECT COUNT (*) FROM EMP;
(c) SELECT FIND (*) FROM EMP; (d) SELECT SUM () FROM EMP;
8 What is the result of the following expression?
s=’0123456789’
print(s[3],”,”,s[0:3],”-“,s[2:5])
(a) 3 , 012 - 234 (b) 3 , 0123 - 2345
(c) 4 , 0123 - 2345 (d) 4 , 012 - 234

9 Which of the following statements will generate an error?


st = "PYTHON"
t = st*5 Statement(1)
u = st[0] + "M" Statement(2)
st[0] = "K" Statement(3)
st = st + st Statement(4)

(a) Statement(1) (b) Statement(2) (c) Statement(3) (d) Statement(4)

10 What will be the output of following code?


import random
arr=[2, 3, 4, 5, 6, 7]
min=random.randint(1, 3)
max=random.randint(2, 4)
for i in range(min, max+1):
print(arr[i], end=“*”)

(a) 1*4*7* (b) 3*4*5* (c) 5*6*7* (d) 4*5*7*

11 Which of the following transmission media has the highest bandwidth?


(a) Co-axial cable (b) Fiber optic cable (c) Twisted pair cable (d) None of these

12 Which of the following function is used with the csv modules in Python to read the content
of a csv file into an object?
(a) readrow() (b) readrows() (c) reader (d) load()

13 Which amongst the following is an example of a browser?


(a) msword (b) openoffice (c) Avast (d) Edge

14 Which SQL function is used to display length of string values from attributes?
(a) Len() (b) Length() (c) Sum() (d) None of the above

15 When will the else part of try-except-else be executed?


(a) Always (b) When an exception occurs
(c) When no exception occurs (d) When an exception occurs in to except block

16 ________ is the act of copying another person’s ideas, words or work and pretending they
are your own.
(a) Online copying (b) Plagiarism (c) Patent (d) Digital phishing
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as

i. Both A and R are true and R is the correct explanation for A


ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True

17 ASSERTION: A continue statement in a loop is mandatory.


REASON: A continue statement will skip the remaining statements in the loop after it is
encountered.

18 ASSERTION: Keyword arguments are related to the function calls.


REASON: When you use keyword arguments in a function call, the caller identifies the arguments by
the parameter name.
SECTION B

19 Re-write the following program after removing errors, if any, and underline all the
corrections made.
a = input("Enter a number:")
b = int(input("Enter a number:"))
if a = b:
a+b=a
else
b=b+a
print(a,b)
OR
Differentiate between router and gateway

20 Mahesh, a database administrator needs to display house wise total number of records of
‘Green’ and ‘Orange’ house. She is encountering an error while executing the following query:

SELECT HOUSE, COUNT (*) FROM STUDENT GROUP BY HOUSE WHERE HOUSE=’Green’ OR HOUSE=
‘Orange’;

Help her in identifying the reason of the error and write the correct query by suggesting the possible
correction (s).

21 Define Stack. Give any two applications of Stacks

22 Write a Python function that takes two lists and returns True if they have at least one
common member

23 Write the Python statement for each of the following tasks using BUILT-IN
functions/methods only:
(i) To insert an element 100 at the Second position, in the list L1.
(ii) To check whether all the characters in the string S1 are digits or not.
OR
How the pop( ) function is different from remove( ) function working withlist in python ? Explain with
example.
24 Mr.Shyam has created a FLIGHT table with FNO, START, REMARKS, FDATE and FARE with
appropriate data type. Now he wants to delete the attribute REMARKS and to add a new column
END with string data type and it should not contain NULL value. Please help Mr.Shyam to complete
this task.

OR

Categorize the following commands as DDL and DML: INSERT, ALTER, DROP, DELETE, UPDATE,
CREATE

25 Predict the output of the following code

T = (9,18,27,36,45,54)
T1 = tuple()
for i in T:
if i%6==0:
T1=T1+(i,)
print(T1)
SECTION – C

26 Write the output of the following code:-

Text = "gmail@com"
L=len(Text)
Ntext=""
for i in range(0,L):
if Text[i].isupper():
Ntext=Ntext+Text[i].lower()
elif Text[i].isalpha():
Ntext= Ntext+Text[i].upper()
else:
Ntext=Ntext+'bb'
print(Ntext)

27 Consider the following table ‘Transporter’ that stores the order details about items to be

transported. Write SQL commands for the following

Table: Transporter

ORDERNO DRIVERNAME DRIVERGRADE ITEM TRAVELDATE DESTINATION


10012 RAMYADAV A TELEVISION 19-04-2019 MUMBAI
10014 SOMNATHSINGH FURNITURE 12-01-2019 PUNE
10016 MOHANVERMA B WASHINGMACH 06-06-2019 LUCKNOW
10018 RISHISINGH A REFRIGERATOR 07-04-2019 MUMBAI
10019 RADHEMOHAN TELEVISION 30-05-2019 UDAIPUR
10020 BISHENPRATAP B REFRIGERATOR 02-05-2019 MUMBAI
10021 RAM TELEVISION 03-05-2019 PUNE
(i) To display names of drivers and destination city where TELEVISION is being transported.
(ii) To display driver names and destinations where destination is not MUMBAI.
(iii) To display the names of destination cities where items are being transported. There should be no
duplicate values.

28 Write a function COUNT_AND( ) in Python to read the text file “STORY.TXT” and count the
number of times “AND” occurs in the file. (include AND/and/And in the counting)
OR
What is the difference between the following set of statements (a) and (b):
a) P = open(“practice.txt”,”r”)
P.read(10)
b) with open(“practice.txt”, “r”) as P:
x = P.read()
SECTION C

29 Write SQL statements to do the following:


COMPANY
CID NAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY CHENNAI MOBILE
666 DELL DELHI LAPTOP

CUSTOMER
CUSTID NAME PRICE QTY CID
101 ROHAN SHARMA 70000 20 222
102 DEEPAK KUMAR 50000 10 666
103 MOHAN KUMAR 30000 5 111
104 SAHIL BANSAL 35000 3 333
105 NEHA SONI 25000 7 444
106 SONAL AGGARWAL 20000 5 333
107 ARUN SINGH 50000 15 666

i. Define CID in CUSTOMER table as Foreign Key that refers to CID i.e. Primary Key of COMPANY
table.
ii. Display the ‘CUSTOMER NAME’, ‘PRODUCT NAME’ who have purchased any product from the
‘COMPANY NAME’ ‘SONY’.
iii. Increase the QTY by 15 for the products with PRICE below 40,000.

30 A list, NList contains following record as list elements: [City, Country, distance from Delhi]
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 travel.
(i) Push_element(NList): It takes the nested list as an argument and pushes a list object
containing name of the city and country, which are not in India and distance is less than
3500 km from Delhi.
(ii) Pop_element(): 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:
NList=[["New York", "U.S.A.", 11734],
["Naypyidaw", "Myanmar", 3219],
["Dubai", "UAE", 2194],
["London", "England", 6693],
["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]]
The stack should contain:
['Naypyidaw', 'Myanmar'],
['Dubai', 'UAE'],
['Columbo', 'Sri Lanka']
The output should be:
['Columbo', 'Sri Lanka']
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty
OR
State any two differences between single row functions and multiple row functions with examples.

SECTION D
31 A relation Vehicles is given below :
V_no Type Company Price Qty
AW125 Wagon Maruti 250000 25
J0083 Jeep Mahindra 4000000 15
S9090 SUV Mitsubishi 2500000 18
M0892 Mini van Datsun 1500000 26
W9760 SUV Maruti 2500000 18
R2409 Mini van Mahindra 350000 15

Write SQL commands to:


a. Display the average price of each type of vehicle having quantity more than 20.
b. Count the type of vehicles manufactured by each company.
c. Display the total price of all the types of vehicles.
d. Display the details in ascending order of Qty

32 Given the following CSV file named "inventory.csv": What will be the output of the following
Python program? If there is any error, identify and correct it.

total_cost = 0
with open('inventory.csv', 'r') as file:
reader = csv.reader(file)
next(reader) # Skip header row
for row in reader:
quantity = int(row[1])
price = float(row[2])
total_cost += quantity * price
print('Total inventory cost:', total_cost)

OR

Write a Python program that opens a CSV file named "students.csv" in write mode using the
csv.writer() object. The program should prompt the user to enter student names and their
respective grades, and then write this data into the CSV file. Ensure appropriate error handling for
incorrect input.
SECTION E
33 Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to
set up its new offices in India with its hub at Hyderabad. As a network advisor, you have to
understand their requirements and suggest to them the best available solutions. Their queries are
mentioned as (i) to (iv) below.

Block to Block distances (in mtrs.)

Block (From) Block (To) Distance


Human Resource Conference 110
Human Resource Finance 40
Conference Finance 80
Expected Number of Computers to be installed in each block

Block Computers
Human Resource 25
Finance 120
Conference 90

(i) What will be the most appropriate block, where TTC should plan to install their server?
(ii) Draw a block diagram showing a cable layout to connect all the buildings in the most
appropriate manner for efficient communication
(iii) What will be the best possible connectivity out of the following, you will suggest
connecting the new setup of offices in Begaluru with its London based office.
• Satellite Link
• Infrared
• Ethernet Cable

34 (i) Differentiate between rb+ and wb+ file modes in Python.

(ii) Consider a binary file “employee.dat” containing details such as(empno, ename, salary).

Write a python function to display details of those employees who are earning between 20000 and
30000 (both values inclusive).

OR

(i) Differentiate between dump and load functions in binary files?

(ii) Write a Python function in Python to search the details of the employees [name, designation,
salary] whose salary is greater than 5000.
The records are stored in the file “emp.dat”. consider each record in the file emp.dat as a list
containing name, designation and salary.

35 (i) How many candidate key and primary key a table can have in a Database?

(ii) Manish wants to write a program in Python to create the following table named “EMP” in MYSQL
database, ORGANISATION:

Eno (Employee No )- integer


Ename (Employee Name) - string
Edept (Employee Department)-string
Sal (salary)-integer
Note the following to establish connectivity between Python and MySQL:

Username – root , Password – admin , Host - localhost

The values of fields eno, ename, edept and Sal has to be accepted from the user. Help Manish to
write the program in Python to insert record in the above table.

OR

(i) Differentiate between degree & cardinality key in RDBMS?


(ii) Vihaan wants to write a program in Python to create the following table named “EMP” in MYSQL
database, ORGANISATION:
Eno (Employee No )- integer
Ename (Employee Name) - string
Edept (Employee Department)-string
Sal (salary)-integer

Note the following to establish connectivity between Python and MySQL:


Username – root , Password – admin , Host - localhost
Help Vihaan to write the program in Python to Alter the above table with new column named Bonus
(int).

You might also like