0% found this document useful (0 votes)
115 views11 pages

3rd Paper

The document provides information about a Class 12 Computer Science exam, including general instructions, sections of the exam, and sample questions. It contains 18 one-mark questions in Section A testing concepts like Python syntax, SQL statements, and networking. Section B has 7 two-mark questions involving short programs, network types, and database concepts. Section C has 5 three-mark questions involving SQL queries and functions.

Uploaded by

Dansh mistry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views11 pages

3rd Paper

The document provides information about a Class 12 Computer Science exam, including general instructions, sections of the exam, and sample questions. It contains 18 one-mark questions in Section A testing concepts like Python syntax, SQL statements, and networking. Section B has 7 two-mark questions involving short programs, network types, and database concepts. Section C has 5 three-mark questions involving SQL queries and functions.

Uploaded by

Dansh mistry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

CLASS-XII SUBJECT- COMPUTER SCIENCE

Time: 3 hours MM: 70


General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each.
8. All programming questions are to be answered using Python Language only.
SECTION – A
1. Which of the following is not a valid identifier name in Python? 1
a) First_Name
b) _Area
c) 2nd_num
d) While
2. Find the operator which cannot be used with a string in Python from the following:- 1
a) //
b) *
c) +
d) in
3. Identify the valid declaration of Record: Record=(1342, “Pooja” , 45000, “Sales”) 1
a) List
b) Tuple
c) String
d) Dictionary
4. Which of the following expressions is an example of type casting? 1
a) 4.0+float(6)
b) 5.3+6.3
c) 5.0+3
d) None of these
5. What will be the output of the following statements? 1
a = [0, 1, 2, 3]
del a[:]
print(a)
a) None
b) [ ]
c) [0, 1, 2, 3]
d) NameError
6. Which of the following command is used to open a file “c:\temp.txt” in read mode only? 1
a) infile = open(“c:\temp.txt”, “r”)
b) infile = open(“c:\\temp.txt”, “r”)
c) infile = open(file = “c:\temp.txt”, “r+”)
d) infile = open(file = “c:\\temp.txt”, “r+”)
7. Which command is used to add a new record in existing table in SQL 1
a) insert into
b) alter table
c) add into
d) create table
8. Which SQL command is used to delete an existing column from a table? 1
a) update
b) delete
c) alter
d) order
9. What will be the output after the following statements? 1
x = 27
y=9
while x < 30 and y < 15:
x=x+1
y=y+1
print(x,y)
a) 26 11
b) 25 11
c) 30 12
d) 26 10
10. Which of the following function is used to FIND the largest value from the given data in 1
MYSQL?
a) MAX()
b) MAXIMUM ()
c) LARGEST ()
d) BIG ()
11. To print 4th line from text file, which of the following statement is true? 1
a) dt = f.readlines()
print(dt[3])
b) dt=f.read(4)
print(dt[3])
c) dt=f.readline(4)
print(dt[3])
d) All of these
12. What will be the order of the data being sorted after the execution of given query 1
SELECT * FROM STUDENT ORDER BY ROLL_NO;
a) Custom Sort
b) Descending
c) Ascending
d) None of the above
13. In specific, if the systems use separate protocols, which one of the following devices is 1
used to link two systems?
a) Repeater
b) Gateway
c) Bridge
d) Hub
14. Consider the expression given below. The value of X is: 1
X = 2+9*((3*12)-8)/10
a) 30.0
b) 27.2
c) 28.4
d) 30.8
15. Consider the table with structure as: Student (ID, name, dept name, tot_cred) 1
In the above table, which attribute will form the primary key?
a) Name
b) Dept
c) total_credits (
d) ID
16. To retrieve all the rows from the result set, which method is used? 1
a) fetchall
b) fetchone
c) fetchmany
d) none of the above
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 (A): The math.pow(2,4)gives the output: 16.0 1
Reason (R): The math.pow() method receives two float arguments, raise the first to the
second and return the result.
18. Assertion (A): CSV stands for comma separated value. 1
Reason (R): CSV files are a common file format for transferring and storing data.
SECTION – B
19. Aman has write the code to find factorial of an integer number as follow. But he got 2
some error while running this program. Kindly help him to correct the errors.

num=int(input("Enter any integer number"))


fact=1
for x of range(num,1,-1)
if num=1 or num=0
print ("Fact=1")
break
else
fact=fact*x
print(fact)
20. ABC Company wants to link its computers in Head office in New Delhi to its office in 2
Sydney. Name the type of Network that will be formed. Which communication media
should be used to form this Network?
OR
Differentiate between communication using Optical Fiber and Ethernet Cable in context
of wired medium of communication technologies.
21. a) Given a list: 1
List1=[10,[20,30,40],50,60,70,80,90]
What will be the output of
print(List1[1:3:2])? 1

b) Write the output of following code:


Tup1=(10,15,20,25,30)
print(Tup1[-1:0:-2])
22 What do you mean by Primary Key in a relation/table? Give a suitable example of 2
primary key.
23 a) Which service/protocol will be most helpful to conduct live interactions from one 1
location to different locations?
b) Write full form of the following: 1
i) FTP
ii) HTTP
24 Write the output of the following Python program code: 2
TXT = ["10","20","30","5"]
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
T = TXT[CNT]
TOTAL = float (T) + C
print (TOTAL)
CNT-=1
OR
def check(x,y):
if x != Y:
return x + 5
else:
return y +10
print(check(10,5))

25 What do you understand by ORDER BY in SQL? Explain the use of Where clause with 2
SELECT.
OR
What do you mean by degree and cardinality of table?
Section-C
26 a) Table: EMPLOYEES 2+1
Empid Firstname Lastname Address City
010 Ravi Kumar Raj nagar GZB
105 Harry Waltor Gandhi nagar GZB
152 Sam Tones 33 Elm St. Paris
215 Sarah Ackerman 440 U.S. 110 Upton
244 Manila Sengupta 24 Friends street New Delhi
300 Robert Samuel 9 Fifth Cross Washington
335 Ritu Tondon Shastri Nagar GZB
400 Rachel Lee 121 Harrison St. New York
441 Peter Thompson 11 Red Road Paris
Table: EMPSALARY
Empid Salary Benefits Designation
010 75000 15000 Manager
105 65000 15000 Manager
152 80000 25000 Director
215 75000 12500 Manager
400 32000 7500 Salesman
441 28000 7500 salesman
501 18000 6500 Clerk

Give the Output of following SQL commands:


(i) Select Employee.firstname, empsalary,salary from employees, empsalary
where designation = ‘Salesman’ and Employees.empid=Empsalary.empid;
(ii) Select count(distinct designation) from empsalary;
(iii) Select designation, sum(salary) from empsalary group by designation having
count(*) >2;
(iv) Select sum(benefits) from empsalary where designation =’Clerk’;
b) Define Equi join with a suitable example
27 Write a function readMe() which read a file ‘data.txt’ and print the frequency of the 3
words ‘India’ in it.
OR
Write a function linecount() in python which read a file ‘data.txt’ and count number of
lines starts with character ‘P’.
28 Write SQL commands for (a) to (d) and write output for (e) to (f) on the basis of 3
TRANSPORT table:
Rtno Area_overed Capacity Noofstudents Distance Transporter Charges
1 Vasant kunj 100 120 10 Shivamtravels 100000
2 Hauz Khas 80 80 10 Anand travels 85000
3 Pitampura 60 55 30 Anand travels 60000
4 Rohini 100 90 35 Anand travels 100000
5 Yamuna Vihar 50 60 20 Bhalla Co. 55000
6 Krishna Nagar 70 80 30 Yadav Co. 80000
7 Vasundhara 100 110 20 Yadav Co. 100000
8 Paschim Vihar 40 40 20 Speed travels 55000
9 Saket 120 120 10 Speed travels 100000
10 Jank Puri 100 100 20 Kisan Tours 95000
a) To show all information of students where capacity is more than the no of
student in order of rtno.
b) To show area_covered for buses covering more than 20 km., but charges less
than 80000.
c) select sum(distance) from schoolbus where transporter= “ Yadav Co.”;
d) select min(noofstudents) from schoolbus;
29 Write definition of a method/function AddOddEven(VALUES) to display sum of odd and 3
even values separately from the list of VALUES.
For example : If the VALUES contain [15, 26, 37, 10, 22, 13]
The function should display
Even Sum: 58
Odd Sum: 65
30 Write PushOn(Book) and Pop(Book) methods/functions in Python to add a new Book and 3
delete a Book from a List of Book titles, considering them to act as push and pop
operations of the Stack data structure.
OR
Write a program to implement a stack for the students(studentno, name). Just
implement Pop and display.
SECTION-D
31 Ayurveda Training Educational Institute is setting up its centre in Hyderabad with four 5
specialised departments for Orthopedics, Neurology and Pediatrics along with an
administrative office in separate buildings. The physical distances between these
department buildings and the number of computers to be installed in these departments
and administrative office are given as follows. You, as a network expert, have to answer
the queries as raised by them in (i) to (v).
Administrative Office to Orthopedics Unit 55
Neurology Unit to Administrative Office 30
Orthopedics Unit to Neurology Unit 70
Pediatrics Unit to Neurology Unit 50
Pediatrics Unit to Administrative Office 40
Pediatrics Unit to Orthopedics Unit 110

Number of Computers installed at various locations are as follow:


Administrative Office 150
Orthopedics Unit 40
Pediatrics Unit 50
Neurology Unit 80
Administrative Orthopaedics
Office Unit
Pediatrics Neurology
Unit Unit
i. Suggest the most suitable location to install the main server of this institution to get
efficient connectivity.
ii. Suggest the best cable layout for effective network connectivity of the building
having server with all the other buildings.
iii. Suggest the devices to be installed in each of these buildings for connecting
computers installed within the building out of the following : Gateway, switch,
Modem
iv. Suggest the topology of the network and network cable for efficiently connecting
each computer installed in each of the buildings out of the following :
Topologies: Bus Topology, Star Topology
Network Cable: Single Pair Telephone Cable, Coaxial Cable, Ethernet Cable.
v. Suggest a system (hardware/software) to prevent unauthorized access to or from the
network.
32 a) What possible output(s) are expected to be displayed on screen at the time of 2+3
execution of the program from the following code? Also write the value assigned to
variable first and second.
from random import randint
LST=[5,10,15,20,25,30,35,40,45,50,60,70]
first = random.randint(3,8) – 1
second = random.randint(4,9) – 2
third = random.randint(6,11) – 3
print(LST[first],"#", LST[second],"#", LST[third],"#")

i) 20#25#25#
ii) 30#40#70#
iii) 15#60#70#
iv) 35#40#60#
b) The code given below inserts the following record in the table
Student: Empno – integer
EName – string
Designation – integer
Salary – integer
Bonus - Integer
Note the following to establish connectivity between Python and MYSQL:
 Username is root
 Password is tiger
 The table exists in a MYSQL database named Employee.
 The details (Empno, EName, Designation, Salary and Bonus) are to be accepted
from the user.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table
Employee.
Statement 3- to add the record permanently in the database
import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root", password="tiger",
database="Employee")
mycursor= #Statement 1
eno=int(input("Enter Employee Number: "))
Ename=input("Enter Employee Name: ")
Designation=input("Enter Designation: "))
Salary=int(input("Enter Salary: "))
Bonus=int(input("Enter Bonus: "))
querry="insert into employee values({},'{}',{},{})".
format(eno,ename,designation,bonus)
#Statement 2
# Statement 3
print("Employee Data Added successfully")
OR
a) Predict the output:
def func(S):
k=len(S)
m=''
for i in range(0,k):
if S[i].isalpha( ):
m=m+S[i].upper( )
elif S[i].isdigit( ):
m=m+'0'
else:
m=m+'#'
print(m)
func("Python 3.9")
b) What are the basic steps to connect Python with MYSQL using table Members
present in the database ‘Society’?
33 Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, 5
he has been assigned an incomplete python code (shown below) to create a CSV File
'Student.csv' (content shown below). Help him in completing the code which creates the
desired CSV File. CSV File
1,AKSHAY,XII,A
2,ABHISHEK,XII,A
3,ARVIND,XII,A
4,RAVI,XII,A
5,ASHISH,XII,A
Incomplete Code
import #Statement-1
fh = open( , , newline='') #Statement-2
stuwriter = csv. #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ")
rec = [ ] #Statement-4
data.append(rec)
stuwriter. (data) #Statement-5
fh.close()
Answer the following questions
i. Write the suitable code for blank space in line marked as Statement-1
ii. Write the missing code for blank space in line marked as Statement-2?
iii. Write function name (with argument) that should be used in the blank space of line
marked as Statement-3
iv. Complete the statement-4 with suitable code.
v. Write the function name that should be used in the blank space of line marked as
Statement-5 to create the desired CSV File?
OR
Your teacher has given you a method/function FilterWords() in python which read lines
from a text file NewsLetter.TXT, and display those words, which are lesser than 4
characters. Your teachers intentionally kept few blanks in between the code and asked
you to fill the blanks so that the code will run to find desired result. Do the needful with
the following python code.
def FilterWords():
c=0
file=open('NewsLetter.TXT', ' ') #Statement-1
line = file. #Statement-2
word = #Statement-3
for c in word:
if : #Statement-4
print(c)
#Statement-5
FilterWords()
i. Write mode of opening the file in statement-1?
ii. Fill in the blank in statement-2 to read the data from the file.
iii. Fill in the blank in statement-3 to read data word by word.
iv. Fill in the blank in statement-4, which display the word having lesser than 4
v. Fill in the blank in Statement-5 to close the file.

SECTION E
34 A department is considering to maintain their worker data using SQL to store the data. As 4
a Database Administrator, Karan has decided that:
Name of the database –Department
Name of the table –Worker
The attributes of Worker are as follows:
WORKER_ID – CHARACTER OF SIZE 3
FIRST_NAME – CHARACTER OF SIZE 10
LAST_NAME – CHARACTER OF SIZE 10
SALARY – NUMERIC
JOINING_DATE – DATE
WORKER_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT
001 MONIKA ARORA 100000 2014-02-20 HR
002 NIHARIKA DIWAN 80000 2014-06-11 Admin
003 VISHAL SINGHAL 300000 2014-02-20 HR
004 AMITABH SINGH 500000 2014-02-20 Admin
005 VIVEK BHATI 500000 2014-06-11 Admin
06 VIPUL DIWAN 200000 2014-06-11 Account
07 SATISH KUMAR 75000 2014-02-20 Account
08 MONIKA CHAUHAN 80000 2014-04-11 Admin
a) Karan wants to remove all the data from table WORKER from the database
department. Write the command to delete above said information.
b) Identify the attribute best suitable to be declared as a primary key.
c) (i) Karan wants to increase the size of the FIRST_NAME column from 10 to
20 characters. Write an appropriate query to change the size.
(ii) Write a query to display the structure of the table Worker, i.e. name of the
attribute and their respective data types
OR (only for part c)
Write command to create above table
35 Amritya Seth is a programmer, who has recently been given a task to write a python code 4
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.

You might also like