Xii PB2 QP CS Set2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

KENDRIYA VIDYALAYA SANGATHAN AGRA REGION

SECOND PRE BOARD EXAMINATION (Session 2023-24)


Class : XII Time Allowed : 03:00 Hours
Subject : (083) Computer Science Maximum Marks : 70
General Instructions:
Please check this question paper which 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 2 questions (31 to 32). Each question carries 4 Marks.
Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
All programming questions are to be answered using Python Language only.

Que No Question Marks

SECTION A

1 Which of the following functions print the output to the console? 1


A. Output( )
B. Print( )
C. Echo( )
D. print( )

2 State True or False: 1


“A special value “NULL” is used to represent values that are unknown to
certain attributes.”

3 What is the result after executing the following? 1


>>>print(20/4 *5+8-10)
A. 1
B. 23
C. 23.0
D. 24

4 Which one of the following is False regarding data types in Python? 1


A. In python, explicit data type conversion is possible
B. Mutable data types are those that can be changed.
C. Immutable data types are those that cannot be changed.
D. None of the above

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

7 What will be the output of the following python statement? 1


L=[3,6,9,12]
L=L+15
print(L)
A. [3,6,9,12,15]
B. [18,21,24,27]
C. [5,3,6,9,12,15]
D. error

8 The return type of string.split() is a 1


A. string
B. List
C. Tuple
D. Dictionary

9 Given the following dictionary 1


Emp1={"salary":10000,"dept":"sales","age":24,"name":"john"}
Emp1.keys() can give the output as
A. (“salary”,‟dept”,‟age‟,‟name‟)
B. (['salary', 'dept', 'age', 'name'])
C. [10000,‟sales‟,24,‟john‟]
D. {„salary‟,‟dept‟,‟age‟,‟name‟}

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

12 Which keyword is used to abandon the current iteration of the loop? 1


A. continue

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)

21 Predict the output of the Python code given below: 2


List1 = list("Examination")
List2 =List1[1:-1]
new_list = []
for i in List2:
j=List2.index(i)
if j%2==0:
List1.remove(i)
print(List1)

22 Write a function change(L), where L is the list of elements passed as argument 2


to the function. The function arranges odd numbers and even numbers
separately in two lists and displays them.
For example:
If L = [10, 20, 30, 40, 12, 11,13,15]
Then function will create and display two lists:
List of even elements: [10, 20, 30, 40, 12]
List of odd elements: [11, 13, 15]
OR
Write a function INDEX_LIST(S), where S is a string. The function returns a
list named ‘indexList’ that stores the indices of all vowels of S.
For example: If S is "Computer", then indexList should be [1,4,6]

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 .

25 Predict the output of the Python code given below: 2


def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23, 14,54,32]
for CNT in range (4,0,-1):

Page 5 of 11
A=NUM[CNT]
B=NUM[CNT- 1]
print(Diff(A,B), “#”, end=” “ )

SECTION C

26 Predict the output of the code given below: 3


def convert(Old):
l=len(Old)
New=" "
for i in range(0,l):
if Old[i].isupper():
New=New+Old[i].lower()
elif Old[i].islower():
New=New+Old[i].upper()
elif Old[i].isdigit():
New=New+"*"
else:
New=New+"%"
return New
Older="InDIa@2022"
Newer=convert(Older)
print("New String is: ", Newer)

27 Consider the table EXAM given below and write the output of the following 3
SQL queries:

No Name Stipend Subject Average Division


.
1 Karan 400 English 68 First
2 Aman 680 Mathematics 72 First
3 Javed 500 Accounts 67 First
4 Bishakh 200 Informatics 55 Second
5 Sugandha 400 History 35 Third
6 Suparna 550 Geography 45 Third

a) SELECT AVG(Stipend) FROM EXAM WHERE DIVISION=”Third”


b) SELECT COUNT(DISTINCT Subject) FROM EXAM;

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

29 Consider a table EMPLOYEE with the following data: 3

ENO ENAME SALARY BONUS DATE OF JOIN JOB TYPE

A01 Piya 30000 45.23 29-10-2019 Clerk

A02 Rahul 50000 25.34 13-03-2018 Analyst

B03 Nishu 30000 35.00 18-03-2017 Salesman

B04 Tanu 80000 23.45 31-12-2018 Manager

C05 Gautam 20000 32.05 23-01-1989 Clerk

C06 Julie 70000 12.37 15-06-1987 Analyst

D07 Neha 50000 27.89 18-03-1999 Manager

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.

30 A list contains following record of a customer: 3


[Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the
stack named ‘status’:
(i) Push_element() - To Push an object containing name and Phone number of
customers who live in Goa to the stack
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.
For example:
If the lists of customer details are:
[“Ashok”, “9999999999”,”Goa”]
[“Avinash”, “8888888888”,”Mumbai”]
[“Mahesh”,”77777777777”,”Cochin”]
[“Rakesh”, “66666666666”,”Goa”]
The stack should contain:
[“Rakesh”,”66666666666”]
[“Ashok”,” 99999999999”]
The output should be:
[“Rakesh”,”66666666666”]
[“Ashok”,”99999999999”]
Stack Empty

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

7369 SMITH CLERK 7902 800.00 NULL 20

7499 ALLEN SALESMAN 7698 1600.00 300.00 30

7521 WARD SALESMAN 7698 1250.00 500.00 30

7566 JONES MANAGER 7839 2975.00 NULL 20

7654 MARTIN SALESMAN 7698 1250.00 1400.00 30

7698 BLAKE MANAGER 7839 2850.00 NULL 30

7782 CLARK MANAGER 7839 2450.00 NULL 10

7788 SCOTT ANALYST 7566 3000.00 NULL 20

7839 KING PRESIDENT NULL 5000.00 NULL 10

7844 TURNER SALESMAN 7698 1500.00 0.00 30

Relation: DEPT

Page 8 of 11
DEPTNO DNAME LOC

10 ACCOUNTING NEWYORK

20 RESEARCH DALLAS

30 SALES CHICAGO

40 OPERATIONS BOSTON

Write SQL queries for the following:


a) Display the total no. of employees in each department?
b) Display the jobs where the number of employees is less than 3.
c) Display the name of the employee & their department name.
d) Display the maximum salary of the manager.

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:

Centre-to-Centre distance between various blocks is as follows:

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

(a) Suggest a cable layout of connection between the blocks.


(b) Suggest the most suitable place to house the server of the organization with
suitable reason.
(c) Which device should be placed/installed in each of these blocks to
efficiently connect all the computers within these blocks?
(d) The university is planning to link its sales counters situated in various parts
of the CITY. Which type of network out of LAN, MAN or WAN will be
formed?
(e) Which network topology may be preferred between these blocks?

34 (i)Differentiate between Binary File and CSV File. 5


(ii)write a python code to perform the following binary file operations with the
help of two user defined functions/modules:
a. AddStudents() to create a binary file called STUDENT.DAT containing
student information – roll number, name and marks (out of 100) of each
student.
b. GetStudents() to display the name and percentage of those students
who have a percentage greater than 75. In case there is no student having
percentage > 75 the function displays an appropriate message. The function
should also display the average percent.
OR
(i) Write one advantage and one disadvantage of using a binary file for
permanent storage?
(ii) A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price].
(a)Write a user defined function CreateFile() to input data for a record and add
to Book.dat .
(b) Write a function CountRec(Author) in Python which accepts the Author

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.

**************************END OF PAPER ************* **************** ****

Page 11 of 11

You might also like