0% found this document useful (0 votes)
51 views6 pages

One Mark Sep 2023

Amandeep, Avisha, Arun, Amber, Ela, Arluna TABLE: COURSES C_ID COURSE_NAME FEES A01 BCA 30000 A02 BBA 25000 A03 B.Sc(CS) 30000 A04 B.Sc(Maths) 25000 A05 B.Sc(Bio) 40000 (a) To display NAME and COURSE_NAME of all applicants from APPLICANTS and COURSES tables. (b) To display NAME, GENDER, JOINYEAR of applicants whose FEE is 30000 from APPLICANTS

Uploaded by

aveneetexams
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)
51 views6 pages

One Mark Sep 2023

Amandeep, Avisha, Arun, Amber, Ela, Arluna TABLE: COURSES C_ID COURSE_NAME FEES A01 BCA 30000 A02 BBA 25000 A03 B.Sc(CS) 30000 A04 B.Sc(Maths) 25000 A05 B.Sc(Bio) 40000 (a) To display NAME and COURSE_NAME of all applicants from APPLICANTS and COURSES tables. (b) To display NAME, GENDER, JOINYEAR of applicants whose FEE is 30000 from APPLICANTS

Uploaded by

aveneetexams
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/ 6

AumAmriteswaryaiNamah

Amrita Vidyalayam Senior Secondary School -Ettimadai


Monthly Examination IV - September- 2023
Class : XII B Marks : 50
Name/Roll No. ____________ Duration:1 ½ hrs
COMPUTER SCIENCE
(One Mark Test)
Answer the following:
1.Consider the table given below:
Table:MOVIEDETAILS: (4)
MOVIEID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 MGRMagan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the English 4 PrimeVideo
Chamber of Secrets
M015 Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotstar
(a) Identify the degree and cardinality of the table._________________________
(b) Which field should be made the primary key? _______________________________
(c) Identify the candidate key(s)from the table MOVIEDETAILS.____________________
(d) ConsiderthetableSCHEDULEgivenbelow:
Table:SCHEDULE
SLOTID MOVIEID TIMESLOT
S001 M010 10AMto 12PM
S002 M020 2PMto 5PM
S003 M010 6PMto 8PM
S004 M011 9PMto11PM
Which field will be considered as the foreign key if the tables MOVIEDETAILS and
SCHEDULE are related in a database? ________________________________
ASSERTION AND REASONING based questions(2 and 3).Mark the correct choice as (2)
a) Both Aand 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 isTrue
2.Assertion(A):Using append(),many elements can be added at a time.
Reason(R):For adding more than one element, extend() method can be used.___________________
3.Assertion(A): If a file is opened using the “with” statement, you get better syntax and exceptions
handling.
Reason(R): When a file is opened using the “with” statement, it need not be closed using the
close() function. ______________________
4.A result set is extracted from the database using the cursor object (that has been already created)
by giving the following statement. (2)
Mydata=cursor.fetchmany(4 )
a) How many records will be returned by the above statement?____________________
b) What will be the data type of Mydata object after the given command is executed?
____________________ .
5.Choose the impossible output from the given options on successful execution of the following
code: (2)
import random
sub=["CS","Maths","Phy","Chem","Eng"]
for i in range(5):
y = random.randint(1,4)
print(sub[y],end="@")

(a) Phy@Chem@Eng@Phy@ (b) CS@Chem@Eng@Phy@


(c) Phy@Chem@Eng@Eng@ (d) Chem@Chem@Phy@Phy@
6.What is the output of the following code? (1)
a=10
b=20
def change():
global b
a=45
b=56
change()
print(a)
print(b)
a)10 and 56 b)45 and 56
c)10 and 20 d)55 and 75
7.What is the output of the following code? (2)
def power(x, y=2):
r=1
for i in range(y):
r=r*x
return r
print (power(3))
print (power(3, 3))
a) 212 and 32 b) 9 and 27
c) 567 and 98 d) 13 and 90
8.What will be the output of the following code segment? (1)
myList = [1,2,3,4,5,6,7,8,9,10]
newList=[]
for i in range(0,len(myList)):
if i%2 == 0:
newList.append(myList[i])
print(newList)
a. [1,3,5,7,9] b. [1,3,5,7] c. [] d. [1,2,3,4,5,6,7,8,9,10]
9. What will the following expression be evaluated to in Python? (2)
print(15.0*10 / 4 + (8 + 3.0)//2+15)
a.56.5 b.56 c. 57.5 d.57
10. Predict the output: (2)
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("Computer Science2024 Exam")
a.COMPUTER#SCIENCE0000#EXAM b.Computer#SCIENCE0000#EXAM
c.COMPUTER#SCIENCE0000#Exam d.COMPUTER#Science0000#EXAM
11.Given is a Python string declaration: (2)
myexam="@@CBSE Examination 2024@@"
Write the output of:
print(myexam[::-2])
a.20 otnmx SC@ b.@20 otnmx SC@ c.@40 otnmx SC@ d.20 otnmx SC
12. Write the output of the code given below: (2)
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
a.dict_items b. dict_items([('name') ('age') ('address')])
c.dict_items([( 'Aman'), ('27), ('Delhi')]) d.dict_items([('name', 'Aman'), ('age', 27), ('address',
'Delhi')])
13.Which of the following function headers is correct? (1)
a) def fun(a = 5, b =4, c)
b) def fun(a = 5, b, c =4)
c) def fun(a, b = 5, c = 4)
d)def fun(a, b, c = 4, d)
14.Which method of pickle module is used to write onto a binary file? (1)
a)load b)dump c)pickle d)cvs
15.A Student's windows O/S got corrupted. He is trying to access his files through Command
Prompt, but unable to find out all his Binary data files pertaining to his project. Help him to find
out all his binary data files by suggesting the suitable extension name among the following.
a) .txt b) .bin c).dat d) .com (1)
16.What is the default mode when the file is opened using the open() method ? (1)
a) Write
b) Read
c) Write and read
d) Read and write
17.The text file stu.txt contains (1)
“My country is best in the world. I am a proud of it.I love my country.”
What will be the output of the following code?
myfile = open("C:\\Users\\Admin\\Documents\\stu.txt")
str = myfile.readlines()
lcount = len(str)
print(lcount)
myfile.close()
a. 1 b.2 c. 3 d.4
18.Which keyword is used to declare a function? (1)
a) Fun b) Define c) def d) Function
19.Consider the following directory structure. (1)
Suppose root directory (School) and present working directory are the same. What will be the
absolute path of the file Achievements.jpg?
a. School/Achievements.jpg
b. School/Sports/Achievements.jpg
c. School/Sports/../Achievements.jpg
d. School/Examination/Achievements.jpg
20.Dinesh is trying to read a list L1 from a binary file ‘num’. Consider the following code written
by him. (1)
import pickle
f1 = open("num",'rb')
L1=__________________#Statement 1
print(L1)
f1.close()
Identify the missing code in Statement 1.
(a) pickle.load(f1) (b) pickle.load(L1,f1) (c) pickle.read(f1) (d) pickle.dump(L1,f1)
22.Consider the following tables CUSTOMER and ONLINESHOP.
Write SQL commands for the statements (a) to (d). (4)
TABLE: CUSTOMER
CID CNAME GENDER SID AREA
1001 R SHARMA FEMALE 101 NORTH
1002 M R TIWARY MALE 102 SOUTH
1003 M K KHAN MALE 103 EAST
1004 A K SINGH MALE 102 EAST
1005 S SEN FEMALE 101 WEST
1006 R DUBEY MALE 104 NORTH
1007 M AGARWAL FEMALE 104 NORTH
1008 S DAS FEMALE 103 SOUTH
1009 R K PATIL MALE 102 NORTH
1010 N KRISHNA MURTY MALE 102 SOUTH

(a) To display CNAME, AREA of all female customers from CUSTOMER table.

(b) To display the details of all the CUSTOMERS in ascending order of CNAME

(c) To display the total number of customers for each AREA from CUSTOMER table.

(d) To display CNAME and corresponding SHOP from CUSTOMER table and ONLINESHOP
table.

23.How will you change the file pointer position to an offset value from the beginning position?

a) file pointer.seek(offset, 0) b) file pointer.seek(offset, 1) (1)


c) file pointer.seek(offset, 2) d) none of the mentioned
24.Write SQL queries for (a) to (c) and write the outputs for (d) and (e) on the basis of tables
APPLICANTS and COURSES. (5)
TABLE: APPLICANTS
No NAME FEE GENDER C_ID JOINYEAR
1012 Amandeep 30000 M A01 2012
1102 Avisha 25000 F A02 2009
1049 Arun 30000 M A03 2009
1025 Amber 40000 M A02 2011
1106 Ela 40000 F A05 2010
1108 Arluna 30000 F A03 2012
2109 Shakti 35000 M A04 2011
TABLE: COURSES
C_ID COURSES
A01 FASHION DESIGN
A02 NETWORKING
A03 HOTEL MANAGEMENT
A04 EVENT MANAGEMENT
A05 OFFICE MANAGEMENT

(a) To display NAME, FEE, Gender, JOINYEAR about the APPLICANTS, who have
joined before 2010.

(b)To delete the column GENDER from the table APPLICANTS.

(c) To display the year and the total number of applicants joined in each year from the table
APPLICANTS.

(d) SELECT SUM(FEE), C_ID FROM APPLICANTS GROUP BY C_ID HAVING


COUNT(*)=2;

(e) SELECT NAME , COURSES FROM APPLICANTS, COURSES WHERE


APPLICANTS.C_ID=COURSES.C_ID;

25.The code given below reads records from the table named Vehicle and displays only those
records which have model lasser than 2010.The structure of a record of table Vehicle is: (3)
V_ID–integer; Name–string; Model –integer; Price–integer
Note the following to establish connectivity between Python and MYSQL:
 Username is root
 Password is abc
 The table exists in a MYSQL database named Transport.
 The details(RollNo,Name,ClasandMarks)are to be accepted from the user.
Write the following missing statements to complete the code:
Statement1–to create the cursor object
Statement2–to execute the query that extracts records of those vehicles whose model
is greater than 2010.
Statement3-to read the complete result of the query in to the object named data.
import mysql.connector as mysql
def display():
con1=mysql.connect(host="localhost",user="root",password="abc",database="Transport")
#Statement 1print("Students with marks
greater than 75 are : ")q="Select*fromvehiclewheremodel>2010"
#Statement2
data= #Statement3
for rec in data:
print(rec)
26.Fill in the blank: (1)
command is used to remove a column from a table in SQL.
a)update b) remove c)alter d)drop
27.Which of the following is an invalid identifier? (1)

a)For b)while c)Day1 d)First_Name


28.Identify the relational operator from the following options. (1)

a)== b)!= c)Only b d) Both a and b


29.Fill in the blank: (1)
An alternate key is a ,which is not the primary key of the table.
a)Primary Key b)Foreign Key c)Candidate Key d)Alternate Key
30.Which protocol is used for transferring files over aTCP/IP network? (1)
a) FTP b)SMTP c)PPP d)HTTP
31.In context to Python-Data base connectivity, the function fetchmany()is a method of which
object? (1)
a)connection b)database c)cursor d)query
32.Consider the following table:
Table:Employee
+ + + + + + +
|EID|Name |DOB |DOJ |Salary|Project|
+ + + + + + +
|E01|Ranjan |1990-07-12|2015-01-21|150000|P01 |
|E02|Akhtar |1992-06-21|2015-02-01|125000|P04 |
|E03|Muneera|1996-11-15|2018-08-19|135000|P01 |
|E04|Alex |1991-10-25|2018-10-19|75000|P02 |
|E05|Satyansh|1993-12-16|2018-10-19|85000|P04 |
+ + + + + + +
i.select name, project from employee order by project; (4)

ii.selectname,salaryfromemployeewheredojlike'2015%';

iii.select name, salary from employee where salarybetween100000and200000;

iv.selectmin(doj),max(dob)fromemployee;

You might also like