Class 12th Computer Science
Class 12th Computer Science
9 If a table which has one Primary key and two candidate keys. How many Alternate keys 1
will this table have?
(A) 1
(B) 2
(C) 3
(D) 4
10 Which of the following modes in Python creates a new file, if file does not exist and 1
overwrites the content, if the file exists ?
(a) r+
(b) r
(c) w
(d) a
14 Fill in the blank : _________ statement of SQL is used to insert new records in a table. 1
(a) ALTER
(b) UPDATE
(c) INSERT
(d) CREATE
15 In which datatype the value stored is not padded with spaces to fit the specified length, 1
instead it only take up the space they need to store the data.
(A) DATE
(B) VARCHAR
(C) FLOAT
(D) CHAR
17 Which protocol is a set of rules for transmitting data over the internet, and is the basis for 1
the World Wide Web:
(a) pop
(b) http
(c) ftp
(d) smtp
18 Ethernet card is also known as : 1
(a) LIC
(b) NIC
(c) MIC
(d) OIC
19 Fill in the blank : In _________ switching, before a communication starts, a dedicated path 1
is identified between the sender and the receiver.
(a) Packet
(b) Graph
(c) Circuit
(d) Plot
Q20 and Q21 are Assertion(A) and Reason(R) 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
20 Assertion (A): CSV module allows to write a single record into each row in CSV file using 1
writerow() function.
Reason (R): The writerow() function creates header row in csv file by default.
21 Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses. 1
Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore,
these can be used interchangeably.
SECTION B
24 Consider the following list L1 and write Python statement for the following questions: 2
L1=[‘english’,’physics’,’chemistry’,’cs’,’biology’]
(i) (A) To insert subject “maths” as last element
or
(B) To display the list in reverse alphabetical order
25 What possible outcome will be produced when the following code is executed? 2
import random
value=random.randint(0,3)
fruit=["APPLE","ORANGE","MANGO","GRAPE"]
for i in range(value):
print(fruit[i],end='##')
a) APPLE##
b) APPLE##ORANGE##
c) APPLE## ORANGE##GRAPE##
d) ORANGE##MANGO##APPLE##
26 Rewrite the following code in Python after removing all syntax error(s) and underline each 2
correction done in the code .
define fun1():
30 = num
for k range(0,num):
if k%4=0 :
print(k*4)
else:
print(k+3)
27 (i) A) What constraint should be applied on a table column so that duplicate values are not 2
allowed in that column, but NULL is allowed.
OR
B) What constraint should be applied on a table column so that NULL is not allowed in that
column, but duplicate values are allowed
(II) A) Write an SQL command to remove the Primary Key constraint from a table, named
MOBILE. M_ID is the primary key of the table.
OR
B) Write an SQL command to make the column M_ID the Primary Key of an already
existing table, named MOBILE.
SECTION C
29 Write a function in Python to count the number of lines in a text fie ‘EXAM.txt’ which start 3
with an alphabet ‘T’ .
OR
Write a function in Python that count the number of “can” words present in a text file
“DETAILS.txt”
30 Thushar received a message(string) that has upper case and lower-case alphabet. He want to 3
extract all the upper case letters separately .Help him to do his task by performing the
following user defined function in Python:
a) Push the upper case alphabets from the string into a STACK
b) Pop and display the content of the stack.
For example:
If the message is “All the Best for your Pre-board Examination”
The output should be : E P B A
Or
Consider a list named Nums which contains random integers. Write the following user
defined functions in Python and perform the specified operations on a stack named
BigNums.
(i) PushBig () : It checks every number from the list Nums and pushes all such numbers
which have 5 or more digits into the stack, BigNums.
(ii) PopBig () : It pops the numbers from the stack, BigNums and displays them. The
function should also display "Stack Empty" when there are no more numbers left in the
stack.
For example: If the list Nums contains the following data :
Nums = [213,10025, 167, 254923, 14, 1297653, 31498, 386 ,92765]
Then on execution of PushBig () , the stack BigNums should store :
[10025, 254923, 1297653, 31498, 92765]
And on execution of PopBig () , the following output should be displayed :
92765
31498
1297653
254923
10025
Stack Empty
31 Predict the output of the Python code given below: 3
def calculate(str):
text=''
x=range(len(str)-1)
for i in x:
if str[i].isupper():
text+=str[i]
elif str[i].islower():
text+=str[i+1]
else:
text+='@'
return text
start='Pre-board Exam'
final=calculate(start)
print(final)
OR
Predict the output of the following code :
def Total (Num=10):
Sum=0
for C in range(1,Num+1):
if C%2!=0:
continue
Sum+=C
return Sum
print(Total(4),end="$")
print(Total(),end="@")
SECTION D
33 A csv file " record.csv " contains the data . Each record consists of a list with field elements 4
as empid, name and sal to store employee id, employee name and employee salary
respectively.
Write user defined functions s in Python that defines the following:
(i) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’.
(ii) COUNTR() – To count the number of records present in the CSV file named
‘record.csv’ whose salary is more than 100000.
34 Aman has been entrusted with the management of some Institution’s Database. He needs to 4
access some information from FACULTY and COURSES tables for a survey analysis.
Help him extract the following information by writing the desired SQL queries as
mentioned below.
Teacher
Posting
(i) To list the names and age of female teachers who are in Mathematics department.
(ii) To display the name teachers who are posted in Agra
(iii) To display the max(date_to_join), min(date_to_join) of teachers
(iv)
(A) To display name, bonus, department for each teacher where bonus is 10% of
salary
Or
(B) To display the Cartesian Product of these two tables.
SECTION E
37 Oxford college, in Delhi is starting up the network between its different wings. There are 5
four Buildings named as SENIOR, JUNIOR, ADMIN and HOSTEL as shown below: