Xii PB2 QP CS Set2
Xii PB2 QP CS Set2
Xii PB2 QP CS Set2
SECTION A
5 If you want to add a new column in an existing table, which command is used. 1
For example, to add a column bonus in a table emp, the statement will be given
as:
A. ALTER table bonus ADD (emp Integer);
B. CHANGE table emp ADD bonus int;
C. ALTER table emp ADD bonus int;
D. UPDATE table emp ADD bonus int;
Page 1 of 11
6 What is the size of IPv4 address? 1
A. 32 bits
B. 64 bits
C. 64 bytes
D. 32 bytes
10 import random 1
AR=[20,30,40,50,60,70]
START=random.randint(1,3)
END=random.randint(2,4)
for P in range(START, END+1):
print (AR[P],end=”#“)
Based on the above code what will Be the maximum value of the variables
START and END ?
A. 3,4
B. 4,3
C. 2,4
D. 4,2
11 ____is the device which is used to convert digital signal into analog signal and 1
vice-versa.
A. Modulator
B. B) Modem
C. Mixture
D. Multiplexer
Page 2 of 11
B. break
C. stop
D. infinite
13 It is raised when the result of a calculation exceeds the maximum limit for 1
numeric data type.
A. OverFlowError
B. TypeError
C. ZeroDivisionError
D. NameError
14 The data types CHAR (n) and VARCHAR (n) are used to create ___________ 1
and __________ length types of string/text fields in a database.
A. Fixed, Variable
B. Equal, Variable
C. Fixed, Equal
D. Variable, Equal
15 _____ is a standard mail protocol used to receive emails from a remote server 1
to a local email client.
A. SMTP
B. POP
C. HTTP
D. FTP
16 How do you change the file position to an offset value from the start? 1
A. fp.seek(offset, 0)
B. fp.seek(offset, 1)
C. fp.seek(offset, 2)
D. none of the mentioned
Q17 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: The function header ‘def read (a=2, b=5, c):’ is not correct. 1
Reason: Non default arguments can’t follow default arguments.
18 a=(1,2,3) 1
a[0]=4
Assertion(A):The above code will result in error
Reason(R): a is a list, So we can change it.
SECTION B
19 (a) Write the full forms of the following: (i) TCP/IP (ii) VoIP 2
(b) What is the use of FTP?
OR
Write any one point of difference between:
Page 3 of 11
a) Circuit Switching and Packet Switching.
b) Co-axial cable and Fiber – optic cable .
20 Preety has written a code to add two numbers. Her code is having errors. 2
Rewrite the corrected code and underline the corrections made.
def sum(arg1,arg2):
total=arg1+arg2;
print(”Total:”,total)
return total;
sum(10,20)
23 Write the Python statement for each of the following tasks using BUILT IN 2
functions/methods only :
(i) To insert an element 150 at the Second position, in the list L1.
(ii) To convert a string named, message in upper case.
OR
Write the Python command to import the required module and (using built-in
function) find out the factorial of a given no i.e 5.
Page 4 of 11
24 An organization SoftSolutions is considering to maintain their employees 2
records using SQL to store the data. As a database administrator, Murthy has
decided that :
• Name of the table - HRDATA
• The attributes of HRDATA are as follows:
ECode – Numeric
EName – character of size 30
Desig – Character of size 15
Remn – numeric
Now help Murthy to create table and insert one record (80008,Arjun,Admin,
55000) into the table.
OR
City Hospital is considering to maintain their inventory using SQL to store the
data. As a database administer, Ritika has decided that :
• Name of the database - CH
• Name of the table - CHStore
• The attributes of CHStore are as follows:
ItemNo - numeric
ItemName – character of size 20
Scode - numeric
Quantity – numeric
Now Ritika wants to remove the column Quantity from the table CHStore .
And she also wants to display the structure of the table CHStore, i.e, name of
the attributes and their respective data types that she has used in the table. Help
her to write the correct command .
Page 5 of 11
A=NUM[CNT]
B=NUM[CNT- 1]
print(Diff(A,B), “#”, end=” “ )
SECTION C
27 Consider the table EXAM given below and write the output of the following 3
SQL queries:
Page 6 of 11
c) SELECT MIN(Average) FROM EXAM WHERE Subject=”English”;
28 Write a function in python to count the number of lines in a text file ‘Country.txt’ 3
which are starting with an alphabet ‘W’ or ‘H’.
For example, If the file contents are as follows……………:
Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
The output of the function should be:
W or w : 1
H or h : 2
OR
Write a user defined function to display the total number of words present in a
text file 'Quotes.txt'.
For example: if the file contents are as follows:
Living a life you can be proud of doing your best Spending your time with people
and activities that are important to you Standing up for things that are right even
when it’s hard Becoming the best version of you.
The countwords() function should display the output as:
Total number of words : 40
Based on the given table, write SQL queries for the following:
a) Write a query to increase the salary of the Clerk by 5%.
b) Write down a query to display the information of those employees
Page 7 of 11
whose joining is in between 01/01/1985 and 31/03/2000.
c) Write a query to delete the details of Managers.
SECTION D
31 Consider the relations/tables EMP and DEPT and give the correct answer of 4
following queries.
Relation: EMP
EMPNO ENAME JOB MGR SAL COMM DEPTNO
Relation: DEPT
Page 8 of 11
DEPTNO DNAME LOC
10 ACCOUNTING NEWYORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
32 Write a Program in Python that defines and calls the following user defined 4
functions:
a) ADDPROD() – To accept and add data of a product to a CSV file
product.csv’.
Each record consists of a list with field elements as prodid, name and price to
store product id, employee name and product price respectively.
b) COUNTPROD() – To count the number of records present in the CSV
file named ‘product.csv’.
SECTION E
33 Quick Learn University is setting up its academic blocks at Prayag Nagar and 5
planning to set up a network. The university has 3 academic blocks and one
human resource Centre as shown in the diagram given below:
Block Distance
Law block to business block 40 m
Law block to technology block 80 m
Page 9 of 11
Law block to HR block 105 m
Business block to technology block 30 m
Business block to HR block 35 m
Technology block to HR block 15 m
Number of computers in each of the buildings is as follows:
Law block 15
Technology block 40
HR Centre 115
Business block 25
Page 10 of 11
name as parameter and count and return number of books by the given Author
are stored in the binary file “Book.dat”
35 (i) Define the term Domain with respect to RDBMS. Give one example to 5
support your answer.
(ii)Preety wants to write a program in Python to read the records from the table
named employee and displays only those records who have salary greater than
53500.
Empcode – integer
EmpName – string
EmpSalary – integer
Note the following to establish connectivity between Python and MYSQL:
• Host is localhost
• Username is root
• Password is root@123
• The table exists in a MYSQL database named management.
OR
(i)Give the difference between degree and cardinality of a relation.
(ii)Ravi wants to write a program in Python to read the records from a table
named TRAINER and increase the salary of Trainer SUNAINA by 2000.
TID -integer
TNAME -string
CITY-string
SALARY-integer
Note the following to establish connectivity between Python and MYSQL:
• Host is localhost
• Username is root
• Password is system
• The table exists in a MYSQL database named Admin.
Page 11 of 11