Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
96 views

CS Sample Paper Python

(1) The document provides instructions for a Computer Science class 12 half-yearly examination. It contains 3 sections with multiple choice and long answer questions. (2) Questions cover topics like Python programming, data structures, SQL, networking, and web technologies. Students are asked to write code, define functions, explain concepts, and solve problems. (3) The exam tests students' knowledge of programming fundamentals and ability to apply concepts to solve problems related to different domains.

Uploaded by

Aman Verma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

CS Sample Paper Python

(1) The document provides instructions for a Computer Science class 12 half-yearly examination. It contains 3 sections with multiple choice and long answer questions. (2) Questions cover topics like Python programming, data structures, SQL, networking, and web technologies. Students are asked to write code, define functions, explain concepts, and solve problems. (3) The exam tests students' knowledge of programming fundamentals and ability to apply concepts to solve problems related to different domains.

Uploaded by

Aman Verma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

ARMY PUBLIC SCHOOL, RANIKHET

HALF YEARLY EXAMINATION-2020


CLASS-XII
COMPUTER SCIENCE
MM: 70 TIME: 3 hrs
General Instructions:
 All Questions are compulsory.
 Marks are indicated against each question.
 Write Answer Number, before attempting any question.

SECTION-A

Q1. (a) Which of the following is valid logical operator in Python: [1]

(i) % (ii) : (iii) == (iv) or

(b) Write the type of tokens from the following : [1]

(i) for (ii) Num

(c) Name the Python Library modules which need to be imported to invoke the [1]
following functions: (i) exp( ) (ii) randint ()
(d) Rewrite the following code in python after removing all syntax error(s). [2]
Underline each correction done in the code.
Num = input("Number:")
Sum = 0
for i in range(10,Num,3)
Sum+=i
if i%2=0:

print ( i*2)
Else:
print ( i*3 print Sum)

1
(e) Find and write the output of the following python code: [1]
a=10
def call():
global a
a=15
b=20
print(a)

call()
print(a)
(f) Observer the following python code and write the output of the given code: [2]
def makenew(mystr):
newstr = ""
count = 0
for i in mystr:
if count%2 != 0:
newstr = newstr + str(count)
elif i.islower():
newstr = newstr + i.upper()
else:
newstr = newstr + i
count += 1
newstr = newstr + mystr[:1]
print("The new string is:", newstr)
makenew("sTUdeNT")
(g) Observe the following program and answer the question that follows: [2]

import random
x=3
N = random.randint (1, x)
for i in range (N):
print( i, "#", i + 1)

(1) What is the minimum and maximum number of times the loop will
execute? (2) Find out, which line of output(s) out of (i) to (iv) will not be
expected from the program?
i. 0#1 ii. 1#2 iii. 2#3 iv. 3#4

Q2) (a) Declare a variable of dictionary with some data. [1]

b) Write a Recursive function in python BinarySearch(Arr,l,R,X) to search the given


element X to be searched from the List Arr having R elements,where l represents lower
bound and R represents the upper bound. [2]
c) Write a function in python, MakePush(Package) and MakePop(Package) to add
a new Package and delete a Package from a List of Package Description, considering
them to act as push and pop operations of the Stack data structure. [4]

d) Write a function to sort a list through insertion sorting. [3]


e) What do you understand by docstring? Explain with example. [2]
f) What is Python Module and Package? [2]
g) How are following import statements different? [2]

h) import X ii) from X import * iii)from X import a,b,c

i) Write a function display(cities) that takes a list of cities as a parameter and print only
those cities which are beginning with alphabet ‘M’ only. [2]

Q3. a) Write a program to create a csv file “report.csv”. This file should store Adm No,
Name and Marks of Students, till user inputs ‘N’ in answer of Question “Add More
Records?”. [3]

b) Write a method/function DISPLAYWORDS() in python to read lines from a text file


STORY.TXT, and display those words, which are less than 4 characters. [3]
c) What is CSV file? [1]
d) #Q4 Write a function definition to increase the price of all the products by 10 percent.
The data is stored in the binary file stock.dat in the given format: [4]
[ {'icode':100,'Name':'Pencil','Price':10},{'icode':101,'Name':'Pen','Price':90},
{'icode':102,'Name':'Colors','Price':150} ]
e) Explain the uses of functions tell() and seek(). [1]
SECTION-B
Q4 a) Write a python code to increase the salary of all History department employees
by Rs. 5000 in the teacher table of Ranikhet database. [3]
Table: Teacher
EmpCode EmpName Department Salary
100 Amit Gupta History 55,000
101 Deepak Computer 65,000
b) Write commands in SQL for (i) to (iv) and output for (v) and (vi) [6]

a) To display name, location, city, SalesAmount of stores in descending order of


SalesAmount.
b) To display names of stores along with SalesAmount of those stores that have
‘fashion’ anywhere in their store names.
c) To display Stores names, Location and Date Opened of stores that were
opened before 1st March, 2015.
d) To display total SalesAmount of each city along with city name.
e) SELECT distinct city FROM store;
f) SELECT Name, length (name), left (name, 3) FROM Store where
NoOfEmployees<3;

Q5.a) Consider the following table: [2]


Table: Product
Pcode Pname Qty Price
100 Tooth Paste 100 78.0
101 Soap 500 20
102 Talc Powder 50 45.0
103 Washing Pdr 30 98.0

(i) What is the degree and cardinality of the above table.


(ii) Write a SQL command to add a new column sup_code of char(20) size in
the table.
b) Write the difference between where and having clause. [2]
c) What is foreign key? [2]
d) Write the difference between UNIQE and PRIMARY KEY Constraints. [2]
e) Which keyword is used to select rows containing columns that match a wildcard
pattern? [1]
f) Write the difference between CHAR and VARCHAR data types. [1]
g) Which clause cannot be used with aggregate functions? [1]
(a) group by (b) Select
(c) where (d) Both (a) and (c)
SECTION-C

Q6. a) Name two server side scripting language and two client side scripting
language. [1]
b) Which protocol in used in creating a connection with a remote machine? [1]
c) Identify the Domain name and URL from the following : [1]
http://www.income.in/home.aboutus.hml
d) Expand the following : [2]
GPRS , IMAP, CDMA, WiMax
e) What is the difference between packet & message switching? [1]
f) Hindustan Connecting World Association” is planning to start their offices in four
major cities in India to provide regional IT infrastructure support in the field of
Education & Culture. The company has planned to set up their head office in New Delhi
in three locations and have named their New Delhi offices as “Sales Office”, “Head
Office” and “Tech Office”. The company’s regional offices are located at “Coimbatore”,
“Kolkata” and “Ahmedabad”. A rough layout of the same is as follows: [4]

Approximate distances between these offices as per network survey team is


as follows:
Place From Place To Distance
Head Office Sales Office 10 KM
Head Office Tech Office 70
Meter Head Office Kolkata Office 1291 KM
Head Office Ahmedabad Office 790 KM
Head Office Coimbatore Office 1952 KM
In continuation of the above, the company experts have planned to install the
following number of computers in each of their offices:
Head Office 100
Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad Office 50
Coimbatore Office 50
(i) Suggest network type (out of LAN, MAN, WAN) for connecting
each of the following set of their offices:
 Head Office and Tech Office
 Head Office and Coimbatore Office
(ii) Which device will you suggest to be procured by the company for
connecting all the
computers within each of their offices out of the following devices?

 Modem
 Telephone
 Switch/ Hub

(iii) Which of the following communication media, will you suggest to be


procured by the company for connecting their local offices in New Delhi for
very effective and fast communication?

 Ethernet Cable
 Optical Fiber
 Telephone Cable

(iv) Suggest a cable/ wiring layout for connecting the company’s local offices
located

You might also like