12 CS Board Set 1 QP
12 CS Board Set 1 QP
Computer Science (083) 6. If a text file is opened in w+ mode, then what is the initial position of file 1
pointer/cursor?
Sample Question Paper (Theory)
(a) Beginning of file (b) End of the file
Maximum Marks: 70 Time Allowed: 3 hours (c) Beginning of last line of text file (d) Undetermined
General Instructions:
7. Fill in the blank: 1
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory. Keyword is used to set foreign key in SQL.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each. (a) foreign key (b)unique (c) references (d)primary
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. 8. Which of the following commands will change the datatype of the table in 1
7. Section E has 02 questions carrying 04 marks each. One internal choice is MYSQL?
given in Q35 against part c only. (a) DELETE TABLE
8. All programming questions are to be answered using Python Language only.
(b) DROP TABLE
(c) REMOVE TABLE
(d) ALTER TABLE
SECTION A
1. Which of the following is an invalid statement? 1 9. For a user defined function with header 1
a. abc=1,000,000 c. a b c=100 200 300 def start (x, y, z=10),
b. a, b, c= 100,200,300 d. a=b=c=100 Which of the following function call statements will generate an
2. Which of the following operators has the highest precedence? 1 error?
(a) << (b) ** (c)% (d)and
(a) start(10) (b) start(x = 10,y = 20)
3. What will be the output of the following Python code snippet? 1 (b) start(y = 20, x = 10) (d) All of the above
d1 = {"john":40, "peter":45}
d2 = {"john":466, "peter":45} 10. Fill in the blank: 1
d1 > d2 _______________ refers to a situation of keeping the same data in different
a) True formats in two different tables
b) False (a) data redundancy
c) Error (b) data privacy
d) None (c) data inconsistency
4. What will be the value of the given expression? 1 (d) data integrity
3+3.00, 3**3.0 11. What is the binary file mode associated with “file must exist, otherwise error will 1
(a) (6.0, 27.0) be raised and reading and writing can take place”?
(b) (6.0, 9.00) (a) ‘wb+’ (b) ‘w+’ (c) ‘rb’ (d) ‘rb+’
(c) (6,27)
(d) [6.0,27.0] 12. Fill in the blank: 1
(e) [6,27] Group by clause uses ______________ clause to apply conditions on aggregate
5. Select the correct output of the code: 1 rows
(a) where (b) order by (c) sort (d) having
a = "foobar"
13. Fill in the blank: 1
a = a.partition("o")
What kind of transmission medium is most appropriate to carry data in a
(a) ["fo","","bar"] computer network that is exposed to electrical interferences?
(b) ["f","oo","bar"]
(c) ["f","o","bar"] a. Unshielded twisted pair b. Optical fiber c. Coaxial cable d. Microwave
(d) ("f","o","obar")
14. If x = 12 and y = ‘12’, then what will be the output of the following code? 1 1
print(x*2, y*2, sep="") (b) Sum = 0
for k in range(10 , 1, -2):
(a) 2424 (b) 24 24 (c) 241212 (d) 24 1212 Sum = Sum+k
print(Sum)
22. Explain the referential integrity constraint. What conditions must be met in 2
15. Which of the following is not a built in aggregate function in SQL? 1 order to set referential integrity?
23. (a) Write the full forms of the following: 2
a) avg b) max c) total d) count
(i) CDMA (ii) SLIP
16. Name the method which is used for displaying only one resultset. 1 (b) What is the use of HTTP?
(a) fetchmany (b) fetchno (c) fetchall (d) fetchone 24. Predict the output of the Python code given below: 2
def modifyList(x):
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the x.append(sum(x))
correct choice as print(x, end= ‘ ’)
a. Both A and R are true and R is the correct explanation for A L = [1,2,3,4]
b. Both A and R are true and R is not the correct explanation for A
print(L, end= ‘ ’)
c. Both A and R are false.
d. A is True but R is False modifyList(L)
e. A is false but R is True print(L)
OR
17. Assertion (A): Parameters with default arguments can be followed by 1
parameters with no default argument. Predict the output of the Python code given below:
Reason (R): Syntactically, it would be impossible for the interpreter to decide l1 = [10,15,16,18,20]
which values match which arguments if mixed modes were allowed while l1.remove(15)
providing default arguments. l1.insert(1,30)
print (l1[::-2])
18. Assertion (A): Local Variables are accessible only within a function or block in 1
which it is declared 25. 2
Reason (R): Global variables are accessible in the whole program.
SECTION B
20. Write two points of difference between Circuit Switching and Packet Switching. 2
OR (a) Find the Degree and Cardinality of the Cartesian product of the
Supplier and Product relations.
Write two points of difference between Coaxial and fiber. (b) Identify the foreign key in the given tables, also mention in which table
21. Find the output. 1 it is appearing as a foreign key?
(a) def example(a):
a = a+2 OR
a=a*2
Find output:
return a
(a) select *from product p, supplier s where p.supcode=s.supcode;
>>>print(example("hello")) (b) select *from product natural join supplier;
SECTION C
26 (a) Create the connection of Python with MYSQL, in which (1) 1+2 Table: Employee
User=Admin Password= Admin2123 Database Name=System
(b) Write the output of the queries (a) to (d) based on the table, Staff given
below:
Table: Staff
29. Write a function merge_tuple(t1,t2), where t1 and t2 are the tuples of elements 3
passed as argument to the function. The function returns another tuple named that
stores the sum of consecutive element of t1 and t2, only if they are of same length
else return -1
For example:
(a) Select avg(exp) from staff where gender = ‘F’;
T1=(1,2,3,4)
(b) Select min(doj) from staff;
T2=(5,6,7,8)
(c) Select *from staff where gender!=’M’ and dept like ‘_ _ _ _ _’; Then function should return
(d) Select name, doj from staff where dept not in (‘Finance’,’Sales’); (6,8,10,12)
27. Assume that a text file named TEXT1.TXT already contains some text written 3
into it, write a program with a function named vowelwords(), that reads the file And if
TEXT1.TXT and create a new file named TEXT2.TXT , which shall contain T1=(1,2,3)
T2=(5,6,7,8)
only those words from the
Then function should return
file TEXT1.TXT which don’t start with an uppercase vowel(i.e. with -1
‘A’,’E’,’I’,’O’,’U’)
30. Rajiv has created a dictionary containing employee names and their salaries as 3
for example if the file TEXT1.TXT contains key value pairs of 6 employees.
Carry Umbrella and Overcoat When it Rains Write a program, with separate user defined functions to perform the following
operations:
then the file TEXT2.TXT shall contain
● Push the keys (employee name) of the dictionary into a stack, where the
Carry and when it Rains. corresponding value (salary) is less than 85000.
● Pop and display the content of the stack.
OR For example:
If the sample content of the dictionary is as follows:
Write a Python program to count all the line having 'a' as last character.
Emp={"Ajay":76000, "Jyothi":150000, "David":89000, "Remya":65000,
28. Dileep has to create a database named Company in MYSQL. 3
"Karthika":90000, "Vijay":82000}
He now needs to create a table named Employee in the database to store the
records of employees in the company. The table Employee has the following The output from the program should be:
structure: Vijay Remya Ajay
OR
Aruna has a list containing temperatures of 10 cities. You need to help her create
a program with separate user defined functions to perform the following
operations based on this list.
● Traverse the content of the list and push the negative temperatures into a stack. (d) Suggest a device that can provide wireless Internet access to all
● Pop and display the content of the stack. smartphone/laptop users in the campus of Excel Public School,
For Example: Coimbatore.
If the sample Content of the list is as follows: (e) Draw suitable layout to connect all four wings of Excel Public School
T=[-9, 3, 31, -6, 12, 19, -2, 15, -5, 38]
Sample Output of the code should be: 32. (a) Write the output of the code given below: 2+3
-5 -2 -6 -9
x = 10
def localvar():
SECTION global x
D x+=5
31. Excel Public School, Coimbatore is setting up the network between its 5 print(x, end=' ')
different print(x+5, end=' ')
wings of school campus. There are 4 wings namely SENIOR(S), JUNIOR localvar()
(J), print(x, end=' ')
ADMIN (A) and HOSTEL (H).
____________________ #statement 1
dataBase = mysql.connector.connect(
host ="localhost",
user ="user",
passwd ="password",
database = "gfg"
)
SECTION
E
34 Write SQL queries for (a) to (d) based on the tables PASSENGER and 1+1+2
FLIGHT given below:
I. Identify suitable code for the blank space in line marked as Statement-
a) include
b) add
c) Import
d) import
II. Identify the missing code for the blank space in line marked as Statement-2.
a) Customer
b) reader
c) csvwriter
d) writer
III. Identify the argument name for the blank space in line marked as Statement-3?
a) Row
b) Rec
c) row
d) rec
IV. Identify the missing file name for the blank space in line marked as Statement-
4?
a) customer
b) customer.csv
c) customer.txt
d) customer.dat
V. Identify the object name for the blank space in line marked as Statement-5?
a) i
b) Rec
c) row
d) rec