SAMPLE QUESTION PAPER 2 (Solved)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

SAMPLE QUESTION PAPER–II

CLASS XII
COMPUTER SCIENCE (083)
TIME: 3 hrs M.M: 70
General Instructions:
• All questions are compulsory.
• Question paper is divided into 4 sections A, B, C and D.
 Section A: Unit-1
 Section B: Unit-2
 Section C: Unit-3
 Section D: Unit-4

1. (a) Identify and write the name of the module to which the following functions belong: (1)
(i) ceil()
(ii) findall()
Ans. (i) ceil() – math module
(ii) findall() – re module
(b) Which of the following can be used as valid variable identifier(s) in Python? (1)
My.file, _count, For, 2digits, 4thSu, Total, Number#, Name1
Ans. Valid Identifier:- _count, For, Total, Name1
(c) Find the output of the following code: (1)
def CALLME(n1=1, n2=2):
  n1=n1*n2
  n2+=2
  print(n1, n2)
CALLME()
CALLME(2,1)
CALLME(3)
Ans. 2 4
2 3
6 4
(d) Which of the following can be used as valid variable identifier(s) in Python? (2)
(i) 4thSum
(ii) Total
(iii) Number#
(iv) Data
Ans. (ii) Total (iv) Data
(e) Find and write the output of the following Python code: (2)
TXT = ["20","50","30","40"]
CNT = 3
TOTAL = 0
for C in [7,5,4,6]:
   T = TXT[CNT]
   TOTAL = float(T) + C
  print(TOTAL)
   CNT -= 1
Ans. 47.0
35.0
54.0
26.0
1
(f) Rewrite the following code in Python after removing all syntax error(s). Underline each correction
done in the code. (3)
STRING=""HAPPY NEW YEAR"
for S in range[0,8]:
print STRING(S)
print S+STRING
Ans. STRING = "HAPPY NEW YEAR"
for S in range(0,14):
  print(STRING[S])
  print(S,STRING)
(g) What output will be generated when the following Python code is executed? (2)
def ChangeList():
  L=[]
  L1=[]
  L2=[]
   for i in range(1, 10):
    L.append(i)
   for i in range(10,1,-2):
    L1.append(i)
   for i in range(len(L1)):
    L2.append(L1[i]+L[i])
  L2.append(len(L)-len(L1))
  print(L2)
ChangeList()
Ans. [11, 10, 9, 8, 7, 4]
2. (a) What does stdin, stdout represent? (1)
Ans. stdin represents standard input device and stdout represents standard output device which are
represented as files.
(b) What problem occurs with the following code on execution: (1)
X=40
while X < 50:
  print(X)
Ans. The given code does not have the incrementing value of X, thus the loop becomes endless.
(c) Which module needs to be imported for showing data in chart form? (1)
Ans. matplotlib
(d) Rewrite the following Python code after removing all syntax error(s). Underline the corrections done.
(1)
def main():
   r = input('enter any radius :')
   a = pi * math.pow(r,2)
   print("Area = " + a)
Ans. Corrected Code:
import math
def main():
  r = int(input('enter any radius :'))
  a = math.pi * math.pow(r,2)
   print("Area = " , a)
(e) Write down name of functions to create line chart and bar chart. (1)
Ans. plot(), scatter(), bar(), barh() etc

2
(f) Study the following program and select the possible output(s) from options (i) to (iv) following it. Also,
write the maximum and the minimum values that can be assigned to variable Y. (2)
import random
X= random.random()
Y= random.randint(0,4)
print(int(X),":",Y+int(X))
(i) 0 : 0 (ii) 1 : 6
(iii) 2 : 4 (iv) 0 : 3
Ans. (i) and (iv) are the possible outputs. Minimum value that can be assigned is – Y = 0. Maximum value
that can be assigned is – Y = 3.
(g) List one similarity and one difference between List and Dictionary data type. (2)
Ans. Similarity: Both List and Dictionary are mutable data types.
Dissimilarity: List is a sequential data type, i.e., it is indexed. Dictionary is a mapping data type. It
consists of key: value pair.
For example, L = [1, 2, 3, 4, 5] is a list.
D = {1:"Ajay", 2:"Prashant", 4:"Himani"} is a dictionary where 1, 2, and 4 are keys and
"Ajay", "Prashant", "Himani" are their corresponding values.
(h) Rewrite the following Python program after removing all the syntactical errors (if any), underlining each
correction:(2)
def checkval:
   x = input("Enter a number")
   if x % 2 = 0:
    print x, "is even"
   else if x<0:
     print x, "should be positive"
  else;
    print x, "is odd"
Ans. Corrected Code:
def checkval():
  x = int(input("Enter a number:"))
   if x % 2 == 0:
    print(x, "is even")
   elif x<0:
    print(x, "should be positive")
  else:
    print(x, "is odd")
(i) Find the output of the following Python program: (3)
def makenew(mystr):
   newstr = ""
   count = 0
   for i in mystr:
    if count%2 != 0:
      newstr = newstr + str(count)
    else:
      if i.islower():
        newstr = newstr + i.upper()
      else:
        newstr = newstr + i
    count += 1
   newstr = newstr + mystr[:1]
   print("The new string is:", newstr)
makenew("sTUdeNT")
Ans. The new string is: S1U3E5Ts
3
(j) Write a program to read data from data file in read mode and count the particular word occurrences in
given string, number of times in Python. (4)
Ans. def compute(num):
f=open("test.txt","r")
read=f.readlines()
f.close()
#The variable has been created to show the number of types the loop runs
times=0
#The variable has been created to show the number of types the loop runs
times2=0
chk=input("Enter String to search:")
count=0
for sentence in read:
  line=sentence.split()
  times+=1
for each in line:
  line2=each
  times2+=1
  if chk==line2:
    count+=1
print("The search String:", chk, "is present:", count, "times")
print(times)
print(times2)

SECTION–B
3. (a) DNS is the abbreviation of _________________ . (1)
Ans. Domain Name System
(b) Each IP packet must contain ____________________ address. (1)
Ans. Source and Destination
(c) _______ provides a connection-oriented reliable service for sending messages. (1)
Ans. TCP (Transmission Control Protocol)
(d) __________ is a device that forwards data packets along networks. (1)
Ans. Router
(e) Expand the following: (2)
(i) URL
(ii) ADSL
(iii) SCP
(iv) SMTP
Ans. (i) Uniform Resource Locator
(ii) Asymmetric Digital Subscriber Line
(iii) Session Control Protocol
(iv) Simple Mail Transfer Protocol
(f) Write down the differences between private cloud and public cloud. (2)
Ans.
Public Cloud Private Cloud
Public cloud refers to a common cloud service Consists of computing resources used exclusively
made available to multiple subscribers. owned by one business or organization.
Cloud resources are owned and operated by Services and infrastructure are always maintained
third party cloud service provider and delivered on a private network and the hardware and
over the internet. software are dedicated solely to one organization.
Microsoft Azure, Google drive, Amazon Cloud Used by Government agencies, financial
Drive, iCloud etc. institutions, mid- and large-sized organization
4
(g) Write the purpose of following commands: (3)
(i) whois
(ii) ipconfig
(iii) nslookup
Ans. (i) whois: Lookup tool finds contact information for the owner of a specified IP address. The ipwhois
Lookup tool displays as much information as possible for a given IP address.
(ii) ipconfig: In Windows, ipconfig is a console application designed to run from the Windows
command prompt. This utility allows you to get the IP address information of a Windows
computer. It also allows some control over active TCP/IP connections.
(iii) nslookup: It is a network administration command-line tool available for many computer operating
systems. It is used for querying the Domain Name System (DNS) to obtain domain name or IP
address mapping information.
(h) Sony has set up its Branch at Srinagar for its office and web-based activities. It has 4 Zones of buildings
as shown in the diagram: (4)

Zone Zone

Zone Zone

Branch-to-branch distance is:
Zone X to Zone Z 40 m
Zone Z to Zone Y 60 m
Zone Y to Zone X 135 m
Zone Y to Zone U 70 m
Zone X to Zone U 165 m
Zone Z to Zone U 80 m
Number of Computers:
Zone X 50
Zone Z 130
Zone Y 40
Zone U 15
(i) Suggest the most suitable place (i.e., Zone) to house the ERP and BI Server of this organization with a
suitable reason.
(ii) Suggest the placement of the following devices with justification:
(a) Repeater
(b) Hub/Switch
(iii) Which is the most economic type of cable for the selected topology?
Ans. (i) The most suitable place (i.e., Zone) to house the ERP and BI Server is Zone Z as it has the most
number of computers; thus, cabling cost will be reduced and most traffic will be local.
(ii) Research Lab as it has the maximum number of computers.
(a) Repeater: As per the suggested layout, separate repeaters need not be installed as each
building/zone will be having a hub that acts as a repeater.

5
R
Zone Zone
U Y

Hub Hub

Hub
Zone Z

Zone X

Hub/switch should be placed in each zone
Ans. (iii) An economic type of cable is Dial-up or broadband as it can connect two computers at an
economic rate though it provides lesser speed than other expensive methods.

SECTION–C
4. (a) In Django, whenever a web client has to access a web page, it makes a _______request and sends URL
of the web page. (1)
Ans. GET
(b) Which command is used to create a new application in Django project? (1)
Ans. python manage.py startapp appname.
(c) What is the name of a special control structure that facilitates the row-by-row processing of records
in the result set during Python-MySQL connectivity? (1)
Ans. Database cursor.
(d) Which clause is used to remove the duplicating rows of the table in SQL? (1)
Ans. DISTINCT
(e) startproject command creates four basic Django projects in Directory. Write any two file names.(2)
Ans. The startproject command creates a basic Django project directory structure with the following files:
• manage.py
• settings.py
(f) Write the specific purpose of functions used in plotting: (2)
(i) plot()
(ii) Legend()
Ans. (i) plot(): A line chart or line graph can be created using the plot() function available in pyplot library.
For example, the basic syntax for creating line plots is plt.plot(x,y), where x and y are the points
or specify the (x, y) pairs that form the line.
(ii) Legend(): legend is the text or string that “has to be read” to understand the graph. Legends are used
in line graphs to explain the function or the values underlying the different lines of the graph.
(g) Consider a database LOANS with the following table: (3)
Table: LOANS
AccNo CUST_NAME Loan_Amount Instalments Int_Rate Start_Date Interest
1 R.K. Gupta 300000 36 12.00 19-07-2009 1200
2 S.P. Sharma 500000 48 10.00 22-03-2008 1800
3 K.P. Jain 300000 36 NULL 08-03-2007 1600
4 M.P. Yadav 800000 60 10.00 06-12-2008 2250
5 S.P. Sinha 200000 36 12.50 03-01-2010 4500
6 P. Sharma 700000 60 12.50 05-06-2008 3500
7 K.S. Dhall 500000 48 NULL 05-03-2008 3800

6
Now answer the following questions:
(i) Display the sum of all Loan Amounts whose Interest rate is greater than 10.
Ans. Select sum(Loan_Amount) from LOANS where Interest >10;
(ii) Display the Maximum Interest from Loans table.
Ans. Select max(Interest) from LOANS;
(iii) Display the count of all loan holders whose names are ending with ‘Sharma’.
Ans. Select count(*) from LOANS where Cust_Name Like ‘%Sharma’;
(h) Write SQL queries for (i) to (iii) and find outputs for SQL query (iv) which are based on the table.
(4)
Table: TRANSACT
TRNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06
(i) To display minimum amount transaction from the table.
Ans. select min(amount) from Transact;
(ii) To display total amount withdrawn from table.
Ans. select sum(amount) from Transact where type = “Withdraw”;
(iii) To display ANO, DOT, AMOUNT for maximum amount transaction.
Ans. select ANO, DOT, AMOUNT from Transact where AMOUNT = max(AMOUNT);
(iv) SELECT ANO, COUNT(*), MIN(AMOUNT) FROM TRANSACT
GROUP BY ANO HAVING COUNT(*)> 1
Ans. ANO COUNT(*) MIN(AMOUNT)
101 2 2500
103 2 1000
SELECT COUNT(*), SUM(AMOUNT) FROM TRANSACT
WHERE DOT <= '2017-06-01';
COUNT(*) SUM(AMOUNT)
2 5000

SECTION–D
5. (a) What does the term “Intellectual Property Rights” covers? (1)
Ans. The term “Intellectual Property Rights” covers Copyrights, Trademarks and Patents.
(b) Vinod is preparing financial analysis report of its organisation. Can he copy and paste information from
the Internet for reference in his report? (1)
Ans. Yes, he can do this but only after giving the reference to all the sources, otherwise it will be treated
as copyright violation.
(c) What are the environmental issues of e-waste? (2)
Ans. E-waste, or electronic waste, is waste from all sorts of electronics ranging from computers and mobile
phones, to household electronics such as food processors, pressure cookers, etc.
The effects of improper disposal of this e-waste on the environment are little known; however,
damage to the atmosphere is one of the biggest environmental impacts of e-waste.

7
(d) What do you understand by the term Plagiarism? Write two software used as Plagiarism checker.
(2)
Ans. Plagiarism is “copying and publication” of another author’s “language, thoughts, ideas, or expressions”
and the representation of them as one’s own original work. Plagiarism is considered academic
dishonesty and a breach of journalistic ethics.
The software available for Plagiarism checker are:
(i) DupliChecker
(ii) Grammarly
(iii) Paperrater
(iv) Plagiarisma
(e) List down some points about societal changes introduced by technology. (2)
Ans. Technology is the application of scientific knowledge to the making of tools to solve specific problems.
Technological advances such as automobiles, airplanes, radio, television, cellular phones, computers,
modems, and fax machines have brought major advances and changes to the world.
(f) What do you understand by Computer ethics? (2)
Ans. Computer ethics are a set of moral principles that govern the behaviour of a group or an individual
and regulate the use of computers. These include intellectual property rights (such as copyrighted
electronic content), privacy concerns, and how computers affect our society.

You might also like