Computer Science - Xii - Question Paperfinal
Computer Science - Xii - Question Paperfinal
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.
Q No. Section-A (21 x 1 = 21 Marks) Marks
Which of the following is a valid identifier:
1.
i. 9type ii. _type iii. Same-type iv. True (1)
10. Mention the modes in which the file pointer is at the end of the line. (1)
Look at the following code and select the correct description of error shown while
11. executing it :
X=int(input(“Enter a number”)) (1)
R=X+50
print “Sum = “ ,R
a) can only concatenate str(not “int”) to str
b) Missing parenthesis in call to ‘print’
c) Name ‘Print’ is not defined
d) None of the above
13. Mr. Soman created a table named “Student” with the fields Rollno, Student_name, (1)
Class and Section. He entered several rows into the table. When he displayed the
entered rows, he found that Rollno’s were duplicated without knowing it.
If you were in Soman’s position, what type of constraints would you apply to avoid
the above data redundancy?
14. The UPDATE SQL clause can
a) Update only one row at a time
b) Update more than one row at a time
c) Delete more than one row at a time (1)
d) Delete only one row at a time
15. Which of the following clause is used to sort records in a table?
a) GROUP
b) GROUP BY
(1)
c) ORDER BY
d) ORDER
16. The operation whose result contains all pairs of tuples from the two relations,
regardless of whether their attribute values match.
a) Join (1)
b) Intersection
c) Union
d) Cartesian Product
17. Out of the following, which is the costliest wired and wireless medium of
transmission?
(1)
Infrared, Coaxial cable, optical fibre microwave, satellite, twisted pair
cable.
18. The IP(Internet protocol) of TCP/IP transmits packets over the internet using ______
a.circuit
b.message
(1)
c.packet
d.all of these
19. VoIP can be used for following communication
(A) Audio (1)
(B) Video
(C) data
(D) All of the above
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the
correct choice as:
Both A and R are true and R is the correct explanation for A
Both A and R are true and R is not the correct explanation for A
A is True but R is False
A is False but R is True
20. Assertion (A): PRIMARY KEY constraint is given with the column. (1)
Reason (R): NULL values are not allowed to be entered using the NOT NULL
constraint
21. Assertion (A): CSV file is a human readable text file where each line has a number
of fields,separated by commas or some other delimiter.
Reason (R): writerow() function can be used for writing into writer object. (1)
22. Raman has written a code to find its sum of digits of a given number passed as
parameter tofunction sumdigits(n). His code has errors. Rewrite the correct code and
underline the corrections made. (2)
def sumdigits(n):
d=0
for x in
str(n):
d=d+x
return d
n=int(input(‘Enter any number”))
s=sumdigits(n)
print(“Sum of digits”,s)
28. What are the possible output(s) of the following code?Also specify the maximum
and minimum values that can be assigned to variable x.
import random (2)
M=[“Car”,”Tar”,”Roar”,”Boar”]
X=random.randint(0,3)
for I in range(x+1):
print(M[i],” “,end=” “)
a. Car Tar
b. Tar Roar
c. Car Tar Roar Boar
d. Roar Boar
29. Write a method SHOWLINES() in Python to read lines from text file
‘TESTFILE.TXT’ and display the lines which do not contain 'ke'.
(3)
Example: If the file content is as follows:
An apple a day keeps the doctor away.
We all pray for everyone’s safety.
A marked difference will come in our country.
The SHOWLINES() function should display the output as:
We all pray for everyone’s safety.
Or
Write a function RainCount() in Python, which should read the content of
a text file “RAIN.TXT” and then count and display the count of occurrence of
word RAIN (case-insensitive) in the file.
Example: If the file content is as follows:
It rained yesterday
It might rain today
I wish it rains tomorrow too
I love Rain
The RainCount() function should display the output as: Rain – 2
30. Write the following user-defined functions in Python to perform the specified
operations on the stack PlayersStack:
(I) push_player(PlayersStack, new_player):
This function takes the stack PlayersStack and a new player record
new_player as arguments and pushes the new player record onto the stack.
(II) pop_player(PlayersStack):
This function pops the topmost player record from the stack and returns it. (3)
If the stack is already empty, the function should display "Underflow".
(III) peep_player(PlayersStack):
This function displays the topmost element of the stack without deleting it.
If the stack is empty, the function should display 'None'.
Or
Write a Python program to input an integer and display all its even factors in
ascending order, using a stack.
For example, if the input number is 360, the output should be:
2 4 6 8 10 12 18 20 24 30 36 40 60 72 90 120 180 360
Hint: The even factors of a number are the factors that are divisible by 2.
31. Predict the output of the following code:
fruits = ["apple", "banana", "cherry"]
counts = [3, 2, 4]
output_str = "" (3)
for i in range(len(fruits)):
for j in range(counts[i]):
output_str += fruits[i][0] + "*"
output_str += "\n"
print(output_str)
or
Predict the output of the following code
numbers = [5, 8, 3, 6]
for i in numbers:
for j in range(i % 4):
print(j + 1, '*', end="")
print()
Table:COURSES
C_ID F_ID CName Fees
C21 102 Grid Computing 40000
C22 106 System Design 16000
C23 104 Computer Security 8000
C24 106 ,Human Biology 15000
C25 102 Computer Network 20000
C26 105 Visual Basic 6000
i) To display complete details (from both the tables) of those Faculties
whose salary is less than 12000.
ii) To display the details of courses whose fees is in the range of 20000
to 50000 both values included).
iii)To increase the fees of all courses by 500 which have "Computer" in
their Course names.
iv) (A) To display names (FName and LName) of faculty taking System
Design.
OR
(B) To display the Cartesian Product of these two tables.
35. Consider a table named STUDENT in a database, which has the following structure:
Field Type
name varchar(50)
marks int(3)
Write a Python program to perform the following operation:
Update the marks of the student named 'pop' from 90 to 99.
After updating the marks, the program should print the number of
records affected by the update operation. (4)
Assume the following database connection details:
Host: localhost
User: root
Password: password
Database: STUDENTDB
SECTION E (2 X 5 = 10 Marks) Marks
Q.No
36. i. Differentiate the method read() and readlines().
ii. Keshav is a student in CBSE school. He is assigned with a project to work on
binary file operations. Help him to accomplish the below task.
o addrecord() to create a binary file called “Student.DAT” containing
information of the student in form of list datatype.
Information to be collected Rollno, name, marks(out of 100) of each (2+3=5)
student.
o search() to display the name and marks based on the Rollno.
(OR)
i. How text files are different from binary files.
ii. Mr. Mathew is a programmer who has recently joined the company and
given
a task to write a python code to perform update operations in binary
file(Emp.dat) which contains (EmpID, Ename and Salary). Help him to
perform the below task.
• Addvalue() to create a binary file called “Emp.dat”and inserts the above
value as user input.
• Updatvalue() – update the salary of the employee by 2000 Rs whose emp
no is 23.
37. Granuda consultants are setting up a secured network for their office campus at
Faridabad for their day to day office and web based activities. They are planning to
have connectivity between 3 buildings and the head office situated in Kolkata.
Answer the Question (a) to (e) after going through the bulding poditions in the
campus and the other details which are given below:
Distance between the buildings:
• Building Ravi to Jamuna → 120 m
• Building Ravi to Ganga → 50 m
• Building Ganga to Jamuna → 65 m
• Faridabad campus to Head Office → 1460 km
Number of Computers:
• Building Ravi → 25 Nos.
• Building Jamuna → 150 Nos.
• Building Ganga → 51 Nos.
• Head Office → 10 Nos.
a) Suggest the most suitable place to house the server of this organization.
Also
give a reason to justify your suggested location.
b) Suggest a cable layout of connections between the buildings inside the (5)
campus.
c) Suggest the placement of the following devices with justification:
• Switch • Repeater
d) The organization is planning to provide a high speed link with its head
office situated in KOLKATA using a wired connection. Which of the
following device will be most suitable for this job?
i. Optical Fiber
ii. Co-axial cable
iii. Ethernet cable
e) The organization is planning to connect its Head office with Faridabad
campus. Which type of network out of LAN, MAN, or WAN will be
formed? Justify your answer.
(I) Suggest the most appropriate location of the server inside the
MUMBAI campus. Justify your choice.
(II) Which hardware device will you suggest to connect all the computers
within each building?
(III) Draw the cable layout to efficiently connect various buildings within
the MUMBAI campus. Which cable would you suggest for the most
efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout? Why/
Why not?
(V) A) What would be your recommendation for enabling live visual
communication between the Admin Office at the Mumbai campus and
the DELHI Head Office from the following options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the MUMBAI campus?