You are on page 1of 2

PT-1 EXAM

XII Computer Science(083)


Time:1:30Hrs M.M:40

1. a. Write the output of the following: 1


print(-5//2)
print(-5%2)

b. Find out the valid identifiers out of the following: 1


int, 1stvariable, all.level, _temp

c. Write the output of the following: 1


print('10' + '20')
print('10' * 2)

e. Rewrite the follwing code after removing syntax error(s) if any, underline the corrections: 2
def callme(a=1,b):
s=(0)
while i in range(a,b):
sum =+ i
return sum
m,n=10,20
c=call(m,n)

g. Observe the following code carefully and write the correct possible outcomes out of (i) to 2
(iv). Justify your answer.
import random
def recur(n):
print(n,end='#')
if n<=3:
return
m=random.randint(0,1)
if m:
recur(n-1)
else:
recur(n-2)
recur(10)

(i) 10#9#7#5#3# (ii)10#8#6#5#


(iii) 3#5#7#10# (iv) 10#8#6#5#3#

c. Write the output of the following code: 3


def f(a,b=1,c=2):
global d
print(a+b,c+d)
if d==3:
return 0
d+=1
return d+f(a=b,b=a)
d=1
f(3)
Page:1
e. Write a function in Python, INSERTQ(Arr,data) and DELETEQ(Arr) for performing 4
insertion and deletion operations in a Queue. Arr is the list used for implementing queue
and data is the value to be inserted.

3. b. Define a function to count all the words starting with Vowels in a file V.TXT. Display the 2
count.

c. Define a function to count the number of lines in a text file LINES.TXT. 2

e. Define a function SUM(N) which calculates and return the sum of all the digits present in 2
the integer N passed to it. e.g. if N=123 then it returns 6. (1+2+3=6)
5. a. Explain the term degree and cardinality. Also give suitable example. 2
b. Find out the DDL & DML commands from the following: 2
CREATE TABLE, INSERT INTO, DELETE, ALTER TABLE
c. Consider a table Employee(EmpCode, Name, Dept, Aadhar, Desig). Find out the candidate 1
keys and alternate keys.
d. Which command is used to delete a table. 1
e. Write a output for SQL queries (i) to (iii), which are based on the table: STUDENT 5
Table : STUDENT

i) SELECT GENDER, COUNT(*) FROM STUDENT GROUP BY GENDER;


ii) SELECT MAX(DOB), MIN(DOB) FROM STUDENT WHERE CLASS IN(‘X’,’XII’);
iii)SELECT MAX(MARKS) FROM STUDENT GROUP BY CLASS;
iv) SELECT COUNT(DISTINCT CITY) FROM STUDENT;
v) SELECT NAME FROM STUDENT WHERE CLASS=’XII’ ORDER BY DOB;
f. Write the SQL commands for the following considering the above table: 9
i) To display the names of students from Agra and Mumbai.
ii) To display the details of students born in the year 1995.
iii)To display the average marks of each class.
iv) To display the name and class of those students whose names ends with ‘a’.
v) To display the number of students from each city.
vi) To display the names and marks of all students from Topper to lowest marks.
vii) To change the name of Nanda to Nandu.
viii) To remove the record of Neha.
ix) To add a new column named email of type varchar(30).

Page:2

You might also like