Maximum Marks: 70: (Theory) DATE: 05-12-22 Questions Compulsory

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

Class: XII Session: 2022-23

Computer Science (083)


Common Pre-Board Question Paper
(Theory)
SET A
Maximum Marks: 70 Time Allowed: 3 hours
General Instructions: DATE: 05-12-22
1. This question paper contains five sections, Section A to E.
2 All questions
Section A has 18
are
compulsory.
(1-18) questions carrying 01 markS each.
Section B has 07 (19-25) Very Short Answer type questions carrying 02 marks each,
Section C has 05 (26-30) Short Answer type questions carrying 03 marks each.
6. Section D has 03 (31-33) Long Answer type questions carrying 05 marks each.
7. SectionE has 02 (34-35)
questions carrying 04 marks each.One internal choice is given
in Q35 against partonly.c
. All programming questions are to be answered using Python Language only.
SECTION A
State True or False
The value of the expression 4/(3*(4-2)) and 4/3*(4-2) is the same.

Write the type of tokens for: (i) if (ii) roll_no 1

State the reason for the following statement: Keys of dictionaries must be immutable.

Evaluate the expression, if A=16 and B=15.


A% B/IA

(a) 0.0 (b) 0 (c)1.0 (d) 1

Suppose that L is the list [100, [200,300], 400, 500. [600,700,800], 900]. What does 1
each of the following expressions evaluate to?
(a) L[1]I1]+ LI-2]1-2 (b) 400' in L[2:3]

Which, function is used to read data as a list of strings from a text file? 1
a) readlines() (b) readline() (c) read() (d) reader()
An attribute which was initially a candidate key but is not a primary key is known as

(a) Foreign (b) Super (c) Sub (d) Alternate

Which of the following keywords will you use in the following query to display all the
values of the column dept name?
SELECT dept name FROM Company
(a) Distinct (b) From (c) All (d)*

Which line of code produces an error? 1


(a) "one"+"two', 2+3 (b) "one"*2, two'+2' (c) *1+2',1+2 (d) '1+2, "one"*"two'

A1
Ao. VFill the blank with the
correct keyword
INSERT INTO Employees.
(a) MULT_VALUES (E01, XYZ', 32);
(b) VALUES (c) VALUUE (d) VAL
To read and
write into binary files, module of Python is used.
To display the resultset in
descending sort order, the
following clause is used:
(a) ORDER BY DESC
(b) ORDER BY (c) DESC ORDER (d) ORDER DESC
1 3 The is a network device that connects
dissimilar networks.
14 Evaluate the
following expressions:
(True and False) or False and
not True
15.Duplication of data is known
Data
as 1
(a) integrity (b) Data redundancy (c) Data duplication (d) Data difference

(16. All aggregate functions except ignore null values. 1


(a) Count(attribute) (b) Count(") (C)Avg (d) Sum

Q17 and 18 are 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 forA
(c) A is True but R is False
(d) A is False but R is True

returns a float value between 0 and 1,1 not included..


Assertion(A):- Random function
function generates true random numbers.
Reasoning (R):- Random

mode but it does not exist, a new file is created


a file is opened in write
8Assertion (A): If
by default. an error is displayed.
mode but it does not exist,
Reason (R): If a file is opened in read

SECTION B

the corrections. 2
correct code and underline
Write the
Find the error(s), if any.
Def Tot(Number):
Sum1 == 0
Number+1):
for C in Range(1,
Sum1 += C
return Sum1

print (Tot(3))
print (Tt[6])

A 2
20(a) Write one
difference between SMTP and FTP. 2
(b) What is the difference
between Star Topology and Bus Topology?
)Consider the following code:
=
2
Mp input("Please enter string:") a
for i in
range(2):
if Inp[-1] == 'z':
Inp = Inp[0:3] + ' c

break
elif 'a' in Inp:
Inp Inp[0] +'bb'
else **
= +
Inp Inp
print(Inp)
What will be the output produced if the input is 'zyxba'?

(b) Predict the output of following code fragment


fruit {}
f1 ['Apple', 'Banana', 'apple', 'banana']
for index in f1
ifindexin fruit:
fruit[index] += "Yellow'

else
fruit[index] = 'Red'

print (fruit)
2
22. Define the terms: (i) attribute (ii) cardinality
2
VolP (i) SMS
(a) Write the full form of (i)
What is the use of an IP address?
b)
2
code fragment?
Predict the output of the following
(24. \(a)
def check (n1=1, n2=2)
n1 n 1 + n 2
n2 + 1
print(n1, n2)

check(n2=20, n1=10)
check(3)

OR
code?
of the following
What will be the output
(b)
t= 10
time=5, r=1.5):
def interest(prn,
global t
t 20
* *
t r
calc prn
return calc
print(interest(20,2,4))
Lprint(interest(20))

A3 12
a
(a) What is the difference between
SELECT statement? WHERE clause and a HAVING clause of SQL 2
OR

(b) What is the


significance of GROUP BY clause in a SQL query?
SECTION C
26. (a Wjth reference to the tables given
below, mention the following:
Primary Key of WORKER table
Wdegree of table DEPT

(b) Consider the following DEPT and WORKER tables. Write QL


Outputs for SQL queries queries for find

Table: DEPT
DCODE DEPARTMENT CITY
D01 MEDIA DELHI
D02 MARKETING DELHI

D03 INFRASTRUCTURE MUMBAI

DO5 FINANCE KOLKATA

D04 HUMAN RESOURCE MUMBAI

Table : wORKER

WNO NAME DOJ DOB GENDER DCODE

1001 George K 2013-09-02 1991-09-01 MALE D01


2012-12-11 1990-12-15 FEMALE D03
1002 Ryma Sen
1987-09-04 MALE DO5
1003 Mohitesh 2013-02-03
1984-10-19 MALE De
Anil Jha 2014-01-17
1007
2012-12-09 1986-11-14 FEMALE DO1
1004 Manila Sahai
A 4
1005 R Sahay 2013-11-18 1987-03-31 MALE D02
1006JayaPriya 2014-06-09 1985-06-23 FEMALE D05
Note: DOJ refers to the date of
joining and DOB refers to the date of birth of Workers.

HSELECT COUNT("), DCODE FROM WORKER GROUP BY DCODE HAVING


COUNT (")> 1;
SELECT CT DEPARTMENT. NAME FROM WORKER WHERE
DERT.DCODE=WORKER.DCODE AND GENDER="MALE' ;
DEPT
Write a method in python to read lines from a text file INDIA.TXT, and display the count 2
of alphabets and numbers separately.

eeaWrite the syntax of the SQL command used to delete all records of the table
SYDENT, but not the table itself.

Given the following table


Table: sTUDENT
Stream AvgMarkGrade Class
No. Name Stipend
400.00 Medical B 128
Karan 78.5
A 11C
2 Divakar 450.00 Commerce 892
68.6 C 120
3 Divya 300.00 Commerce
B 12C
Arun 350.00 Humanities 73.1
90.6 A 11A
5 Sabina 500.00 Nonmedical
B 12B
John 400.007Medical 754
11A
64.4
7 Robert 250.00 Humanities
A 12A
Rubina 450.00 Non Medical 88.5
8
A 12A
500.00 Won Medical 92.0
9 Vikas
C 12C
67.5
Mohan 300.00 Commerce
10

SQL s t a t e m e n t s .
Give the output offollowing WHERE AvgMark>75
FROM STUDENT
MIN(AvgMark) Name LIKE
SELECT Student WHERE
Grade FROM
SELECT Name, FROM STUDENT;
COUNT(DISTINCT Stream)
SELECT WHERE Stipend>450 or Class="12A
* Student
KSELECT FROM 3
which is a
two lists, L_even
from the u s e r and prints which
that takes a string which is a list ofwords
even-numbered
length andL_odd elements. For
has more
Write a program have
which the list which
list of words Also, display should display,
odd-numbered length. then it
have kind and courteous",
"We should be L_odd".
string is "Greater =
example, if the "courteous",
"be", "kind"], ["and',
(We", "should",
A5
30 ach node of a STACK
i) Pin code of a contains the following
Write functions to city, (ii) Name ofinformation
-implement city. 3
(a) PUSH() To ask the
of the
following
user to enter theoperations in above stack
city starts with either 'a' data and push the
or 'A'. node in the stack if the
6) POP) - To remove a node name
Condition also. from the stack
and display. Check for the
underflow
OR

Write a function in
details of an Python, Push(Account)
where Account is a
names of those Account dictionary containing the
accounts in {AccountName:AccountType).
the stack whose The function should
stack along with the
count of Account type is push the
For pushed into the stack. "Savings". Display the
example: If the dictionaryelements
contains the
"Def":"Current", data: following
display Abc Jkl Mno. The "Ghi":"Current", "Jkl":"Savings",
count of Account=("Abc":"Savings",
"Mno": "Savings"). The stack
elements should be should
displayed as 3.

SECTIOND
31. UNIVERSITY OF
its There are 4
in Allahabad is
different wings.CORRESPONDENCE
Home Science(H). wings named as setting up the network
between 5
Journalism(J), Science(S), Arts(A) and
Distance between various wingS:
Wing A to Wing S 100 m
Number of Computers
Wing A 150
Wing A to Wing J 200 m
Wing S 10
Wing A to Wing H 400 m
Wing J
Wing S to Wing H 300 m
Wing H 50
Wing S to Wing H 100 m
Wing J to Wing H 450 m

Suggest and lllustrate suitable topology for networking the of all


computer
(Name the wing where the Server to be installed. Justify your answer. wings.
(ii) Suggest the placement of Hub/Switch in the network.
(V) Mention the wired communication media which ensures fastest and most reliable
data transfer.
Which software can be used on individual computers to provide security?

32 What will be the output of the following programs? 2


(a)
metal= "gold"
def myfunc():
global metal
choice = "

metal = "silver"

6
choice =
"I like" + metal
return choice
print("I like" + metal)
print(myfunc()"2)
(b) Fill the statements
below
as ms
import mysql.connectorgiven
def sql_data():

con1=ms.comnect(host="localhost",user="root",
mycur- #Statement 1
password="", database="school")
book_id=int(input("Enter Book id : "))
book_name=input("Enter name:: ")
price=float(input("Enter Price: "))
q="INSERT INTO Library VALUES({}.00.format(book_id, book_name, price)
#Statement 2
print("Data Added successfully")
#Statement 3
con1.close()
OR

(a) What will be the output of the following program? 2


=
S "Madam is a palindrome"
n len(s)
for i in range(0, n//2):
if (s[i] >= 'a' and s[i] <=
'm'):
m m+ s[i+1]
elif (s[i].isspace():
= +
m m si-1]
elif not (s[i].isalpha()!:
m= m + "#
else:
m= m + %'

print(m)
3
(6) Fillthe statements given below. Assume that MySql is installed on the machine
named localhost, it's userid and password are root and "pwd" respectively and the name
of the database is Sports.
import mysql.connector as ms
def sql_data():
con1 mysql.connect(_ ) #Statement1
mycur =
#Statement 2
print("Details of Tennis and Swimming are: ")
mycur.exxecute("SELECT * F R O M G a m e W H E R E G N a m e in [ " T e n n i s " , "Swimming"|

data= #Statement 3
for record in data:
print(record)
print()
con1.close()
F3. (a) Is the binary file processed faster than a textfile? Il yes, justifyyour answer.
(b) A binary file "Flights.dat" has structure FlightNo, FlightName, PilotiD, TicketPrice
A 7
(i) Write a user defined function
Flight.dat. CreateFile() to input data for a record and add to 4
(i) Write a function
parameter and
AvgCalc(FlightName)
the
in Python which accepts the
Flight name as
a
displays average TicketPrice of the flight.
OR

What are .csv files? How are they different from .txt files?
(b) A CSV file "Shop.csv" has structure [ItemNo, ItemName, Qty, ItemPrice].
i) Write a user defined function AppendData() to
the user. append data for a record taken from 4
ii) Write a function Search(ltemName, ItemPrice) in Python which accepts the ltem
name and Item price as a parameter and displays the records containing either the
mentioned Item name or Item price.

SECTION E

34 Ram has a table named 'Topics' in the database 'Book' containing the following 4
attributes - Topicld (Integer, PRIMARY KEY), TopicName(String), CreatedOn(Date,
NOT NULL).
(a) Insert a row with the data - 10, 'Recursion', 2018-03-02.
(b) Modify the table to add a field Pages Integer whose default value must be 1.
(c) as 6.
(i) Update the specific record added above to make the Pages
(ii) Delete all records created after 2022-05-06";

OR (option for part (c) only)

(C)
(i) What is a Foreign Key? which has been obtained by
and 3 attributes, while Table3
(ii) If Table1 has 5 tuples Table1 and Table2 has 20 tuples and 9 attributes,
between
Product
the Cartesian
the degree and cardinality of Table2?
what can said about
4
a task to write a python code to perform the
has recently been given functions/modules:
A programmer user defined
35. operations with
the help of two
following CSV file
called Hotel.csv in append mode containing
t o create a CSVfile
a. CSVOpen() RoomType and RoomPrice
-
HotelName, the
information of called Hotel.csv where
records from the CSVfile
to display the
b. CSVRead()
HotelName starts with 'R'.
field
the code:
blanks to complete
Fill in the

import CSV
#Statement-1
def CSVOpen(): csvf:
',newline=") as
with open('Hotel.csv''_

with ope #Statement-2


CW.writerow(['Ramada',Suite', 150000])
CW 150000)
cw.writerow(['Park Inn', Business',39000])

Cw.writerow(['Hilton', 'Executive',28000])

JViul-
def CSVRead():
try:
with open(Hotel.csv',r) as csvf:
cr #Statement-3
for r in cr:
if #Statement-4
print(r)
except
print('File Not Found')

CSVOpen()
CSVRead()

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