SlideShare a Scribd company logo
4
Most read
5
Most read
15
Most read
1
Ans.
2
3
4
Ans.
5
Ans.
6
Giventhe lists L=(1,3,6,82,5,7,11,92], writethe output of print(L[2:5])
Ans.|6,82,5)
Ans.
Select the most appropriate option out of the options given for each question. Attempt any
15 questions from question no 1to 21.
Ans. Comma Separated Value
Findthe invalididentifier fromthe following
a) MyName
b) True c) 2ndName
b) True
Write thefullform of CSV.
c) **
a) ?
Part-A
Section-l
Identifythe valid arithmetic operator in Python from the following.
b) < c) **
a) print(T[1])
b) T[2] =-29
c) 2ndName d) My_Name
c) print(max(T))
d) print(len(T)
Suppose atuple Tis declared as T= (10, 12, 43,39), which ofthefollowing is incorrect?
b) T[2]- -29 (as tuple is immutable)
d) and
Write astatement in Python to declare a dictionary whose keys are 1, 2, 3and values are
Monday, Tuesday and Wednesdayrespectively.
Day={1:'monday,2:"tuesday,3:'wednesday}
1
1
1
1
1
1
7
Ans,
Ans.
10
Ans.
|Ans.
12
|Ans.
|Ans. SMTP
13
|Ans.
14
|Ans.
15
Ans.
16
Ans.
17
|Ans.
| 18
Ans.
19
|Ans.
20
Ans.
21
A
tuple is declared as
Ans.
What will be the value ofsum(T)?
30
Namethe built-in mathematicalfunction / methodthat is used to return anabsolute value of
a number.
fabs()
T= (2,5,6,9,8)
Namethe protocolthatis used tosend emails.
Your friend Ranjana complaints that somebody has created afake profile
on Facebook and
Cyber Stalking
InSQL, name the clause that is used to displaythetuplesinascendingorderofan attribute.
ORDER BY
In SQL, what isthe use ofISNULLoperator?
To check ifthe column has null value/ no value
Write any oneaggregatefunction usedin SQL.
SUM / AVG COUNT MAX/ MIN
Which of the followingis aDDL Command?
a) SELECT b) ALTER c) INSERT
b) ALTER
Name The transmission media bestsuitable for connectingto hilly areas.
Microwave / Radio wave
Identify the valid declaration of L:
d. list
L= ['Mon', 23', 'hello', '60.5]
a. dictionary b. string
print(name[3:10])
puterSc
Ifthe following code is executed, what willbe the output ofthe following code?
name="ComputerSciencewithPython"
SHOW TABLES
Write the expanded form ofWi-Fi.
In SQL, writethe querytodisplay thelist oftables storedina database.
Wireless Fidelity
a) Unique
d) UPDATE
b) Distinct
Which ofthe following types oftableconstraintswill prevent the entry ofduplicate
rows?
c) Primary Key
d) NULL
c) Primary Key
c.tuple d. list
Gbps, Mbps, Tbps, Kbps, bps
Bps, Kbps, Mbps, Gbps, Tbps
Rearrange the following terms in increasing order ofdata transfer rates.
1
1
1
1
1
HHHEHHH 1
1
1
1
1
1
1
1
defaming her character with abusive comments and pictures. ldentify the type ofcybercrime
for these situations.
22
Both the Case study based questions are compulsory. Attempt any 4 sub partsfrom each
question. Each question carries 1 mark
Adepartmental store MyStore considering maintaining their inventory using SQL to store
the data. As adatabase administer, Abhay has decided that:
2005
Table: STORE
2003
ItemNo
2002
2006
2001
Name of the database - mystore
2004
Name ofthe table - STORE
2009
The attributes ofSTORE are as follows: ItemNo -numeric
ItemName - character ofsize 20 Scode - numneric
Quantity - numeric
ItemName
Sharpener Classic
Ball Pen 0.25
Get Pen Premium
Get Pen Classic
Eraser Small
Eraser Big
Ball Pen 0.5
same.
ANSWERS:
a) DELETE FROM store;
Section -I|
b) DROP TABLE store;
|Scode Quantity
c) DROP DATABASE mystore;
d) DELETE store from mystore;
23 60
22
a) ItemNo
21
21
a) Identify the attribute best suitable to be declared as aprimary key.
b) Degree =4 and Cardinality=7
22
b) Write the Degree and Cardinality ofthe table STORE
d) DROPTABLE store
22
c) Insert the following data into the attributes ItemNo, ItemNameand SCode respectively in
the given table STORE.
21
ItemNo =2010, ItemName="Note Book' and Scode =25
e) DESCRIBE store OR DESC store
50
d) Abhay want to remove the table STORE from the datababase MyStore.
150
Which command will he use from the following:
250
220
110
180
e) Now Abhay wants to display the structure of the table STORE, i.e. name of the attributes
and their respective data types that he has used in the table. Write the query to display the
c) INSERT INTO store (ItemNo,ItemName,Scode) VALUES(2010, "Note Book', 25);
23 Ranjan Kumar of cass 12 is writing a program to create a CSV file "user.csv" which will
contain user name and password for some entries. He has written the following code. As a
programmer, help him tosuccessfullyexecute the given task.
import
def addCsvFile(UserName,PassWord): #to wite /add data into the CSV file
f-open( user.csv_)
#csv file reading code
newfileWriter =csv.writer(f)
newFileWriter.writerow([UserName, PassWord]) f.close()
def readCsvFile():
with open(' user.csv.r) as newfile:
newFileReader = Csv.
newFileReader:
newFile.
Answers:
#Line 2
print (row(0].row[I])
addCsvFile("Arjun"."123@456")
addCsvFile("Arunima","aru@nima")
addCsvFile("Frieda","myname@FRD")
# Line 1
(a) Name the module he should import in Line 1.
a) csv
e)
b) "a"
(b) In which mode, Ranjan should open the file to add data into the file
(c) Fillin the blankinLine 3to read the data froma csv file.
# to read data from CSV file
(d) Fill in the blankin Line 4to close the file.
c) reader
(e) Write the output he willobtain while executing Line 5.
d) close(0
# Line 4
Arjun 123@456
L(newFile)
Arunima aru@nima
Frieda myname@FRD
# Line 3 for row in
24
Ans.
25
Ans.
26
Ans.
27
Ans.
Evaluate the following expressions:
a) 6*3+ 4*2 |/5 -8
b) 10 >5 and 7 >12 or not 18 >3
a) 13
b) False
Differentiate between Viruses and Worms in context of networking and data communication
threats.
OR
Differentiate between Web server and web browser Write any two popular web browsers.
Viruses require an active host program or an already-infected and active operating
system in order for viruses to run, cause damage and infect other executable files or
documents. Worms are stand-alone malicious programs that can self-replicate.
Web Browser: A web browser isa software application for accessing information on the
World Wide Web. When a user requests a web page from a particular website, the web
browser retrieves the necessary content from a web server and then displays the page on
the user's device.
a. SMTP
Web Server: A web server is a computer that runs websites. The basic objective of the
web server is to store, process and deliver web pages to the users. This
intercommunication is done using Hypertext Transfer Protocol (HTTP).
Popular web browsers : Google Chrome, Mozilla Firefox, Internet Explorer etc.
Expand the following terms:
c. LAN
a) SMTP - Simple Mail Transfer Protocol
b) XML - eXtensible Markup Language
c) LAN - Local Area Network
d) IPR- Intellectual Property Rights
b. XML
Example:
def area(side):
PART - B
SECTION-I
Differentiate between actual parameter(s) and a formal parameter(s) with asuitable
example for each.
return side*side;
print(area(5))
OR
Explaintheuse ofglobal keyword used in afunction withthe helpof asuitable example.
The list of identifiers used in a function call is called actual parameter(s) whereas the
list of parameters used in the function definition is called formal parameter(s).
Actual parameter may be value /variable or expression. Formal parameter is an
identifier.
OR
line
# line 2
1
d. IPR
OR
In line l, side is the formal parameter and in line 2, while invoking area) function, the
value 5 is the actual parameter.
A formal parameter, i.e. a parameter, is in the function definition. An actual parameter,
i.e. an argument, is in a function call.
2
2
2
28
Ans.
29
Use of global key word:
In Python, global keyword allows the programmer to modify the variable outside the
current scope. It is used to create a global variable and make changes to the variable in
local context. A variable declared inside a function is by default local and a variable
declared outside the function is global by default. The keyword global is written inside
the function to use its global value. Outside the function, global keyword has no effect.
Example
c= 10 # global variable
def add0:
global c
c=c+2 # global value of cis incremented by 2
print('Inside add):", c)
add)
c=15
print('In main:", c)
output:
Inside add) : 12
In main: 15
Rewrite thefollowing code in Python after removingallsyntaxerror(s). Underline each
correction done in the code.
Value=30
for VAL in range(0,Value)
Ifval%4==0:
print (VAL*4)
Elseif val%5==0:
else
Value-30
print (VAL+3)
CORRECTED CODE:
print(VAL+10)
for VAL in range(0,Value) :
if val%4==0:
print (VAL*4)
elif val%5==0:
else:
print (VAL+3)
print(VAL+10)
# Error 1
# Error 2
# Error 3
# Error 4
What possible outputs(s) are expected to be displayed on screen at the time ofexecution of
the program from the following code? Alsospecify the maximum values that can be assigned
2
2
Ans.
30
Ans.
31
Ans.
to each ofthe variables Lowerand Upper.
import random
AR=[20,30,40,50,60,70):
Lower =random.randint(1,3)
Upper =random.randint(2,4)
for Kin range(Lower, Upper +1):
print (AR[K]J,end="#*")
()10#40#70# (ü) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#
OUTPUT: (ii)
Maximum value of Lower:3
Maximum value of Upper: 4
What do you understand byCandidate Keys in a table? Give asuitable example ofCandidate
Keys froma table containing some meaningful data.
Atable may have more than one such attribute/group of attributes that identifies a tuple
uniquely, all such attribute(s) areknown as Candidate
Ino
101
I02
04
I09
Item
Pen
Pencil
CD
Eraser
Duster
Qtyl
500
Example: fetchone()
700
500
In the above table Item, ItemNo can be a candidate key
700
300|
Differentiate between fetchone0and fetchal) methods with suitable examples for each
fetchall) fetches all the rows of a query result. An empty list is returned if there is no
record to fetch the cursor.
fetchone) method returns one row or a single record at a time. It will return None if no
more rows records are available.
200
else:
eno =int(input("Enter employee Number :")
query="select *from emp where empno=".format(eno)
if row!=None:
mycur.execute(query)
Example: fetchall()
row = mycur.fetchone)
print("'Name :",row|1])
print("Department :",row|2)
print("Salary :",row|3)
print(nEmployee Number not found")
query="select *from emp"
mycur.execute(query)
rows = mycur.fetchall):
for row in rows;
print('Name :",row|1)
print("Department"row|2)
2
2
32
Ans.
33
34
Ans.
35
Write the full forms ofDDL and DML.Write any two commands of DMLin SQL.
DDL- Data Definition Language
DML - Data Manipulation Language
Any two out of INSERT, DELETE, UPDATE
Find and writethe output ofthefollowingPython code:
def Display(str): m="n
for i in range(0,len(str)):
if(str[i],isupper)):
m=m+stri].lower0
elifstr[i].islower):
else:
print(m)
if i%2==0:
Ans. OUTPUT :fUNnpYTHON
Display(Fun@Python3.0)
Output
print("Salary :",row[3])
Write afunction LShift(Arr,n) in Python, which accepts alistArr ofnumbers and nis anumeric
value by which all elements ofthe list are shifted to left.
Sample Input Data ofthe listArr= [10,20,30,40,12,11], n==2
L=len(Arr)
m=m+str).upper)
Arr=[30,40,12,11,10,20]
def LShit(ArT,n):
y=Arf0]
m=m+str[i-1]else:
m=m+"#"
for xin range(0,n)
Arr[L-1Fy
for iin range(0.L-1))
Arl-Afi+1]
print(Arr)
Note :Usingofany correctcodegivingthesameresuitisalsoaccepted.
SECTION- II
Write afunction in Python that countsthe number of"Me" or"My' words presentinatext
file "STORY.TXT". Ifthe "STORY.TXT" contents are as follows:
Example:
My first bookwas Me and My Family. It gave me chance to be Known to the world.
The output of the function should be:
Countof Me/My in file:4
A or a:4
Mor m:2
Write a function AMCount) in Python, which should read each character of a text fle
STORY.TXT, should count and display the occurrence of alphabets Aand M(including
small casesaand mtoo).
OR
Ifthe file content is as follows: Updated information As simplified by oficialwebsites.
The EUCount() function should display the output as:
2
3
Ans.
36
Ans.
def displayMeMy():
num=O
f=open("story.txt"."t)
N=f.read()
M=N.split()
forx in M:
if x="Me" or x== "My":
print(x)
num=num+1
f.close()
print("Count of Me/My In file:".num)
t=open("story.txt")
A,M=0,0
r=f.read()
for x In -
if x[0]=="A"orx[o]=="a":
A=A+1
elif x[0)j=="M"or x[O]=="m":
M=M+1
f.ciose()
print("Aor a: "A)
print("M or m: ".M)
Write the outputsoftheSQLqueries () to (i) basedonthe relations Teacher and Posting
g0ven below:
Table:Teacher
T_ID Name Age Department Date_ofjoin
1|Jugal
2 Sharmila 31
3 Sandeep 32
4| Sangeeta 35S
5 Rakesh 42
6 Shyam
7 Shiv Om
34
8 Shalakha 33
50
Department
44
History
Computer Sc
Mathematics
Computer Sc
History
Mathematics
History
3
Mathematics
History
Computer Sc
OR
Mathematics
Salary Gender
Count())
10/01/2017 12000M
24/03/2008 20000 F
i. SELECT Department, count(") FROM Teacher GROUP BY Department;
12/12/2016 30000 M
. SELECT Max(Date_of Join),Min(Date_of
01/07/2015 40000F
i. SELECT Teacher.name, Teacher.Department,Posting.Place FROMTeachr, Posting
WHERE Teacher.Department =Posting.Department AND Posting. Place="Delhi";:
05/09/2007 25000|M
27/06/2008 30000 M
25/02/2017 21000| M
31/07/2018 20000| F
3
Join) FROMTeacher;
37
Ans.
38
ii
ii.
name
Max -31/07/2018 or2018-07-31
OR
Jugal
s=ll
Shiv Om
def PUSH(Arr):
WriteafunctioninPython PUSH(Arr), where Arris alist ofnumbers. From this list push all
numbers divisible by 5into astack implemented byusingalist. Display the stack ifit has at
least one element, otherwise display appropriate error message.
Write afunction in Python POP(Arr), where Arr is astack implemented by alistofnumbers.
The function returns the value deletedfromthestack.
for x in range(0,len(Arr)):
if len(s)==0:
else:
Law
Block
if Arr[x]%5==0:
def popStack{st) :
else:
print(s)
Department
# If stack is empty
if len(st)==0:
print('Empty Stack")
Computer Sc Delhi
Computer Sc Delhi
s.append(Arr[x)
print("Underflow")
return val
Business
Block
Place
OR
val=st.pop) #pop) willdelete most recent element i.e. TOP element.
print(val)
Min- 05/09/2007 or 2007-09-05
Technology
Block
MyPace Universityis setting up its academic blocks at Naya Raipur and is planningtosetupa
network. The University has 3academic blocks and one Human Resource Centeras shown in
the diagram below:
SECTION - II
HR
Center
Center to Center distances between various blocks/center is as follows:
3
5
Ans
Law BIock to business Biock
Law blockto Technology Block| 80m
Law Block to HR center
BusinesS Block to technology
Block
b
Business Blockto HR Center
Technologyblockto HR center
Law Block
Law
Block
Technology Block
HR center
c) Switch
Number of computersineach of the blocks/Centerisasfollows:
Business Block
University with a suitable reason.
15
40
115
40m
25
a) Suggest the most suitable place (Le, Block/Center) to installtheserverofthis
105m
b) Suggest an ideal layoutfor connecting these blocks/centersfor a wired connectivity.
Business
30m
c) Which device willyou suggest to be placed/installed in each ofthese blocks/centers
Block
35m
15m
to efficiently connect all the computers within these blocks/centers.
d) Suggest the placement ofa Repeater in the network with justification.
e) The university is planning to connectits admission office in Delhi, which is more than
1250km from university. Which typeofnetworkout ofLAN, MAN, orWAN will be
formed? Justify your answer.
a) Most suitable place to install the server is HR center, as this center has maximum
number of computers.
Technology
Block
HR
Center
d) Repeater may be placed when the distance between 2 buildings is more than 70
meter.
e) WAN, as the given distance is more than the range of LAN and MAN.
39
Ans.
Write SQL commands for the following queries (i) to (v) based on the
relations Teacher and Posting given below:
Table :Teacher
T_IDName
1
2
3
4
5
6
7
8
i)
ii)
iii)
iv)
v)
Jugal 34
Sharmila 31
Age Department Date_of join
Sandeep 32
Sangeeta 35
Shyam
Rakesh 42
50
Shiv Om 44
Shalakha 33
P_ID
1
3
Computer
Sc
History
Mathematics 12/12/2016
History 01/07/2015
Mathematics 05/09/2007
History
Computer
Table : Posting
Sc
10/01/2017
Department
24/03/2008
History
Mathematics 31/07/2018
Mathematics
27/06/2008
25/02/2017
Computer Science
Place
Agra
Raipur
Delhi
Salary
12000
20000
i. SELECT *FROM teacher WHERE department= "History";
40000
i., SELECT name FROM teacher ORDER BY date_of_join;
30000 M
To show all information about the teacher of History department.
V. SELECT name, salary*0.1 AS Bonus FROM teacher;
Gender
M
25000 M
To display teacher's name, salary, age for male teachers only.
F
30000 M
To display name, bonus for each teacher where bonus is 10% ofsalary.
21000 M
To list the names offemale teachers who are in Mathematics department.
F
20000 F
To list the namesofall teacherswith theirdateofjoining in ascending order.
iv. SELECT name, salary, age FROM teacher WHERE gender=M;
i. SELECT name FROM teacher WHERE department= "Mathematics" AND gender="F";
5
40
A binary file "Book.dat" has structure [BookNo, Book_Name, Author, Price].
i. Write a user defined function CreateFile() to input data for a
i. Write a function CountRec(Author) in Python which accepts the
Author name as parameter and count and return number of
books by the given Author are stored in the binary fle
"Book.dat"
createFile):
A binary file "STUDENT.DAT" has structure (admission_number, Name,
Percentage). Write a function countrec) in Python that would read contents
of the file "STUDENT.DAT" and display the details of those students whose
percentage is above 75. Also display number of students scoring above 75%
Ans. import pickle def
record and add to Book.dat.
fobj=open('Book.dat","ab")
BookNo=int(input('Book Number: ")
Book_name=input("Name :")
Author = input("Author: ")
Price =int(input("Price : ")
rec=(BookNo,Book_Name,Author, Price]
pickle.dump(rec,fobj)
fobj.close)
def CountRec(Author):
try:
fobj=open('Book.dat","rb')nu 0
while True:
rec=pickle.load(fobj)
if Author==rec(2]:
except:
num = num+ 1
fobj.close)
return num
OR
5
40
Ans.
Abinary file "Book.dat" has structure [BookNo, Book_Name, Author, Price].
. Write a user defined function CreateFlle() to input data for a
record and add to Book.dat.
i. Write a function CountRec(Author) in Python which accepts the
Author name as parameter and count and return number of
books by the given Author are stored in the binary file
"Book.dat"
Abinary file "STUDENT.DAT" has structure (admission_number, Name,
Percentage). Write a function countrec() in Python that would read contents
of the file "STUDENT.DAT" and display the details of those students whose
percentage is above 75. Also display number of students scoring above 75%
import pickle def
createFile():
fobj=open(Book.dat","'ab")
BookNo=int(input("Book Number : ")
Book_name=input("Name :")
Author =input("Author: ")
Price =int(input(Price : ")
rec-[BookNo, Book_ Name,Author,Pricel
pickle.dump(rec,fobj)
fobj.close)
def CountRec(Author):
fobj-open(Book.dat","rb') nu- 0
try:
while True:
rec=pickle.load(fobj)
ifAuthor==rec(2:
except:
num = num + 1
OR
fobj.close)
return num
S
OR
import pickle def
CountRec:
fobj=open("STUDENT.DAT""rb")
num =0
try:
while True:
rec-pickle .load(fobj)
if rec(2] > 75:
except:
fobj.close)
return num
print(rec(0],rec|1],rec(2],sep="t")
num = num +1

More Related Content

Similar to Class 12 computer sample paper with answers (20)

PDF
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
AntarikshGarg
 
PDF
Computer science sqp
Prasanth566435
 
DOCX
Sample-Program-file-with-output-and-index.docx
hariharasudan456
 
PPTX
Functions in python
Santosh Verma
 
PPTX
FUNCTIONS.pptx
KalashJain27
 
PDF
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ravita44554455
 
PDF
GE3151 UNIT II Study material .pdf
Guru Nanak Technical Institutions
 
PDF
Python-Institute.realtests.PCAP.v20q.pdf
ssuser22b701
 
PDF
2023 9b09kvuofjfouijfd8bifjbuiofjdfoivbjdogbj
seshuashwin0829
 
PDF
XII CS QUESTION BANK FOR BRIGHT STUDENTS CHAPTER WISE SET-II.pdf
kvfwteachers
 
PDF
class 12 computer science pdf of class e
rajadityaasingh22
 
PPTX
PYTHON PPT.pptx python is very useful for day to day life
NaitikSingh33
 
DOCX
information practices cbse based paper.docx
KapilSidhpuria3
 
PPT
PE1 Module 4.ppt
balewayalew
 
PDF
Python - Lecture 2
Ravi Kiran Khareedi
 
PDF
Advanced Web Technology ass.pdf
simenehanmut
 
PPTX
Python Session - 2
AnirudhaGaikwad4
 
PPTX
04. WORKING WITH FUNCTIONS-2 (1).pptx
Manas40552
 
PPTX
An Introduction : Python
Raghu Kumar
 
PDF
CS_PQMS.pdf
justforwatching72
 
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
AntarikshGarg
 
Computer science sqp
Prasanth566435
 
Sample-Program-file-with-output-and-index.docx
hariharasudan456
 
Functions in python
Santosh Verma
 
FUNCTIONS.pptx
KalashJain27
 
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ravita44554455
 
GE3151 UNIT II Study material .pdf
Guru Nanak Technical Institutions
 
Python-Institute.realtests.PCAP.v20q.pdf
ssuser22b701
 
2023 9b09kvuofjfouijfd8bifjbuiofjdfoivbjdogbj
seshuashwin0829
 
XII CS QUESTION BANK FOR BRIGHT STUDENTS CHAPTER WISE SET-II.pdf
kvfwteachers
 
class 12 computer science pdf of class e
rajadityaasingh22
 
PYTHON PPT.pptx python is very useful for day to day life
NaitikSingh33
 
information practices cbse based paper.docx
KapilSidhpuria3
 
PE1 Module 4.ppt
balewayalew
 
Python - Lecture 2
Ravi Kiran Khareedi
 
Advanced Web Technology ass.pdf
simenehanmut
 
Python Session - 2
AnirudhaGaikwad4
 
04. WORKING WITH FUNCTIONS-2 (1).pptx
Manas40552
 
An Introduction : Python
Raghu Kumar
 
CS_PQMS.pdf
justforwatching72
 

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Learn Computer Forensics, Second Edition
AnuraShantha7
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
Q2 Leading a Tableau User Group - Onboarding
lward7
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
July Patch Tuesday
Ivanti
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Learn Computer Forensics, Second Edition
AnuraShantha7
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Q2 Leading a Tableau User Group - Onboarding
lward7
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Ad

Class 12 computer sample paper with answers

  • 1. 1 Ans. 2 3 4 Ans. 5 Ans. 6 Giventhe lists L=(1,3,6,82,5,7,11,92], writethe output of print(L[2:5]) Ans.|6,82,5) Ans. Select the most appropriate option out of the options given for each question. Attempt any 15 questions from question no 1to 21. Ans. Comma Separated Value Findthe invalididentifier fromthe following a) MyName b) True c) 2ndName b) True Write thefullform of CSV. c) ** a) ? Part-A Section-l Identifythe valid arithmetic operator in Python from the following. b) < c) ** a) print(T[1]) b) T[2] =-29 c) 2ndName d) My_Name c) print(max(T)) d) print(len(T) Suppose atuple Tis declared as T= (10, 12, 43,39), which ofthefollowing is incorrect? b) T[2]- -29 (as tuple is immutable) d) and Write astatement in Python to declare a dictionary whose keys are 1, 2, 3and values are Monday, Tuesday and Wednesdayrespectively. Day={1:'monday,2:"tuesday,3:'wednesday} 1 1 1 1 1 1
  • 2. 7 Ans, Ans. 10 Ans. |Ans. 12 |Ans. |Ans. SMTP 13 |Ans. 14 |Ans. 15 Ans. 16 Ans. 17 |Ans. | 18 Ans. 19 |Ans. 20 Ans. 21 A tuple is declared as Ans. What will be the value ofsum(T)? 30 Namethe built-in mathematicalfunction / methodthat is used to return anabsolute value of a number. fabs() T= (2,5,6,9,8) Namethe protocolthatis used tosend emails. Your friend Ranjana complaints that somebody has created afake profile on Facebook and Cyber Stalking InSQL, name the clause that is used to displaythetuplesinascendingorderofan attribute. ORDER BY In SQL, what isthe use ofISNULLoperator? To check ifthe column has null value/ no value Write any oneaggregatefunction usedin SQL. SUM / AVG COUNT MAX/ MIN Which of the followingis aDDL Command? a) SELECT b) ALTER c) INSERT b) ALTER Name The transmission media bestsuitable for connectingto hilly areas. Microwave / Radio wave Identify the valid declaration of L: d. list L= ['Mon', 23', 'hello', '60.5] a. dictionary b. string print(name[3:10]) puterSc Ifthe following code is executed, what willbe the output ofthe following code? name="ComputerSciencewithPython" SHOW TABLES Write the expanded form ofWi-Fi. In SQL, writethe querytodisplay thelist oftables storedina database. Wireless Fidelity a) Unique d) UPDATE b) Distinct Which ofthe following types oftableconstraintswill prevent the entry ofduplicate rows? c) Primary Key d) NULL c) Primary Key c.tuple d. list Gbps, Mbps, Tbps, Kbps, bps Bps, Kbps, Mbps, Gbps, Tbps Rearrange the following terms in increasing order ofdata transfer rates. 1 1 1 1 1 HHHEHHH 1 1 1 1 1 1 1 1 defaming her character with abusive comments and pictures. ldentify the type ofcybercrime for these situations.
  • 3. 22 Both the Case study based questions are compulsory. Attempt any 4 sub partsfrom each question. Each question carries 1 mark Adepartmental store MyStore considering maintaining their inventory using SQL to store the data. As adatabase administer, Abhay has decided that: 2005 Table: STORE 2003 ItemNo 2002 2006 2001 Name of the database - mystore 2004 Name ofthe table - STORE 2009 The attributes ofSTORE are as follows: ItemNo -numeric ItemName - character ofsize 20 Scode - numneric Quantity - numeric ItemName Sharpener Classic Ball Pen 0.25 Get Pen Premium Get Pen Classic Eraser Small Eraser Big Ball Pen 0.5 same. ANSWERS: a) DELETE FROM store; Section -I| b) DROP TABLE store; |Scode Quantity c) DROP DATABASE mystore; d) DELETE store from mystore; 23 60 22 a) ItemNo 21 21 a) Identify the attribute best suitable to be declared as aprimary key. b) Degree =4 and Cardinality=7 22 b) Write the Degree and Cardinality ofthe table STORE d) DROPTABLE store 22 c) Insert the following data into the attributes ItemNo, ItemNameand SCode respectively in the given table STORE. 21 ItemNo =2010, ItemName="Note Book' and Scode =25 e) DESCRIBE store OR DESC store 50 d) Abhay want to remove the table STORE from the datababase MyStore. 150 Which command will he use from the following: 250 220 110 180 e) Now Abhay wants to display the structure of the table STORE, i.e. name of the attributes and their respective data types that he has used in the table. Write the query to display the c) INSERT INTO store (ItemNo,ItemName,Scode) VALUES(2010, "Note Book', 25);
  • 4. 23 Ranjan Kumar of cass 12 is writing a program to create a CSV file "user.csv" which will contain user name and password for some entries. He has written the following code. As a programmer, help him tosuccessfullyexecute the given task. import def addCsvFile(UserName,PassWord): #to wite /add data into the CSV file f-open( user.csv_) #csv file reading code newfileWriter =csv.writer(f) newFileWriter.writerow([UserName, PassWord]) f.close() def readCsvFile(): with open(' user.csv.r) as newfile: newFileReader = Csv. newFileReader: newFile. Answers: #Line 2 print (row(0].row[I]) addCsvFile("Arjun"."123@456") addCsvFile("Arunima","aru@nima") addCsvFile("Frieda","myname@FRD") # Line 1 (a) Name the module he should import in Line 1. a) csv e) b) "a" (b) In which mode, Ranjan should open the file to add data into the file (c) Fillin the blankinLine 3to read the data froma csv file. # to read data from CSV file (d) Fill in the blankin Line 4to close the file. c) reader (e) Write the output he willobtain while executing Line 5. d) close(0 # Line 4 Arjun 123@456 L(newFile) Arunima aru@nima Frieda myname@FRD # Line 3 for row in
  • 5. 24 Ans. 25 Ans. 26 Ans. 27 Ans. Evaluate the following expressions: a) 6*3+ 4*2 |/5 -8 b) 10 >5 and 7 >12 or not 18 >3 a) 13 b) False Differentiate between Viruses and Worms in context of networking and data communication threats. OR Differentiate between Web server and web browser Write any two popular web browsers. Viruses require an active host program or an already-infected and active operating system in order for viruses to run, cause damage and infect other executable files or documents. Worms are stand-alone malicious programs that can self-replicate. Web Browser: A web browser isa software application for accessing information on the World Wide Web. When a user requests a web page from a particular website, the web browser retrieves the necessary content from a web server and then displays the page on the user's device. a. SMTP Web Server: A web server is a computer that runs websites. The basic objective of the web server is to store, process and deliver web pages to the users. This intercommunication is done using Hypertext Transfer Protocol (HTTP). Popular web browsers : Google Chrome, Mozilla Firefox, Internet Explorer etc. Expand the following terms: c. LAN a) SMTP - Simple Mail Transfer Protocol b) XML - eXtensible Markup Language c) LAN - Local Area Network d) IPR- Intellectual Property Rights b. XML Example: def area(side): PART - B SECTION-I Differentiate between actual parameter(s) and a formal parameter(s) with asuitable example for each. return side*side; print(area(5)) OR Explaintheuse ofglobal keyword used in afunction withthe helpof asuitable example. The list of identifiers used in a function call is called actual parameter(s) whereas the list of parameters used in the function definition is called formal parameter(s). Actual parameter may be value /variable or expression. Formal parameter is an identifier. OR line # line 2 1 d. IPR OR In line l, side is the formal parameter and in line 2, while invoking area) function, the value 5 is the actual parameter. A formal parameter, i.e. a parameter, is in the function definition. An actual parameter, i.e. an argument, is in a function call. 2 2 2
  • 6. 28 Ans. 29 Use of global key word: In Python, global keyword allows the programmer to modify the variable outside the current scope. It is used to create a global variable and make changes to the variable in local context. A variable declared inside a function is by default local and a variable declared outside the function is global by default. The keyword global is written inside the function to use its global value. Outside the function, global keyword has no effect. Example c= 10 # global variable def add0: global c c=c+2 # global value of cis incremented by 2 print('Inside add):", c) add) c=15 print('In main:", c) output: Inside add) : 12 In main: 15 Rewrite thefollowing code in Python after removingallsyntaxerror(s). Underline each correction done in the code. Value=30 for VAL in range(0,Value) Ifval%4==0: print (VAL*4) Elseif val%5==0: else Value-30 print (VAL+3) CORRECTED CODE: print(VAL+10) for VAL in range(0,Value) : if val%4==0: print (VAL*4) elif val%5==0: else: print (VAL+3) print(VAL+10) # Error 1 # Error 2 # Error 3 # Error 4 What possible outputs(s) are expected to be displayed on screen at the time ofexecution of the program from the following code? Alsospecify the maximum values that can be assigned 2 2
  • 7. Ans. 30 Ans. 31 Ans. to each ofthe variables Lowerand Upper. import random AR=[20,30,40,50,60,70): Lower =random.randint(1,3) Upper =random.randint(2,4) for Kin range(Lower, Upper +1): print (AR[K]J,end="#*") ()10#40#70# (ü) 30#40#50# (iii) 50#60#70# (iv) 40#50#70# OUTPUT: (ii) Maximum value of Lower:3 Maximum value of Upper: 4 What do you understand byCandidate Keys in a table? Give asuitable example ofCandidate Keys froma table containing some meaningful data. Atable may have more than one such attribute/group of attributes that identifies a tuple uniquely, all such attribute(s) areknown as Candidate Ino 101 I02 04 I09 Item Pen Pencil CD Eraser Duster Qtyl 500 Example: fetchone() 700 500 In the above table Item, ItemNo can be a candidate key 700 300| Differentiate between fetchone0and fetchal) methods with suitable examples for each fetchall) fetches all the rows of a query result. An empty list is returned if there is no record to fetch the cursor. fetchone) method returns one row or a single record at a time. It will return None if no more rows records are available. 200 else: eno =int(input("Enter employee Number :") query="select *from emp where empno=".format(eno) if row!=None: mycur.execute(query) Example: fetchall() row = mycur.fetchone) print("'Name :",row|1]) print("Department :",row|2) print("Salary :",row|3) print(nEmployee Number not found") query="select *from emp" mycur.execute(query) rows = mycur.fetchall): for row in rows; print('Name :",row|1) print("Department"row|2) 2 2
  • 8. 32 Ans. 33 34 Ans. 35 Write the full forms ofDDL and DML.Write any two commands of DMLin SQL. DDL- Data Definition Language DML - Data Manipulation Language Any two out of INSERT, DELETE, UPDATE Find and writethe output ofthefollowingPython code: def Display(str): m="n for i in range(0,len(str)): if(str[i],isupper)): m=m+stri].lower0 elifstr[i].islower): else: print(m) if i%2==0: Ans. OUTPUT :fUNnpYTHON Display([email protected]) Output print("Salary :",row[3]) Write afunction LShift(Arr,n) in Python, which accepts alistArr ofnumbers and nis anumeric value by which all elements ofthe list are shifted to left. Sample Input Data ofthe listArr= [10,20,30,40,12,11], n==2 L=len(Arr) m=m+str).upper) Arr=[30,40,12,11,10,20] def LShit(ArT,n): y=Arf0] m=m+str[i-1]else: m=m+"#" for xin range(0,n) Arr[L-1Fy for iin range(0.L-1)) Arl-Afi+1] print(Arr) Note :Usingofany correctcodegivingthesameresuitisalsoaccepted. SECTION- II Write afunction in Python that countsthe number of"Me" or"My' words presentinatext file "STORY.TXT". Ifthe "STORY.TXT" contents are as follows: Example: My first bookwas Me and My Family. It gave me chance to be Known to the world. The output of the function should be: Countof Me/My in file:4 A or a:4 Mor m:2 Write a function AMCount) in Python, which should read each character of a text fle STORY.TXT, should count and display the occurrence of alphabets Aand M(including small casesaand mtoo). OR Ifthe file content is as follows: Updated information As simplified by oficialwebsites. The EUCount() function should display the output as: 2 3
  • 9. Ans. 36 Ans. def displayMeMy(): num=O f=open("story.txt"."t) N=f.read() M=N.split() forx in M: if x="Me" or x== "My": print(x) num=num+1 f.close() print("Count of Me/My In file:".num) t=open("story.txt") A,M=0,0 r=f.read() for x In - if x[0]=="A"orx[o]=="a": A=A+1 elif x[0)j=="M"or x[O]=="m": M=M+1 f.ciose() print("Aor a: "A) print("M or m: ".M) Write the outputsoftheSQLqueries () to (i) basedonthe relations Teacher and Posting g0ven below: Table:Teacher T_ID Name Age Department Date_ofjoin 1|Jugal 2 Sharmila 31 3 Sandeep 32 4| Sangeeta 35S 5 Rakesh 42 6 Shyam 7 Shiv Om 34 8 Shalakha 33 50 Department 44 History Computer Sc Mathematics Computer Sc History Mathematics History 3 Mathematics History Computer Sc OR Mathematics Salary Gender Count()) 10/01/2017 12000M 24/03/2008 20000 F i. SELECT Department, count(") FROM Teacher GROUP BY Department; 12/12/2016 30000 M . SELECT Max(Date_of Join),Min(Date_of 01/07/2015 40000F i. SELECT Teacher.name, Teacher.Department,Posting.Place FROMTeachr, Posting WHERE Teacher.Department =Posting.Department AND Posting. Place="Delhi";: 05/09/2007 25000|M 27/06/2008 30000 M 25/02/2017 21000| M 31/07/2018 20000| F 3 Join) FROMTeacher;
  • 10. 37 Ans. 38 ii ii. name Max -31/07/2018 or2018-07-31 OR Jugal s=ll Shiv Om def PUSH(Arr): WriteafunctioninPython PUSH(Arr), where Arris alist ofnumbers. From this list push all numbers divisible by 5into astack implemented byusingalist. Display the stack ifit has at least one element, otherwise display appropriate error message. Write afunction in Python POP(Arr), where Arr is astack implemented by alistofnumbers. The function returns the value deletedfromthestack. for x in range(0,len(Arr)): if len(s)==0: else: Law Block if Arr[x]%5==0: def popStack{st) : else: print(s) Department # If stack is empty if len(st)==0: print('Empty Stack") Computer Sc Delhi Computer Sc Delhi s.append(Arr[x) print("Underflow") return val Business Block Place OR val=st.pop) #pop) willdelete most recent element i.e. TOP element. print(val) Min- 05/09/2007 or 2007-09-05 Technology Block MyPace Universityis setting up its academic blocks at Naya Raipur and is planningtosetupa network. The University has 3academic blocks and one Human Resource Centeras shown in the diagram below: SECTION - II HR Center Center to Center distances between various blocks/center is as follows: 3 5
  • 11. Ans Law BIock to business Biock Law blockto Technology Block| 80m Law Block to HR center BusinesS Block to technology Block b Business Blockto HR Center Technologyblockto HR center Law Block Law Block Technology Block HR center c) Switch Number of computersineach of the blocks/Centerisasfollows: Business Block University with a suitable reason. 15 40 115 40m 25 a) Suggest the most suitable place (Le, Block/Center) to installtheserverofthis 105m b) Suggest an ideal layoutfor connecting these blocks/centersfor a wired connectivity. Business 30m c) Which device willyou suggest to be placed/installed in each ofthese blocks/centers Block 35m 15m to efficiently connect all the computers within these blocks/centers. d) Suggest the placement ofa Repeater in the network with justification. e) The university is planning to connectits admission office in Delhi, which is more than 1250km from university. Which typeofnetworkout ofLAN, MAN, orWAN will be formed? Justify your answer. a) Most suitable place to install the server is HR center, as this center has maximum number of computers. Technology Block HR Center d) Repeater may be placed when the distance between 2 buildings is more than 70 meter. e) WAN, as the given distance is more than the range of LAN and MAN.
  • 12. 39 Ans. Write SQL commands for the following queries (i) to (v) based on the relations Teacher and Posting given below: Table :Teacher T_IDName 1 2 3 4 5 6 7 8 i) ii) iii) iv) v) Jugal 34 Sharmila 31 Age Department Date_of join Sandeep 32 Sangeeta 35 Shyam Rakesh 42 50 Shiv Om 44 Shalakha 33 P_ID 1 3 Computer Sc History Mathematics 12/12/2016 History 01/07/2015 Mathematics 05/09/2007 History Computer Table : Posting Sc 10/01/2017 Department 24/03/2008 History Mathematics 31/07/2018 Mathematics 27/06/2008 25/02/2017 Computer Science Place Agra Raipur Delhi Salary 12000 20000 i. SELECT *FROM teacher WHERE department= "History"; 40000 i., SELECT name FROM teacher ORDER BY date_of_join; 30000 M To show all information about the teacher of History department. V. SELECT name, salary*0.1 AS Bonus FROM teacher; Gender M 25000 M To display teacher's name, salary, age for male teachers only. F 30000 M To display name, bonus for each teacher where bonus is 10% ofsalary. 21000 M To list the names offemale teachers who are in Mathematics department. F 20000 F To list the namesofall teacherswith theirdateofjoining in ascending order. iv. SELECT name, salary, age FROM teacher WHERE gender=M; i. SELECT name FROM teacher WHERE department= "Mathematics" AND gender="F"; 5
  • 13. 40 A binary file "Book.dat" has structure [BookNo, Book_Name, Author, Price]. i. Write a user defined function CreateFile() to input data for a i. Write a function CountRec(Author) in Python which accepts the Author name as parameter and count and return number of books by the given Author are stored in the binary fle "Book.dat" createFile): A binary file "STUDENT.DAT" has structure (admission_number, Name, Percentage). Write a function countrec) in Python that would read contents of the file "STUDENT.DAT" and display the details of those students whose percentage is above 75. Also display number of students scoring above 75% Ans. import pickle def record and add to Book.dat. fobj=open('Book.dat","ab") BookNo=int(input('Book Number: ") Book_name=input("Name :") Author = input("Author: ") Price =int(input("Price : ") rec=(BookNo,Book_Name,Author, Price] pickle.dump(rec,fobj) fobj.close) def CountRec(Author): try: fobj=open('Book.dat","rb')nu 0 while True: rec=pickle.load(fobj) if Author==rec(2]: except: num = num+ 1 fobj.close) return num OR 5
  • 14. 40 Ans. Abinary file "Book.dat" has structure [BookNo, Book_Name, Author, Price]. . Write a user defined function CreateFlle() to input data for a record and add to Book.dat. i. Write a function CountRec(Author) in Python which accepts the Author name as parameter and count and return number of books by the given Author are stored in the binary file "Book.dat" Abinary file "STUDENT.DAT" has structure (admission_number, Name, Percentage). Write a function countrec() in Python that would read contents of the file "STUDENT.DAT" and display the details of those students whose percentage is above 75. Also display number of students scoring above 75% import pickle def createFile(): fobj=open(Book.dat","'ab") BookNo=int(input("Book Number : ") Book_name=input("Name :") Author =input("Author: ") Price =int(input(Price : ") rec-[BookNo, Book_ Name,Author,Pricel pickle.dump(rec,fobj) fobj.close) def CountRec(Author): fobj-open(Book.dat","rb') nu- 0 try: while True: rec=pickle.load(fobj) ifAuthor==rec(2: except: num = num + 1 OR fobj.close) return num S
  • 15. OR import pickle def CountRec: fobj=open("STUDENT.DAT""rb") num =0 try: while True: rec-pickle .load(fobj) if rec(2] > 75: except: fobj.close) return num print(rec(0],rec|1],rec(2],sep="t") num = num +1