0% found this document useful (0 votes)
20 views

HimeTest1-MS

Cs imp board questions answer key

Uploaded by

afzalhu0540a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

HimeTest1-MS

Cs imp board questions answer key

Uploaded by

afzalhu0540a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

CLASS XII

COMPUTER SCIENCE (083)


HOME TEST
Time allowed: 3 hours Maximum Marks: 70

General Instructions:
(i) This question paper contains five sections, Section A to E.
(ii) All questions are compulsory.
(iii) Section A have 21 questions carrying 01 mark each.
(iv) Section B has 07 Very Short Answer type questions carrying 02 marks each.
(v) Section C has 03 Short Answer type questions carrying 03 marks each.
(vi) Section D has 04 Long Answer type questions carrying 04 marks each.
(vii) Section E has 02 questions carrying 05 marks each.
(viii) All programming questions are to be answered using Python Language only.

SECTION – A (21 X 1=21)


1. . State True or False: 1
The operator ! is the arithmetic operator in Python.
Ans:False
2 Identify the valid identifier name from the following 1
(a) 9if (b)roll-no (c) sub (d) roll*no
Ans: sub
3 Identify the output of the following code snippet: 1
t = ‘welcome to Python’
t =t,tittle()
print(t)
(a) ‘Welcome To Python’ (b) ‘Welcome to Python’
(c)’Welcome’, ’to’, ’Python’ (d) ‘welcome to python’
Ans: (a) ‘Welcome To Python’

4 If s= ‘Computer Science’ then what will be the output of s.partition( ) 1


(a) [‘Computer’, ‘ ‘, ‘Science’] (b) (‘Computer’, ‘ ‘, ‘Science’)
(c) (‘Computer’, ‘Science’) (d) [‘Computer’, ‘Science’]
Ans: (b) (‘Computer’, ‘ ‘ ‘Science’)

5 Evaluate the following expression: 1


(5**3+5)-10*3%3
(a) 0 (b)130 (c) 120 (d) 150
Ans: © 120

6 Identify the output of the following code snippet: 1


L =[ ]
for i in range(5)
L[0]=i
(a) [0,1,2,3,4] (b) Error
(c) [1,2,3,4,5] (d) All of the above
Ans(b): Error

7 Which of the following statement will produce error if T = (10,20,30) 1

(a) print(T[2]=50) (b) print (len(T))


(c) print(list(T)) (d) print(T)
Ans: (a) print(T[2]=50)
8 Which of the following is not a tuple in Python? 1
(a) (1,2,3) (b) (‘one’, ‘two’)
(c ) (10,) (d) (“one”)
Ans: (d) (“one”)
9 Consider the given expression: 1
5<10 and 12<7 or not 7<4
Which of the following will be the correct output, if the given expression is
evaluated?
(a) True (b) False
(c) None (d) Null
Ans: (a) True

10 Identify the output of the following Python statements? 1


L=[]
for i in range(4):
L.append(2*i+1)
print( L[: :-1])

(a) [9,7,5,3] (b) [7,5,3,1]


(c ) [4,3,2,1] (d) [1,2,34]
Ans:(b)[7,5,3,1]

11 . Identify the correct possible output for the following Python code: 1
import random
for N in range(2,5,2):
print(random.randrange(1,N,end=’@’)
(a) 1@3@5@ (b) 2@3@
(c ) 1@4@ (d)1@3@
Ans: (d) 1@3@

12 Which of the following is not correct in context of Positional and Default parameters 1
in Python functions?
(a) Default parameters must occur to the right of the Positional parameters.
(b) Positional parameters must occur to the right of the Default parameters.
(c )Positional parameters must occur to the left of Default parameters.
(d) All parameters to the right of Default parameters must also have Default value.

Ans: (b) Positional parameters must occur to the right of the Default
parameters.

13 Which SQL command can change the degree of an existing relation? 1


(a) Alter (b)Delete (c) Drop (d) Insert
Ans: (a) Alter
14 What will be the output of the query? 1
SELECT * FROM Students WHERE Student_name LIKE ‘%A%’;
(a) Details of all the students whose name start with ‘A’.
(b) Details of all the students whose name ends with ‘A’.
(c) Details of all the students whose name containing ‘A’.
(d) Names of all the students whose name start with ‘A’.
Ans: (c) Details of all the students whose name containing ‘A’.
15 Which of the following is known as a set of entities of the same type that share 1
same properties or attributes?
(a) Relation set (b) Tuples
(c) Entity set (d) Entity Relation model.
Ans: (c) Entity set

16 Which command is used to removes a relation from an SQL? 1


(a) Drop (b) Delete (c) Purge (d) Remove
Ans: (a) Drop

17 What is the use of Bridge in the Network? 1


(a) To connect LANs (b) To separate LANs
(c) To control network speed (d) All of the above
Ans: (a) To connect LANs

18 Which transmission media is capable of having a much higher bandwidth(data 1


capacity)?
(a) Coaxial (b) Twisted pair cable
(c) Untwisted cable (d) Fiber optic
Ans: (d) Fiber optic

19 What is address size of IPv6? 1


(a) 32 bit (b) 64 bit
(c) 128 bit (d) 256 bit
Ans: (c) 128 bit

Question no,20 and 21 are the ASSERTION AND REASONING based questions.
Mark the correct choice as
(a) Both A and 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 is true.

20 Assertion: In non-circuit switching techniques, the message may take different 1


routes at different times.

Reason: The message switching and packet switching techniques are the same.
Ans: (c)A is true but R is false.

21 Assertion: A series of object stores values of homogeneous types. 1


Reason: Even if the value appear to be of different types, internally they are
stored in a common datatype.
Ans: (a) Both A and R are true and R is the correct explanation for A.

SECTION-B (7X2=14)
22. A) List out all the mutable and immutable data types in python.
B) Identify the types of following tokens. (2)

i) _Var_ ii) in
Ans:
A)1 mark for correct classification of data types
B) i)Identifier ii) Operator (1/2 mark for each)
23. i) What is the use of Identity operator? Give an example.
(2)
ii) Explain the use of ceil() and fabs() functions of math module with an example.
Ans:
i) Identity operator – is, is not – compares memory location
(1/2 mark) and (1/2 mark for an example)
ii) ceil() – returns maximum integer and fabs() – returns absolute value
(1/2 mark) and (1/2 mark for an example)
24. If exam=[‘eng’, ‘phy’, ‘che’, ‘cs’, ‘bio’], then
(Answer using builtin functions only)
(I)
A) Write a statement to insert subject ’math’ as last element (2)
OR
B) Write a statement to display the list in alphabetical order.
(II)
A) Write a statement to delete the element ‘che’.
OR
B) Write a statement to reverse the elements of list exam.
Ans: (I)
A) exam.append(‘math’)
OR
B) exam.sort() / exam.sort(reverse=False)
(1 mark for correct answer)
(II)
A) exam.remove(‘che’)
OR
B) exam.reverse()
(1 mark for correct answer)

25. Identify the correct output(s) of the following code. Also write the minimum and
the maximum possible values of the variable t.

import random
W=[‘Pen’, ‘Pencil’, ‘Eraser’, ‘Bag’, ‘Book’]
for i in range(2,3):
(2)
f=random.randint(i,3)
t=random.randint(i-1,3)
print(W[f], W[t], sep= “:”)

Ans: Erasr:Pencil (1 Mark for correct answer)

Minimum and Maximum values of the variable t: 1,3


(1/2 mark for each)

26. A)Write any two differences between circuit switching and packet switching.
OR
(2)
B)Expand the following terms.
i) VoIP ii) GPRS iii) FTP iv) Wi-Fi
Ans:
A) Any two correct differences (1 mark for each difference)
OR
B)
i) VoIP – Voice over Internet Protocol
ii) GPRS – General Packet Radio Service
iii) FTP – File Transfer Protocol
iv) Wi-Fi - Wireless Fidelity
(1/2 mark for each expansion)

I)
27.
A)Differentiate WHERE and HAVING clause in SQL with an
example
OR (2)
B)Write any two differences between DELETE and DROP commands.
II)
A) Satheesh has created a database “school” and table “student”. Now he
wants to view all the databases present in his laptop. Help him to write SQL
command for that, also to view the structure of the table he created.
OR
B) Write an SQL command to add the new column PURCHASE_DATE of
an already existing table named PRODUCT.
Ans:
A)difference - (1/2 mark), example – (1/2 mark)
OR
B) Any two correct differences (1/2 mark for each difference)
II)
A) SHOW DATABASES; (1/2 mark)
DESCRIBE STUDENT; / DESC STUDENT; (1/2 mark)
OR
B) ALTER TABLE PRODUCT
ADD PURCHASE_DATE DATE;
(1 mark)

28. Observe the following code carefully and rewrite it after removing all syntax and
logical errors. Underline all the corrections made.
def sepo_n(NUM):
SUM=0 (2)
PROD=1
for j in range(10:NUM)
if j%2=0:
SUM=SUM+j
else:
PROD=*j
print(SUM,PROD)
N=input(“Enter a number”)
seop_n(N)
Ans:
def sepo_n(NUM):
SUM=0
PROD=1
for j in range(10,NUM):
if j%2==0:
SUM=SUM+j
else:
PROD *= j
print(SUM,PROD)
N=int(input(“Enter a number”))
seop_n(N)

(1/2 mark each for correcting 4 mistakes)


SECTION-C (3X3=9)
29 A) Write a function AICOUNT() in Python, which should read each character of a
text file “DETAILS.TXT” and then count and display the count of occurrence of
alphabets A and I individually (including small cases a and i too).

Example:

If the file content is as follows:

I am getting better and better every day.

All I need is within me right now.

I am independent and self-sufficient.

The AICount() function should display the output as:

The total count of A or a: 6

The total count of I or i: 11

OR

B) Write a function CNT_DWORDS() in Python to count the words ending with a


digit in a text file "QUOTES.txt".

Example:

If the file content is as follows :

Planet51 Ocean’s 13,


500Days of Summer, House of1000 corpses
Blues Brothhers2000 3000Miles to Grace land

Output will be:


Number of words ending with a digit are 3

Ans:

def AICount():

f=open("DET
AILS.txt",'r')
data=f.read()
A=I=0
for j in data:
if j in ‘Aa’
A+=1
If j in ‘Ii’:
I+=1
print (A)
print(I)
f.close()
AICount()

( ½ mark for correctly opening and closing the file

½ marks for read()

½ marks for correct loop

½ marks for correct if statement

½ marks for correctly incrementing count

½ marks for displaying the correct output)

OR

def CNT_DWORDS():
f= open(“QUOTES.TXT”,’r’)
S=F.read()
Wlist=S.split()
Count=0
for W in Wlist:
if W[-1].isdigit():
Count+=1
print(“NO.OF words ending with a digit are”,count)

( ½ mark for correctly opening and closing the file

½ marks for read()

½ mark for split()

½ marks for correct loop

½ marks for correct if statement

½ marks for correctly incrementing count )

30 Write a program to reverse a string using stack. 3


Ans:
def push(stack,item):
stack.append(item)
def pop(stack):
if stack = = []:
return
return stack.pop()
def reverse(string):
n = len(string)
stack = []
for i in range(n):
push(stack,string[i])
string = ‘ ‘
for i in range(n):
string += pop(stack)
return string
string = input(“Enter a string:”)
print(“String:”, string)
reversedstr= reverse(string)
print(“Reversed String:”, reversedstr)

(1 Mark for correct definition of the function)


(1/2 for correct call statement, ½ for indentaion)
(1 Mark for correct loop)
31 A) Predict the output of the following code: 3

text = "pythoncode"
count = {}
c=0
lst = []
for w in text:
if w not in lst:
lst.append(w)
count[w] = 0
c= c + 1
count[w] = count[w] + 1
print(count)
print(lst)

OR

Predict the output of the following code:


def fun(N1,N2=10):
return N1 > N2
NUM= [10,21,14,56,32]
for I in NUM:
for J in range(1,I%5):
if J > len(NUM)//2:
print(fun(25),'#', end=' ')
else:
print(fun(30),'%',end=' ')
Ans:
Predict the output of the following code:
{'p': 1, 'y': 1, 't': 1, 'h': 1, 'o': 2, 'n': 1, 'c': 1, 'd': 1, 'e': 1}
['p', 'y', 't', 'h', 'o', 'n', 'c', 'd', 'e']

(1.5 mark for each correct line of output)


½ mark deducted for not printing {,’,:

OR

B) Predict the output of the following code:

True % True % True # True %

( ½ mark for each Boolean value and 1 mark for printing symbols)
½ mark deducted for not printing symbols

SECTION-D (4X4=4)
32. Consider the table EMPLOYEES as given below: 4
Emp_ID Name Department Salary Joining_Date
101 Amit IT 50000 2020-05-15
102 Nisha HR 60000 2019-07-10
103 Rohit IT 45000 2021-02-25
104 Riya Finance 55000 2018-11-23
105 Arjun Marketing 40000 2021-03-05
A) Write the following queries:
i) To display the total salary for each department, excluding departments
with a total salary greater than 100,000.
ii) To display the EMPLOYEES table sorted by salary in ascending order.
iii) To display the distinct department names from the EMPLOYEES table
iv) Display the total salary of employees whose joining date is before 2020-
01-01
OR
B) Write the output for the following queries:
i) SELECT name, salary from employees where salary >50000;
ii) SELECT department, Count(*) as total_employees FROM
employees GROUP BY department;
iii) SELECT * FROM EMPLOYEES where department=’IT’;
SELECT min(salary) from employees;
Ans:
i) Select department, sum(salary) as total_salary from employees group by
department having total_salary<=100000;
ii) SELECT * FROM EMPLOYEES ORDER BY SALARY;
iii) SELECT DISTINCT DEPARTMENT FROM EMPLOYEES;
IV) SELECT SUM(SALARY) FROM EMPLOYEES WHERE JOINING_DATE < ‘2020-01-
01’;
(4 x 1 mark for each correct query)
OR
B) i)
name salary
nisha 60,000
riya 55,000
ii)
Department Total_employees
IT 2
HR 1
Finance 1
Marketing 1
iii)
Emp_ID Name Department Salary Joining_Date
101 Amit IT 50,000 2020-05-15
103 Rohit IT 45,000 2021-02-25
i) min(salary)
40,000
(4 x 1 mark for each correct output)

33 Write a program in Python that defines and calls the following user 4
defined functions:
i) add()-To add the data of a student to a CSV file ‘school.csv’. Each record
consists of a list with field elements as stuid, sname and marks to store
student id, student name and student marks respectively.
ii) Search()- To display the records of the student whose marks is more than
80.
Ans:
33) import csv
(i) def ADD():
fout=open("school.csv","a",newline="\n")
wr=csv.writer(fout)
stuid=int(input("Enter student id :: "))
sname=input("Enter student name :: ")
marks=int(input("Enter mark :: "))
lst=[stuid,sname,marks]
wr.writerow(lst)
fout.close()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correctly checking the condition)
(½ mark for correctly displaying the records

(ii)
import csv
def search():
fin=open("school.csv","r",newline='\n')
data=csv.reader(fin)
found=False
print("The Details are")
for i in data:
if int(i[2])>80:
found=True
print(i[0],i[1],i[2])
if found==False:
print("Record not found")
fin.close()
print("Now displaying")
search()
(½ mark for opening in the file in right mode)
(½ mark for correctly creating the reader object)
(½ mark for correct use of counter)
(½ mark for correctly displaying the counter)

34 Write SQL queries for (i) to (iv) on the basis of table ITEMS and Traders 4
Table: ITEMS
CODE INAME QTY PRICE COMPANY TCODE
1001 Digital pad 120 11000 XENITA T01
1006 Led screen 70 38000 SANTORA T02
1004 Car Gps 50 21500 GEOKNOW T01
system
1003 Digital 160 8000 DIGICLICK T02
Camera
1005 Pen drive 600 1200 STOREHOME T03

TABLE: TRADERS
TCODE INAME CITY
T01 ELECTRONIC SALES MUMBAI
T03 BUSY STORE CORP DELHI
T02 DISP HOUSE INC CHENNAI

i) To display the details of all the items in ascending order of item


names(i.e , INAME)
ii) To display item name and price of all those items whose price is in the
range of 10,000 and 22,000(both values included)
iii) To display the number of items traded by each trader, joining the items
and traders tables.
iv) A) To increase the price of items by 10% whose quantity is above 100.
OR
B) Write a query to display the Cartesian product of ITEMS and
TRADERS
Ans:
34) i) SELECT * FROM ITEMS ORDER BY INAME ASC;
ii) SELECT INAME,PRICE FROM ITEMS WHERE PRICE >= 10000 AND PRICE
<=22000;
iii) SELECT T.CODE, T.INAME, COUNT(I.CODE ) AS Number_of_items FROM
TRADERS T LEFT JOIN ITEMS I ON T.ICODE=I.TCODE GROUP BY T.TCODE, T.INAME;
iv) A)Update ITEMS set price=price+price*0.1 where qty>100;
OR
B) Select * from ITEMS, TRADERS;
(4x1 mark for each correct query)
35 Consider the following table MEMBER in a SQL , Database CLUB: 4
Table: MEMBER
M_ID NAME ACTIVITY
M1001 Amina GYM
M1002 Pratik GYM
M1003 Simon SWIMMING
M1004 Rakesh GYM
M1005 Avneet SWIMMING
Write Python code to display the M_ID and NAME of members whose activity is
“GYM”
Use the following information for the connection:
host: localhost
database:club
userid:admin
password:admin@123
tablename:member

Ans:
35) import msq.connector as m
con=m.connect(host=”localhost”, username:”admin”, password:”admin@123”,
database=”club”)
cur=con.cursor()
cur.execute(“select * from member where activity=”GYM”)
r=cur.fetchall()
for i in r:
print(i[0],i[1],sep=””)
(½ mark for correctly importing the connector object)
(½ mark for correctly creating the connection object)
(½ mark for correctly creating the cursor object)
(½ mark for correctly inputting the data)
(½ mark for correct creation of first query)
(½ mark for correctly executing the first query with commit)
(½ mark for correctly executing the second query)
(½ mark for correctly displaying the data)

SECTION-E (2X5=10)
36 A binary file “Book.dat” has structure [Bookno, Book_name, Author,Price]. 5

(i) Write a user defined function createfile(). To input data for a record and add to
Book.dat

(ii) 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
Ans: (i)
import pickle
def createfile():
fob=open(“Book.dat”,”ab”)
Bookno=int(input(“Enter book number:”))
Book_name=input((“Enter Author name:”)
Author = input(“Enter Author name:”)
price=int(input(“Price of book))
rec =[Bookni, Book_name, Author,price]
pickle.dump(rec,fob)
fob.close().

(ii)
def countrec(Author):
fob=open(“Book.dat”,”rb”)
num = 0
try:
while True:
rec=pickle.load(fob)
if Author= =rec[2]:
num=num+1
print(rec[0],rec[1],rec[2],rec[3])
except():
fob.close()
return num

37 “Pratham” an NGO ,to provide education to children in the slums of Mumbai and it 5
has grown both in scope and geographical area,It is planning to setup its new
campus at Gujarat . The Gujarat campus has four(04) UNITS as shown below:

ADMIN
TRAINING
UNIT
UNIT

FINANCE
RESOURCE
UNIT
UNIT

Distances between above UNITs are given under:

UNIT-1 UNIT-2 DISTANCE(in mtrs)


ADMIN TRAINING 75
ADMIN RESOURCE 130
ADMIN FINANACE 100
FINANACE TRAINING 60
FINANACE RESOURCE 45
TRAINING RESOURCE 60

No.of computers in various units are:

UNIT NO.OF.COMPUTERS
ADMIN 140
FINANACE 25
TRAINNG 80
RESOURCE 65

i) Suggest an ideal cable layout for connecting the above UNITs.


ii) Suggest the most appropriate location of the server (out of the 4 units), to
get the best and effective connectivity .Justify your answer.
iii) Which hardware device will you suggest to connect all the computers
within each unit?
iv) A considerable amount of data loss is noticed between the different
locations of the Gujarat division, which are connected to the network
.Suggest a networking device that should be installed to refresh the date
and reduce the data loss during transmission to and from different locations
of Gujarat division.
v) A) Suggest the most suitable media to provide secure,fast and reliable data
connectivity between Mumbai Head Office and the Gujarat Setup.

OR
B) Mumbai firm is planning to connect to its Finance department in
Gujarat which is approximately 500 km away. Which type of network out
of LAN,WAN or MAN will be formed ?Justify your answer

Ans:

i)

TRAINING
ADMIN
FINANACE

RESOURCE
ii) ADMIN block.It has maximum number of computers
iii) Switch
iv)Repeaters
v)A) Satellie

OR
B)WAN .It covers larger geographical area
(1 mark for each correct answer)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy