You are on page 1of 85

Marking Scheme links are on each paper

20 Sets
Class : 12th
Sub : Computer Science
Disclaimer :
1. These papers are based on the SQP released by CBSE and
published by a private organization just for the practice of
the students.
2. CBSE has not released these papers and CBSE is not related to
these papers in any manner.
3. Publisher of these papers clearly state that these papers are
only for practice of students and questions may not be come in
main exam.
4. Please do not spread any rumors that any one paper will be
coming in main exam.
Page 1 NODIA Sample Paper 1 Computer Science Class 12

Sample Paper 1
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. The output of the code will be :
s=“Wonders of World”
print(s.count(‘O’) + s.index(‘o’))
(a) 3 (b) 4
(c) 2 (d) 1

2. The constraint that is used to provide a condition on a field to take specific values only is :
(a) NULL (b) PRIMARY KEY
(c) CHECK (d) NOT NULL

3. Which of the following are random number generators ?


(a) randint() (b) randrange()
(c) random() (d) All of these

4. Which of the following are sequence of character data?


(a) Lists (b) Tuples
(c) Strings (d) Dictionaries

5. A device that connects two dissimilar networks is


(a) modem (b) repeater
(c) bridge (d) gateway

6. In which file, no delimiters are used for line and no translations occur?
(a) Text file (b) Binary file
(c) CSV file (d) None of these

7. State True or False


“Multiple elements can be added at the end of list by the append method”.

8. These operators are used to make a decision on two conditions.


(a) Logical (b) Arithmetic
(c) Relational (d) Assignment
Click the Following Button to See the Free MS/Solutions
Page 2 NODIA Sample Paper 1 Computer Science Class 12

9. In files, there is a key associated with each record which is used to differentiate among different records. For every
file, there is atleast one set of keys that is unique. Such a key is called
(a) unique key (b) prime attribute
(c) index key (d) primary key

10. a = 1.0
b = 1.0
a is b # Line 1
Output of Line 1 will be
(a) False (b) True
(c) 1.0 (d) 0.0

11. Which of the following is a correct syntax to add a column in SQL command?
(a) ALTER TABLE table_name ADD column_name data_type;
(b) ALTER TABLE ADD column_name data_type;
(c) ALTER table_name ADD column_name data_type;
(d) None of the above

12. In complex number a + ib, a represents as


(a) real part (b) imaginary part
(c) special part (d) None of these

13. a = 6
b = 5.5
sum = a+b
print(sum)
print(type (sum))
(a) 11.5 (b) 10.5
<class ‘float’> <class ‘float’>
(c) None (d) None of these
<class ‘int’>

14. A column storing Name of a department in a table Emp will be of type


(a) int (b) date
(c) float (d) varchar

15. The........keyword sorts the records in ascending order by default.


(a) LIKE (b) UPDATE
(c) ORDER (d) ORDER BY

16. .........method takes a string and writes it in the file.


(a) writelines() (b) write()
(c) writerow() (d) writer()

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 1 Computer Science Class 12

Directions : (Q.Nos.-17 and 18) are Assertion and Reason based Questions.

17. Assertion (A) Built-in functions are predefined in the system and can be directly used in any program.
Reason (R) id( ) and type( ) are built-in functions in Python.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) The CSV files are like TEXT files and are comma separated value files.
Reason (R) The data stored in CSV files are separated by comma by default. Although the delimiter can be changed.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

Section - B
19. Riya was asked to accept a list of even numbers ,but she did not put the relevant condition while accepting the list
of numbers. She wrote a user defined function odd to even (L) that accepts the list L as an argument and converts
all the odd numbers into even by multiplying them by 2.
def oddtoeven (L)
for i in range (size(L)):
if (L[i]%2! == 0)
L[i]= L[1] ** 2
print (L)
There are some errors in the code . Rewrite the correct code.

20. How are E-mail and chat applications different?


 o
How are LAN and MAN different?

21. Observe the code and write the output


(a) ‘arihant publication’.
count(‘hant’, 0, 10)
(b) dic = {}
dic [(1, 2, 4)] = 8
dic [(4, 2, 1)] = 10
dic [1, 2)] = 24
sum = 0
for i in dic :
sum = sum + dic[i]
print (sum)

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 1 Computer Science Class 12

22. Write about the terms degree and cardinality of a table.

23. (a) Write the full forms of


(i) URL
(ii) VoIP
(b) Write the use of SMTP.

24. Find the output of following code.


dic = {“Nitin” : (21, “NIIT”), “Ankit” : (15, “NIIT”)}
print(“The original dictionary : ”, str(dic))
result= [(key, i, j) for key, (i, j) in dic.items()]
print(“The list after conversion : ”, str(result))
 o
What output will be generate when the following Python code is executed?
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()

25. Differentiate between DROP and DELETE commands of SQL.


 o
Identify any two DML commands from the following and also explain.
ALTER , INSERT , UPDATE , DROP , CREATE

Section-C

26. (a) Consider the following tables - STUDENT and STREAM :


TABLE: STUDENT
SCODE NAME AGE STRCDE POINTS GRADE
101 Amit 16 1 6 NULL
102 Arjun 13 3 4 NULL
103 Zaheer 14 2 1 NULL

TABLE: STREAM
STRCDE STRNAME

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 1 Computer Science Class 12

1 SCIENCE+COMP
2 SCIENCE+ BIO
3 SCIENCE+ECO
4 COMMERCE+MATHS
What will be the ouput of the following statement?
SELECT NAME, STRNAME FROM STUDENT S, STREAM ST WHERE S.STRCDE=ST.STRCDE;

(b) Write the output for SQL queries (i) to (iv), which are based on the table ITEMS.
TABLE: ITEMS
Code IName Qty Price Company TCode
1001 DIGITAL PAD 12i 120 11000 XENITA T01
1006 LED SCREEN 40 70 38000 SANTORA T02
1004 CAR GPS SYSTEM 50 2150 GEOKNOW T01
1003 DIGITAL CAMERA 12X 160 8000 DIGICLICK T02

1005 PEN DRIVE 32 GB 600 1200 STOREHOME T03


(i) SELECT MAX(Price), MIN(Price) FROM ITEMS;
(ii) SELECT Price * Qty AS AMOUNT
FROM ITEMS WHERE Code=1004;
(iii) SELECT DISTINCT TCode FROM ITEMS;
(iv) SELECT MAX(Company) FROM ITEMS WHERE Price > 7000;

27. Write a function countEU() in Python, which should read each character of a text file. IMP.TXT should count and
display the occurrence of alphabets E and U (including small cases e and u too).
e.g. If the file content is as follows :
Pinaky has gone to his friend’s house.
His friend’s name is Ravya. Her house is 12 km from Pinaky’s house.
The countEU() function should display the output as
E:8
U:3
 o
Write a Python program to find the longest word in file “status.txt”. If contents of status.txt are Welcome to your one-
step solutions for all your study, practice and assessment need for various competitive and recruitment examinations
and school segment. We have been working tirelessly for over a decade to make sure that you have best in class
study resources because you deserve SUCCESS AND NOTHING LESS...
Output should be
Longest word : examinations

28. (a) Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv).
TABLE: GARMENT
GCODE DESCRI-PTION PRICE FCODE READY-DATE
10023 PENCIL SKIRT 1150 F03 19-DEC-08

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 1 Computer Science Class 12

10001 FORMAL SHIRT 1250 F01 12-JAN-08


10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10007 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 20-OCT-08

TABLE: FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and 16-
JUN-08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs. Which are made up of FABRIC with FCODE as F03.
(iv) To display FABRIC wise highest and lowest price of GARMENTs from GARMENT table.
(Display FCODE of each GARMENT alongwith highest and lowest price.)
(b) Write a command to remove all the records of a table “Shipping”.

29. Write the definition of a function Reverse (x) in Python, to display the elements in reverse order such that each
displayed element is the twice of the original element (element *2) of the List x in the following manner:
Example :
If List x contains 7 integers is as follows:
x [0] x [1] x [2] x [3] x [4] x [5] x [6]
4 8 7 5 6 2 10
After executing the function, the array content should be displayed as follows:
20 4 12 10 14 16 8

30. Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with
separate user defined functions to perform the following operations
(a) Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is
greater than 75.
(b) Pop and display the content of the stack.
For example If the sample content of the dictionary is as follows
R={“OM”:76, “JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}
The output from the program should be

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 1 Computer Science Class 12

TOM ANU BOB OM


o
Alam has a list containing 10 integers. You need to help him create a program with separate user defined functions
to perform the given operations based on this list.
(a) Traverse the content of the list and push the even numbers into a stack.
(b) Pop and display the content of the stack.
For example, If the sample content of the list is as follows
N = [12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be:
38 22 98 56 34 12

Section - D
31. Red Pandas Infosystems has its 4 blocks of buildings. The number of computers and distances between them is
given below :

Building Number of Computers


HR 15
ADMIN 100
SYSTEM 25
PERS 30

Building Distance
HR -Admin 10 m
HR- System 50 m
HR- Pers 750 m
Admin- System 300 m
Admin- Pers 20 m
System-Pers 250 m

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 1 Computer Science Class 12

Answer the following questions with respect to the above :


(i) Suggest a suitable cable layout for the network.
(ii) Suggest the best place to house the server of the network.
(iii) Which topology should be used to connect computers in each building?
(iv) What kind of network will be formed here? (LAN/MAN/WAN)
(v) Write one advantage of the topology suggested by you.

32. (a) Find the output of the following Python program:


def makenew (mystr):
newstr = “”
count = 0
for i in mystr:
if count%2!=0:
newstr = newstr + str (count)
else:
if islower (i):
newstr = newstr + upper (i)
else:
newstr = newstr + i
count + = 1
newstr = newstr + mystr [:1]
print(“The new string is:”,
newstr)
makenew(“sTUdeNT”)
(b) Consider the table Student whose fields are
Scode Name Age Strcde Points Grade
101 Amit 16 1 6 NULL
102 Arjun 13 3 4 NULL
103 Zaheer 14 2 1 NULL
104 Gegen 15 5 2 NULL
105 Kumar 13 6 8 NULL
Write the Python code to update grade to ‘A’ for all these students who are getting more than 8 as points.
The table structure is as follows :
Scode : integer
Name : varchar
Age : integer
Strcde : integer
Points : integer
Grade : varchar
Note the following to establish the connection between Python and MySQL:
Host : localhost
Username : Admin
Password : Admin@123

Click the Following Button to See the Free MS/Solutions


Page 9 NODIA Sample Paper 1 Computer Science Class 12

The table exists in MySQL database as : Student


o
(a) Write a Python program to remove the characters of odd index values in a string.
(b) Consider the table MobileStock with following fields
M_Id. M_Name, M_Oty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database Mobile.
Consider:
host : localhost
UserName : root
Password : system
Database : Mobile

33. What is CSV file?


Write a program using two functions :
(a) addCustomer( ): To write Customer code, Customer name and Amt in file “cust.csv”.
The details of the customers are as follows :
[‘CustCode’, ‘CustName’, ‘Amount’]
[‘001’, ‘Nihir’, ‘8000’]
[‘104’, ‘Akshay’, ‘5000’]
(b) readCustomer( ): To read the details of the customers and display them.
 o
When do we use CSV file?
Write a program using following functions :
(a) getlnventory() : Write code to accept as many inventory records and store them to the csv file Inventory.csv
storing records of inventory as per following structure
PCode Invname Price Reorder
(b) Display() : To display the detail that store in Inventory.csv

Section - E
34. Consider the table MOVIE DETAILS given below
Table : MOVIEDETAILS
MOVIEID TITLE LANGUAGE RAT-ING PLAT-FORM
M001 Minari Korean 5 Netflix
M004 MGR Magan Tamil 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the English 4 Prime Video
Chamber of Secrets
M015 Uri Hindi 5 Zee5
M020 Avengers: Endgame English 4 Hotstar

Click the Following Button to See the Free MS/Solutions


Page 10 NODIA Sample Paper 1 Computer Science Class 12

(i) Identify the degree and cardinality of the table.


(ii) Which field should be made the primary key? Justify your answer.
(iii) Write statements to :
(a) Delete the records whose language is “English”
(b) Add a new record : “M050”, “Palki”,“Hindi”, 5, “Amazon Prime”.
 o
(Option for part (iii) only)
Write statements to :
(a) Add a new column “DAYS” of type integer
(b) Remove the column “RATING”

35. Below is a program to delete the line having word (passed as argument). Answer the questions that follow to execute
the program successfully.
import ......
def filedel (word):
file1 = open (“Python. txt ”,
“......”)
nfile = open (“algo1.txt”, “w”)
while True:
line = file1.readline( )
if not line:
break
else :
if word in line :
......
else :
print(line)
nfile......(line)
file1.close()
nfile.close()
filedel (‘write’)
(i) Name the module that should import in Line 1.
(ii) In which mode, above program should open the file to delete the line?
(iii) Fill the blank in Line 11 and Line 14.

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 2 Computer Science Class 12

Sample Paper 2
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. Given L= [2,3,4,5,6]. The output of print(L[–2]) is
(a) 6 (b) Error
(c) 5 (d) 3

2. The method used to get the position of file pointer is


(a) tell() (b) get()
(c) seek() (d) pos()

3. This function is used to calculate total occurrence of given elements of list.


(a) len() (b) sum()
(c) count() (d) extend()

4. You can repeat the elements of the tuple using which operator?
(a) * (b) +
(c) ** (d) %

5. The rule of referential integrity is based on...........


(a) Primary key (b) Foreign key
(c) Alternate key (d) None of these

6. Which method returns the next row from the result set as tuple?
(a) fetchone () (b) fetchmany ()
(c) fetchall () (d) rowcount

7. Which of the following command displays the attributes of a table along with their types and sizes?
(a) Alter (b) Show structure
(c) Show create table (d) View structure

8. The............command adds records to a table.


(a) ADD (b) APPEND
(c) ADDRECORD (d) INSERT
Click the Following Button to See the Free MS/Solutions
Page 2 NODIA Sample Paper 2 Computer Science Class 12

9. In a............topology, the nodes are connected by separate cables.


(a) Star (b) Bus
(c) Tree (d) Mesh

10. Given a list Lst= [45,100,20,30,50]. What will be the output of Lst[: :]?
(a) [45,100,20,30,50] (b) [ ]
(c) Error (d) [45]

11. State True or False


“Given a dictionary Studict. The statement Studict.items() displays the keys of the item only.”

12. Which module is to be imported to use the floor() function?


(a) statistics (b) matplotlib
(c) random (d) math

13. Which function is used to convert string into tuple?


(a) string() (b) tup()
(c) tuple() (d) str_tuple()

14. A file can be opened both for reading and writing using............mode.
(a) r (b) r+
(c) a (d) None of these

15. The..........clause can be used as an alternative to multiple OR.


(a) IN (b) BETWEEN
(c) NOT (d) range

16. The purpose of the primary key in a database is to


(a) unlock the database
(b) provide a map of the data
(c) uniquely identify a record
(d) establish constraints on database operations

Directions : (Q.Nos.-17 and 18) are Assertion and Reason based Questions.

17. Assertion (A) To use the randint() function , the random module needs to be included in the program.
Reason (R) Some functions are present in modules and to use them the respective module needs to be imported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) The contents of a Binary file are not directly interpretable.
Reason (R) Modes in which binary files can be opened are suffixed with ‘b’ like : rb/wb etc.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(a) A is true but R is false.
(c) A is false but R is true.

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 2 Computer Science Class 12

Section - B
19. Find the error(s).
L1 = [7, 2, 3, 4] Statement 1
L2 = L1 + 2 Statement 2
L3 = L1 * 2 Statement 3
L = L1.pop(7) Statement 4
20. Name two switching techniques used to transfer data between two terminals (computers).
 o
Arrange the following network in ascending order of their area:
LAN, PAN, WAN, MAN

21. (a) Observe the code and write the output:


t = ‘HELLO’
t1 = tuple(t)
print(t1)
(b) Predict the output of the following code
x = (1, 2, 3)
y = (3, 4)
t = x + y
print(t)

22. Differentiate between an attribute and a tuple with an example.

23. (a) Write the hill forms of


(i) WVVW
(ii) TCP/IP
(b) List down the types of computer networks.

24. Identify the output of the following Python code.


D = {1: “One”, 2: “Two”, 3: “Three”}
L = [ ]
for K, V in D.items():
if V[0] = = “T”:
L.append (K)
print(L)
 o
Identify the output of the following Python statement.
lst1 = [10, 15, 20, 25, 30]
lst1.insert(3, 4)
lst1.insert(2, 3)
print (lst1[– 5])

25. Describe the following terms


(i) Domain
(ii) DB2
 o

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 2 Computer Science Class 12

Identify commands/functions for the following actions :


(i) To add a new column to a table.
(ii) To get the sum of all values in a column of a table.

Section - C

26. (a) Consider the tables CARS and SUPPLIER given below. What will be the output of the statement given?
TABLE: CARS
Ccode Car-Name Make Color Capa-city Cha-rges Scode
501 A-star Suzuki RED 3 14 1
503 Indigo Tata SILVER 3 12 2
502 Innova Toyota WHITE 7 15 2
509 SX4 Suzuki SILVER 4 14 2
510 C-Class Merc-edes RED 4 35 4

Table : SUPPLIER
Scode Sname
1 Great Suppliers
2 Himalayan Vehicles
3 Road Motors
4 Speed
SELECT CarName, Sname, Charges FROM CARS C, SUPPLIER S WHERE C.Scode= S. Scode
AND Charges > 15;
(b) Write the output for SQL queries (i) to (iv), which are based on the table CARDEN.
TABLE: CARDEN
Ccode CarName Make Color Capa-city Charges
501 A-star Suzuki RED 3 14
503 Indigo Tata SILVER 3 12
502 Innova Toyota WHITE 7 15
509 SX4 Suzuki SILVER 4 14
510 C-Class Mercedes RED 4 35
(i) SELECT COUNT(DISTINCT Make) FROM CARDEN;
(ii) SELECT COUNT(*) Make FROM CARDEN;
(iii) SELECT CarName FROM CARDEN WHERE Capacity = 4;
(iv) SELECT SUM (Charges) FROM CARDEN WHERE Color = “SILVER”;

27. Write a function Del() to delete the 4th word from a text file school.txt.
 o
Write a function countmy( ) in Python to read the text file “Data.txt” and count the number of times “my” occurs
in the file.
For example If the file contents are:

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 2 Computer Science Class 12

My first book was. Me and My Family.


It gave me chance to be known to the world.
The output of the function should be
No. of times “my” occur : 2

28. (a) Write the output of the queries (i) to (iv) based on the table FURNITURE given below.
Table : FURNITURE
FID NAME DATE OF PURCHASE COST DISCOUNT
B001 Double Bed 03-JAN-2018 45000 10
T010 Dinning Table 10-MAR-2020 51000 5
B004 Single Bed 19-JUL-2021 22000 0
C003 Long back Chair 30-DEC-2016 12000 3
T006 Console Table 17-NOV-2019 15000 12
B006 Bunk bed 01-JAN-2021 28000 14
(i) SELECT SUM(DISCOUNT) FROM FURNITURE WHERE COST>15000;
(ii) SELECTMAX(DATEOFPURCHASE) FROM FURNITURE;
(iii) SELECT
* FROM FURNITURE WHERE DISCOUNT>5 AND FID LIKE “T%”;
(iv) SELECTDATEOFPURCHASE FROM FURNITURE WHERE NAME IN (“Dinning Table”, “Console
Table”);
(b) Write a command to remove all the records of the table “Garments” whose Readydate is after “20-Oct-2008”.

29. Write a user-defined function find-name (name), where name is an argument in Python to delete phone number from
a dictionary phone-book on the basis of the name, where name is the key.

30. Write Push (contents) and Pop (contents) methods in Python to add numbers and remove numbers considering them
to act as Push and Pop operations of stack.
 o
Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period (.) except digits. Assume that Pname is a class instance attribute.

Section - D

31. Sony corporation has set up its 4 offices in the city of Srinagar, with its offices X, Z, Y, U:

Branch to Branch distance is given below:

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 2 Computer Science Class 12

X to Z 40 m
Z to Y 60 m
Y to X 135 m
X to U 70 m
Z to U 165 m
Z to U 80 m
Number of computers in each of the offices is as follows:
X 50
Z 130
Y 40
U 15
(i) Suggest a suitable cable layout of connectivity of the offices.
(ii) Suggest placement of server in the network with suitable reason.
(iii) Suggest placement of following devices in the network:
(a) Switch/Hub
(b) Repeater
(iv) Suggest a suitable topology for connecting the computers in each building.
(v) Write any one advantage of the topology suggested.

32. (a) Carefully observe the following Python code and answer the question that follow:
x = 5
def func2():
x = 3
global x
x = x + 1
print(x)
print(x)
On execution the above code, produces the following output:
6
3
Explain the output with respect to the scope of the variables.
(b) Write the code to create a table Product in database Inventory with following fields
Fields Datatype
PID varchar(5)
PName char(30)
Price float
Rank varchar(2)
Note the following to establish the connection between Python and MySQL:
Host : localhost
Username : system
Password : hello
Database : Inventory
 o

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 2 Computer Science Class 12

(a) Find the output of the following program:


def calcresult ():
i=9
while i>1 :
if(i%2 = = 0):
x = i%2
i = i – 1
else:
i = i – 2
x = i
print(x**2)
(b) Which data will get added in table Company by following code?
import mysql.connector
con = mysql.connector.connect (
host = “localhost”,
user = “system”,
passwd = “hello”,
database = “connect”).
cur = con.cursor ( )
sql = “insert into Company (Name,
Dept, Salary) values (%s,
%s, %s)”
val = (“ABC”, “DBA”, 35000)
cur.execute (sql.val)
con.commit ( )
Consider :
host : localhost
UserName : system
Password : hello
Database ; connect

33. Does python create a file itself if the file doesn’t exist in the memory? Illustrate your answer with an example:
Write a program using following functions :
(a) inputStud() :To input details of as many students and add them to a csv file “college.csv” without removing the
previous records.
SrNo Studname City Percentage
(b) readCollege() : To open the file “college.csv” and display records whose city is “Kolkata”
 o
Write a statement to create a data.txt file with the following text.
Python file handling is very interesting and useful.
Write a python code using two functions as follows
(a) removerow( ) : To remove a record from the college file “College.csv” having following structure.
SrNo Studname City Percentage
(b) getCollege( ) : To read the records of the college file “College.csv” and display names of students whose names
start with a lowercase vowel.

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 2 Computer Science Class 12

Section - E

34. Consider the table APPLICANTS


TABLE: APPLICANTS
No NAME FEE GEN-DER C_ID JOINYEAR
1012 Amandeep 30000 M A01 2012
1102 Avisha 25000 F A02 2009
1103 Ekant 30000 M A02 2011
1049 Arun 30000 M A03 2009
1025 Amber 40000 M A02 2011
1106 Ela 40000 F A05 2010
1017 Nikita 35000 F A03 2012
1108 Arluna 30000 F A03 2012
2109 Shakti 35000 M A04 2011
1101 Kirat 25000 M A01 2012
(i) Which field qualifies to be the Primary key.
(ii) If all the records of Male applicants are deleted, what will be the cardinality of the table.
(iii) Write statements to
(a) Increase FEE of “M” (Male) applicatnts by 2000.
(b) Display details of “F” (Female) applicants in descending order of FEE.
 o
(Option for part (iii) only)
Write statements to
(a) Change width of column FEE to 20.
(b) Remove the column C_ID.

35. Given below is a code to open a text file and perform some operations on it. Answer questions with respect to the
code given
myfile=open(“detail.txt”, “r”)
s =.......... Line 2
print(s)
myfile.close( )
(i) In which mode is the file opend?
(ii) If the entire file is to be read, write a statement in place of Line 2.
(iii) What is the original code performing?

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 3 Computer Science Class 12

Sample Paper 3
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A

1. What is default value of host?


(a) host (b) localhost
(c) globalhost (d) None of these

2. Which of the following SQL commands displays the structure of a table?


(a) ALTER (b) STRUCTURE
(c) DESCRIBE (d) SHOW DATA

3. State True or False


“Lists and dictionaries are mutable.”

4. Which of the following is the correct output for the execution of the following Python statement?
print(5+3**2/2)
(a) 32 (b) 8.0
(c) 9.5 (d) 32.0

5. Which path does not start with a leading forward slash ?


(a) Relative (b) Absolute
(c) Both (a) and (b) (d) None of these

6. _____command adds a primary key to a table after it has been already created.
(a) MODIFY (b) ADD PRIMARY
(c) ALTER (d) ADD KEY

7. The clause to get the unique values from a field of a table is


(a) MAX (b) UNIQUE
(c) DISTINCT (d) None of these
Click the Following Button to See the Free MS/Solutions
Page 2 NODIA Sample Paper 3 Computer Science Class 12

8. Observe the following tuples and choose the correct option


t1=(4, 7, 8, 9)
t2=(0, 4, 3)
>>>t=t1+t2
>>>print(t)
(a) (4, 7, 8, 9, 0, 4, 3) (b) (4, 7, 8, 9, 4, 7, 8, 9)
(b) (4, 7, 8, 9) (d) None of these

9. ______is an attribute that makes a link between two tables to fetch corresponding data.
(a) Primary key (b) Secondary key
(c) Foreign key (d) Composite key

10. Assume that the position of the file pointer is at the beginning of 3rd line in a text file. Which of the following option
can be used to read all the remaining lines?
(a) myfile.read(n-3) (b) myfile.read(n)
(c) myfile.readline( ) (d) myfile.readlines( )

11. ______is a protocol used for uploading and downloading of files in a network.
(a) SMTP (b) FTP
(c) PPP (d) VoIP

12. sub = “PYTHON”


for i in sub:
print (i, ‘ ’, end = “ ”)
P
Y
T
(a) PYTHON (b) H
O
N

(c) None (d) P, Y, T, H, O, N

13. In complex number a + ib, b represents as


(a) real part (b) imaginary part
(c) special part (d) None of these

14. Given an object obj1= (10, 20, 30, 40, 50, 60, 70, 80, 90). What will be the output of print(obj1[3:7:2])?
(a) (40,50,60,70,80) (b) (40,50,60,70)
(c) (40,50,60) (d) (40,60)

15. Which of the following function returns the total number of values?
(a) MAX (b) MIN
(c) COUNT (d) SUM

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 3 Computer Science Class 12

16. Which of the following is the correct output for the following execution ?
print(print(“Biscope”))
(a) Biscope (b) None
(c) Biscope (d) Error
None

Directions : (Q. Nos. 17 and 18) are Assertion and Reason based questions.

17. Assertion (A) A Python function that accepts parameters can be called without any parameters. Reason (R) Functions
can carry default values that are used, whenever values are not received from calling function.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) A CSV file is by default delimited by comma(,), but the delimiter character can be changed.
Reason (R) The writerow() function for CSV files has a “delimiter” parameter that can be used to specify the
delimiter to be used for a CSV file.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

Section - B

19. What will be the output for the following Python statement?
L = [10, 20, 30, 40, 50]
L = L + 5
print(L)

20. Write any two disadvantages of star topology.


 o
Why is a switch called an intelligent hub?

21. (a) What will be the output of the following Python code?
L =[10, 20]
L1=[30, 40]
L2=[50, 60]
L. append (L1)
L.extend(L2)
print(L)
(b) Find the output
>>> l1 = [1,2,3,4]
>>> l2 = [1,2,3,4]
>>> l1 > l2

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 3 Computer Science Class 12

22. Mention the various advantages of using a DBMS.

23. (a) Write the full forms of the following


(i) WAN (ii) GSM
(b) Write down the expansion of Modem. Also, write its role in a network.

24. Write the output of given code :


x = (1, 2, 3)
y = (3, 4)
t = x + y
print(t)
 o
Observe the following tuple and answer the questions that follow:
t1 = (70, 56, ‘Hello’, 22, 2, ‘Hi’, ‘The’, ‘World’, 3)
(i) t1[2 : 4] (ii) t1[– 6]

25. If R1 is a relation with 8 rows and 5 columns, then what will be the cardinality of R1?
If 5 rows are added more, what will be the Degree of the table now ?
 o
Identify commands/functions for the following actions
(i) To display only records of Trains from the Train table whose starting station is “NDLS”. (Column for starting
station is “Start”, table name is “Train”)
(ii) To get the average of percentage of students (Table name : “Student” , Percentage column : “Perc”).

Section - C
26. (a) Consider the tables CITY and LOCATION given below.
Table : CITY
Field Name Data Type Remarks

CITYCODE CHAR(5) Primary Key

CITYNAME CHAR(30)

SIZE INTEGER

AVGTEMP INTEGER

POPULATIONRATE INTEGER

POPULATION INTEGER

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 3 Computer Science Class 12

Table: Location
Citycode Lname
C1 East
C2 West
C3 South
C4 North
Write a command to display the Cityname and corresponding Location name (Lname), where the average temperature
is greater than 35 from the tables.
(b) Write outputs for the SQL commands (i) to (iv) based on the table CUSTOMER given below:
TABLE: CUSTOMER
CID CNAME GENDER SID AREA

1001 R SHARMA FEMALE 101 NORTH

1002 M R TIWARY MALE 102 SOUTH


1003 M K KHAN MALE 103 EAST

1004 A K SINGH MALE 102 EAST

1005 S SEN FEMALE 101 WEST

1006 R DUBEY MALE 104 NORTH

1007 M AGARWAL FEMALE 104 NORTH

1008 S DAS FEMALE 103 SOUTH

1009 R K PATIL MALE 102 NORTH

1010 N KRISHNA MURTY MALE 102 SOUTH


(i) SELECT COUNT(*), GENDER FROM CUSTOMER GROUP BY GENDER;
(ii) SELECT CNAME FROM CUSTOMER WHERE CNAME LIKE ‘L%’;
(iii) SELECT DISTINCT AREA FROM CUSTOMER;
(iv) SE.LECT’COUNT(*) FROM CUSTOMER WHERE GENDER=“MALE”;

27. Write a Python program that read the data from file ‘original.dat’ and delete the line(s) having word (passed as an
argument). Then write these data after removing lines into file ‘duplicate.dat’.
 o
Write a program in Python to open a text file “lines.txt” and display all those words whose length is greater than 5.

28. (a) Answer the questions (i) to (iv) on the basis of the following tables SHOPPE and ACCESSORIES.
TABLE: SHOPPE
Id SName Area
S001 ABC Computeronics CP

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 3 Computer Science Class 12

S002 All Infotech Media GK II


S003 Tech Shoppe CP
S004 Geeks Tecno Soft Nehru Place
S005 Hitech Tech Store Nehru Place

TABLE: ACCESSORIES
No Name Price Id

A01 Mother Board 12000 S01


A02 Hard Disk 5000 S01

A03 Keyboard 500 S02

A04 Mouse 300 S01


A05 Mother Board 13000 S02

A06 Keyboard 400 S03

A07 LCD 6000 S04

T08 LCD 5500 S05

T09 Mouse 350 S05


T10 Hard Disk 4500 S03

(i) To display Name and Price of all the ACCESSORIES in ascending order of their Price.
(ii) To display Id and SName of all SHOPPE located in Nehru Place.
(iii) To display Minimum and Maximum Price of each Name of ACCESSORIES.
(iv) To display Name, Price of all ACCESSORIES and their respective SName, where they are available.
(b) Write a command to add a new column Remarks varchar(30) to the ACCESSORIES table storing remarks about
the product.

29. Write a userdefined function parser(L) that accepts a list as parameter and creates another two lists storing the
numbers from the original list , that are even and numbers that are odd.

30. Consider the following stack of characters, where STACK is allocated N = 8 memory cells.
STACK : A, C, D, F, K,...,...,...
Describe the STACK at the end of the following operations. Here, Pop and Push are algorithms for deleting and
adding an element to the stack.
(i) Pop (STACK, ITEM)
(ii) Pop (STACK, ITEM)
(iii) Push (STACK, L)
(iv) Push (STACK, P)

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 3 Computer Science Class 12

(v) Pop (STACK, ITEM)


(vi) Push (STACK, R)
(vii) Push (STACK, S)
(viii) Pop (STACK, ITEM)
 o
Consider the following sequence of numbers:
1, 2, 3, 4
These are supposed to be operated through a stack to produce the following sequence of numbers:
2, 1, 4, 3
List the Push and Pop operations to get the required output.

Section D

31. Trine Tech Corporation (TTC) is a professional consultancy company. The company is planning to set up their
new offices in India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and
suggest them the best available solutions. Their queries are mentioned as (i) to (v) below.

Block (From) Block (To) Distance


Human Resource Conference 110
Human Resource Finance 40
Conference Finance 80
Expected number of computers to be in each block
Block Computers
Human Resource 25
Finance 120
Conference 90
(i) Which will be the most appropriate block, where TTC should plan to install their server?
(ii) Draw a block to block cable layout to connect all the buildings in the most appropriate manner for efficient
communication.

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 3 Computer Science Class 12

(iii) Suggest a suitable topology to connect the computers in each building.


(iv) Which of the following device will be suggested by you to connect each computer in each of the buildings?
(a) Switch/Hub (b) Modem (c) Gateway
(v) Company is planning to connect its offices in Hyderabad which is less than 1 km. Which type of network will
be formed?

32. (a) What will be the output of the following code?


value = 50
def display(N):
global value
value = 25
if N%7==0
value = value + N
else:
value = value — N
print(value. end= “#”)
display(20)
print(value)
(b) Given below is a table Item in database Inventory.
ItemID ItemName Quantity UnitPrice
101 ABC 5 120
102 XYZ 7 70
103 PQR 8 65
104 XYZ 12 55
Riya created this table but forget to add column ManufacturingDate. Can she add this column after creation of table?
If yes, write the code where user’s name and password are system and test respectively.
Note the following to establish the connection between Python and MySQL:
Host : localhost
Username : system
Password : test
Database : Inventory
 o
(a) Find the output of the following code :
Name= “PythoN3@1”
R=“ ”
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x–1]
else:
R=R+ “#”
print(R)

Click the Following Button to See the Free MS/Solutions


Page 9 NODIA Sample Paper 3 Computer Science Class 12

(b) Consider the following table structure


Table: Faculty
F_ID(P)
Fname
Lname
Hire_date
Salary
Write the Python code to create the above table.
Consider :
host : localhost
UserName : root
Password : system
Database :School

33. What do you mean by file? What do you mean by file handling?
Write a program code in python to perform the following using two functions as follows :
(a) addBook( ) : to write to a csv file “book.csv” file book no, book name and no of pages with separator as tab.
(b) countRecords( ) : To count and display the total number of records in the “book.csv” file
 o
Explain open( ) function with its syntax.
Write python code to perform the following using two user defined functions.
(a) showData() : To display only roll no and student name of the file “student.csv”

RollNo, Name, Marks


1, Nilesh, 65
2, Akshay, 75
(b) showSelect( ) : To display only roll number and marks of the students from the csv file “student.csv”

Section-E

34. Consider the following table STORE and answer the questions:
TABLE: STORE
ItemNo Item Scode Qty Rate LastBuy
2005 Sharpener Classic 23 60 8 31-JUN-09
2003 Balls 22 50 25 01-FEB-10
2002 Gel Pen Premium 21 150 12 24-FEB-10
2006 Gel Pen Classic 21 250 20 11-MAR-09
2001 Eraser Small 22 220 6 19-JAN-09
2004 Eraser Big 22 110 8 02-DEC-09
2009 Ball Pen 0.5 21 180 18 03-NOV-09

Click the Following Button to See the Free MS/Solutions


Page 10 NODIA Sample Paper 3 Computer Science Class 12

(i) What is the degree of the table?


(ii) Write the syntax of the SQL command to change data of the table.
(iii) Write statements to :
(a) Display the number of distinct Scodes.
(b) Display the maximum and minimum quantities.
(Option for part (iii) only)
Write statements to :
(a) Display the structure of the STORE table.
(b) Add a new column Location varchar(50) in the table to store the location details of the items.

35. Given below is a code to open a text file “para.txt” and display the lines that begin with “A”.Some of the codes are
missing . Write codes to fill up the blanks :
myf=open(... ,...) Blank 1 , Blank 2
lines=myf....... . Blank 3
for ln in .... . . : Blank 4
if ln[0]= = “A”:
print(ln)
(i) Write the missing code for Blank 1.
(ii) Write the missing code for Blank 2.
(iii) Write the missing code for Blank 3 and Blank 4.

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 4 Computer Science Class 12

Sample Paper 4
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. Given L= [2,3,4,5,6]. The output of print(L[–1:–5]) is
(a) [6,5,4] (b) Error
(c) [ ] (d) [6,5]

2. Rows of a relation are called


(a) relation (b) tuples
(c) data structure (d) an entity

3. If a table carries 10 columns and 15 rows, what is its degree?


(a) 10 (b) 150
(c) 15 (d) 25

4. The...........function returns True if all the characters in a string are digits.


(a) isalnum() (b) isdigit()
(c) isnumber() (d) isalpha()

5. The seek(n) places the file pointer at position n with reference to


(a) Beginning (b) End
(c) Current position (d) Position 10

6. Given a tuple t= (2,5,1,6,3). The statement t.sort() returns


(a) (1,2,3,5,6) (b) (6,5,3,2,1)
(c) Error (d) None of these

7. t1=(9,6,7,6)
t2=(2.8,12,20)
The output of the statement below is
print( min(t1) + max(t2))
(a) 26 (b) 25
(c) Error (d) None of these

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 4 Computer Science Class 12

8. State True or False


“The method that can be used to delete a range of values from a list is del”.

9. In which module, ceil() function resides ?


(a) pandas (b) pyplot
(c) random (d) math

10. To see a list of all the databases in the system , the..............command may be used.
(a) Show (b) Show databases
(c) Display databases (d) View databases

11. Which among the following are constraints ?


(a) Primary key (b) Unique
(c) NOT NULL (d) All of these

12. in and not in are........Operators.


(a) Arithmetic (b) Membership
(c) Logical (d) Identity

13. Modulation and demodulation is performed by


(a) microwave (b) satellite
(c) modem (d) gateway

14. A set of possible data values is called


(a) attribute (b) degree
(c) tuple (d) domain

15. The..........attribute of the connection string specifies the password to connect to the database.
(a) code (b) password
(c) passwd (d) All of these

16. While opening a binary file the.........character has to be added to the mode of opening.
(a) b (b) x
(c) u (d) b*

Directions (Q.Nos. 17-18) are Assertion and Reason based questions.

17. Assertion (A) A function with 3 formal parameters must be called with 3 actual parameters.
Reason (R) Since, all the formal parameters are used to produce the output from the function , the function expects
the same number of parameters from the function call.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) A binary file uses the dump() function to write data into it.
Reason (R) The load() function reads data from a binary file.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is True but R is false.
(d) A is false but R is true.
Click the Following Button to See the Free MS/Solutions
Page 3 NODIA Sample Paper 4 Computer Science Class 12

Section B
19. What will be the output of following code ?
L=[10,30,50,60]
L.append(70)
L.insert(2,80)
L.sort()
print(L)

20. Write 2 advantage and 2 disadvantage of bus topology.


 o
Which part of TCP/IP is responsible for dividing a file or message into very small parts, at the source computer?
Also, define, TCP/IP.

21. Find outputs of following code.


(a) L=[118,16,[20,30,50],120]
L1=[12,16,17]
L.extend(L1)
print(L[2][2])
print(L)
(b) t1=(9,6,1,12)
t2=(10,11,12)
print(t1+t2)
print(t1*2)
print(t2–t1)

22. What do you understand by primary key? Give a suitable example of primary key from a table containing some
meaningful data.

23. (a) Write the full forms of


(i) LAN (ii) XML
(b) What was the role of ARPANET in the computer network?

24. What will be the output of the following code, when executed?
d={‘Name’: ‘Ram’,‘Subjects’:[‘Eng’, ‘Physics’, ‘CS’], ‘Marks’:[67,78,90]}
print(d[‘Subjects’])
print(d[‘Subjects’][2])
 o
What will be the output of the following code, when executed?
tupnames=(“India”, “Australia”,
(“UK”, “Nepal”), “Bangladesh”)
print(tupnames[5 : ])
print(tupnames[2][1])

25. List the major components of a database system.


 o
What is join? What are the different kinds of joins?

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 4 Computer Science Class 12

Section C

26. (a) Consider the tables Student and House given below. What will be the output of the statement given?
Table: Student
Rno Sname Class Hcode
1 Raj 12ScA C1
2 Shekhar 11ComC C2
3 Ravi 12HumB C2
4 Jaisnav 12ScB C3

Table: House
Hcode Lname
C1 East
C2 West
C3 South
C4 North
SELECT S.Sname , H.Lname FROM Student S, House H WHERE S.Hcode = H.Hcode AND
SName LIKE “R%”;
(b) Consider the following table STORE and answer the questions
TABLE: STORE
ItemNo Item Scode Qty Rate LastBuy
2005 Sharpener Classic 23 60 8 31-JUN-09
2003 Balls 22 50 25 01-FEB-10
2002 Gel Pen Premium 21 150 12 24-FEB-10
2006 Gel Pen Classic 21 250 20 11-MAR-09
2001 Eraser Small 22 220 6 19-JAN-09
2004 Eraser Big 22 110 8 02-DEC-09
2009 Ball Pen 0.5 21 180 18 03-NOV-09
Write SQL commands for the following statements:
(i) To display details of all the items in the STORE table in ascending order of LastBuy.
(ii) To display ItemNo and Item name of those items from STORE table, whose Rate is more than `15.
(iii) To display the details of those items whose Supplier code (Scode) is 22 or Quantity in Store (Qty) is more than
110 from the table STORE.
(iv) To display minimum rate of items for each Supplier individually as per Scode from the table STORE.

27. Write a program to accept a filename and a position. Using the inputs, call a function SearchFile(Fname, pos) to
read the contents of the file from the position to the end. Now, display all those words that start with “U” or “u”.
 o
Write a program to search a Employee record according to Id from the “emp.txt” file. The “emp.txt” file contains
Id, Name and Salary fields. Assume that first field of the employee records (between Id and Name) is separated with
a comma(,).

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 4 Computer Science Class 12

28. (a) Consider the following tables GARMENT and FABRIC. Write SQL commands for the statements (i) to (iv).
TABLE: GARMENT
GCODE DESCRIPTION PRICE FCODE READY-DATE
10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10007 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 20-OCT-08

TABLE: FABRIC
FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE
(i) To display GCODE and DESCRIPTION of each GARMENT in descending order of GCODE.
(ii) To display the details of all the GARMENTs, which have READYDATE in between 08-DEC-07 and 16-
JUN-08 (inclusive of both the dates).
(iii) To display the average PRICE of all the GARMENTs. Which are made up of FABRIC with FCODE as F03.
(iv) To display FABRIC wise highest and lowest price of GARMENTs from GARMENT table. (Display
FCODE of each GARMENT along with highest and lowest price.)
(b) Write a command to remove the records of the garments whose READYDATE is after DEC-2008.

29. Write a user defined function change(L) to accept a list of numbers and replace the number in the list with its
factorial.
Example :
Input : [3,4,5,6,7]
Output: [6, 24, 120, 720, 5040]

30. Suppose STACK is allocated 6 memory locations and initially STACK is empty (Top = 0). Given the output of the
program segment:
AAA = 4
BBB = 6
Push (STACK, AAA)
Push (STACK, 4)
Push (STACK, BBB +2)
Push (STACK, AAA + BBB)

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 4 Computer Science Class 12

Push (STACK, 10)


while (Top>0):
Element = STACK.Pop( )
print(Element)
o
Consider the following operations are done on a stack. What will be the final status of the stack after all the
operations are performed.
(a) Push(True) (b) Push(False) (c) Push(10)
(d) Pop() (e) Push(50) (f) Push(70)
(g) Pop() (h) Pop()

Section D
31. Granuda consultants are setting up a secured network for their office campus at Faridabad for their day-to-day office
and web based activities. They are planning to have connectivity between 3 buildings and the head office situated
in Kolkata.
Answer the questions (i) to (v) after going through the building positions in the campus and other details, which are
given below:
Distance between various buildings
Building RAVI to Building JAMUNA 120 m
Building RAVI to Building GANGA 50 m
Building GANGA to Building JAMUNA 65 m
Faridabad Campus to Head Office 1460 km

Number of computers
Building RAVI 25
Building JAMUNA 150
Building GANGA 51
Head Office 10
(i) Suggest the most suitable place (i.e. block) to house the server of this organisation. Also, give a reason to justify
your suggested location.
(ii) Suggest a cable layout of connections between the building inside the campus.
(iii) Suggest the placement of the following devices with justification:
(a) Switch (b) Repeater
(iv) The organisation is planning to provide a high speed link with its head office situated in the Kolkata using a
wired connection. Which of the following cable will be most suitable for this job?
(a) Optical fibre (b) Co-axial cable
(c) Ethernet cable
(v) Consultancy is planning to connect its office in Faridabad which is more than 10 km from Head office. Which
type of network will be formed?

32. (a) The code given below will give an error on execution. Identify the type of the error and modify the code to
handle such type of an error.

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 4 Computer Science Class 12

x = int(input(“Enter the value of


x : ”))
y = int(input(“Enter the value of
y : ”))
z = x/y
print (“The value of z : ”, z)
(b) Note the following to establish the connection between Python and MySQL:
A resultset is extracted from the database using the cursor object (that has been already created) by giving the
following statement.
Mydata=cursor.fetchone( )
(i) How many records will be returned by fetchone() method?
(ii) What will be the datatype of Mydata object after the given command is executed?
 o
(a) Predict the output :
str = “Python Program”
def sTringoutput(str):
print(str[3:5])
print(str[–10])
print(str[5:])
print(str[–28])
(b) Define fetchmany([size]). How does fetchone() method differ from fetchall() method?

33. What are the advantages of CSV files?


Write a python program using following functions to :
A file “teacher.csv” contains a city, teacher name and Salamount.
(a) Search() : Search and print all rows where city is “delhi”.
Sample “teacher.csv” :
City Teacher Name Salamount
Delhi, Anil Sharma, 10000
Pune, Mr Dua, 20000
Delhi, Mr Das, 25000
(b) Searchfromfile() : From the file “teacher.csv” print all rows where teacher name is “Anil”.
 o
What are the Disadvantages of CSV files?
Write a program using functions :
(a) addTransaction() : To append bank transactions of following structure to “bank.csv”
TranlD TranDate Amount Type
(b) getTran() : To display those transactions whose type is “Deposit”.

Section E
34. Consider the following table Student:
Table : Student
AdmNo RollNo Name Class Marks
2715 1 Ram 12 90

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 4 Computer Science Class 12

2816 2 Shyam 11 95
2404 3 Ajay 10 92
2917 4 Tarun 12 94
(i) Can we make Class as the Primary key of the table?
(ii) What is the cardinality of the table?
(iii) Write statements to :
(a) Display the average Marks .
(b) Display the different Classes .
or (Option for part (iii) only)
Write statements to :
(a) Change the data type of Marks column so that it can take fractional values upto 2 decimals .
(b) Increase width of Name column to varchar(50).

35. The code given below opens a binary file and writes records of customer’s roomid, Name and days of stay . Some
of the codes are missing .Write codes to fill up the blanks :
import....... # Blank1
hotellst=[]
cname=“ ”
days=0.0
roomid=0
ans=‘y’
f=open(“hotel.dat”, “wb”)
print(“Welcome to my Hotel ”)
while ans== ‘y’:
roomid=input(“Enter Roomld :”)
cname=input(“Enter Customer name
:”)
days=float(input(“Enter days of
stay :”))
hotellst=[...., ....., .....]
# Blank2 To create the record to
be written .........# Blank3 To
write the data to the binary file.
ans=input(“Continue(y/n)”)
f.close()
(i) Write the missing code for Blank1.
(ii) Write the missing code for Blank2.
(iii) Write the missing code for Blank3.

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 5 Computer Science Class 12

Sample Paper 5
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. _____command modifies or change the existing records in a table.
(a) UPDATE (b) CHANGE
(c) ALTER (d) MODIFY

2. Which of the following operator cannot be used with string data type?
(a) + (b) in
(c) * (d) /

3. Which of the following is a category of SQL commands?


(a) DDL (b) TCL
(c) DML (d) All of these

4. What is the output of the following code?


num = 4 + float (7)/int (2.0)
print (“num =”, num)
(a) num = 7.5 (b) 7.5
(c) num : 7.5 (d) Error

5. Given : s= “ComputerExam”. What will be the output of


print(s[2]+s[8]+s[1:51)?
(a) mEOMUU (b) mEompu
(c) mEomPU (d) MEompu

6. State True or False


Digits are one of the parts of the Python character set

7. The clause to arrange the data of a column in descending order is


(a) DESC (b) GROUP BY
(c) LIKE (d) ASC

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 5 Computer Science Class 12

8. Which of the following are the most obvious kind of constants?


(a) Keywords (b) Literals
(c) Variables (d) Identifiers

9. Which of the following types of files will need the pickle module for working on it ?
(a) Binary files (b) Text files
(c) CSV files (d) All of these

10. In the following code, which lines will give error? (Assume the lines are numbered starting from 1.)
mul=3
value=10
for i in range (1, 6, 1):
if (value % mul = 0):
print (value * multiply)
else
print (value + multiply)
(a) 4,5
(b) 4,5,6
(c) 4,5,6,7
(d) No errors

11. There can be____foreign keys in a relation.


(a) 2 (b) 3
(c) 1 (d) Multiple

12. The_____clause with the COUNT() function counts only the unique values in an attribute.
(a) UNIQUE (b) HAVING
(c) DISTINCT (d) LIKE

13. User can write Python script using


(a) MySQL.connector library (b) SQL.connect library
(c) MySQL.connect library (d) None of these

14. _____is a protocol used for remote login.


(a) HTIT (b) PPP
(c) IRCP (d) Telnet

15. Which of the following functions will read lines of a text file as list elements.
(a) read( ) (b) get()
(c) readline( ) (d) readlines( )

16. Which of the following will be the output of the statement given below?
print([12,34,56,78,90].pop())
(a) 78 (b) 90
(c) 12 (d) 12,34,56,78,90

Direction (Q.Nos. 17-18) are Assertion and Reason based questions.

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 5 Computer Science Class 12

17. Assertion (A) In a cross join the number of records in the output will be the maximum.
Reason (R) A cross join is also called a Cartesian product.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) A file that is opened using the open() function may not specify the mode of opening it.
Reason (R) If the mode is not specified , the read mode is used by default..
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

Section B
19. Observe the given list and find the answer of questions that follows.
list1 = [23, 45, 63, ‘Hello’, 20
‘World’, 15, 18]
(i) list1[–3] (ii) list1[3]

20. What is the advantage of using switch over hub?


 o
Write some benefits of networking.

21. (a) Find the output


L = [10, 19, 45, 77, 10, 22, 2]
(i) L [3 : 5] (ii) L [: : –2]
(b) Find the error(s).
L1 = [7, 2, 3, 4]
L2 = L1 + 2
L3 = L1 * 2
L = L1.pop(7)

22. What do you understand by RDMS?

23. (a) Write the full forms of :


(i) POP (ii) HTTP
(b) Differentiate between the terms Internet and Intranet.

24. Predict the output


dic = {‘a’:1, ‘b’:2, ‘c’:3, ‘d’:4}
print(dic)
if ‘a’ in dic :
del dic[‘a’]
print(dic)
 o

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 5 Computer Science Class 12

Distinguish between tuple and list.

25. Explain the concept of candidate keys with the help of an appropriate example.
 o
Observe the following table carefully and write the names of the most appropriate columns, which can be considered
as (i) candidate keys and (ii) primary key.
Table: Product
CID CNAME AMOUNT COUNTRY ITEM
101 ALLE 100000 JMEKA SHOES
111 BEN 20000 FRANCE HELMET
110 RIKI 25000 AMERICA BAG
011 BRETT LEE 105000 AUSTRALIA BAT

Section C
26. (a) Consider the tables Travel and Train given below.
Table : Travel
Tcno Pname Class TId Amt
1 Rahul AC T1 2500
2 Sujit SL T2 4500
3 Ravi AC T1 6000
4 Ankita AC T3 1800

Table : Train
TId Tname
T1 Rajdhani
T2 Himgiri Exp
T3 Darjeeling Mail
Write the command to display the passenger names and the train names by which they are travelling for all passengers
travelling by “Mail” trains.
(b) Considering the tables Train and Travel given above write commands for the following :
(i) Display passenger names , corresponding train names and amounts for records where amount >5000.
(ii) Increase amount of passengers by 20% who are travelling by ‘AC”
(iii) Display a cross join of the two tables.
(iv) Remove records of passengers who are travelling by “Rajdhani”.

27. A binary file “emp.dat” contains records of employees as per following structure:
Eno Ename Salary
1 Mr. Raj 85000
h
Write a program in Python to open the Binary file “emp.dat” and display only those records where the employee
salary is greater than 75000.
 o

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 5 Computer Science Class 12

Write a program to read the content from a text file “status.txt”, count and display the total number of lines and blank
spaces present in it. e.g. if the “status.txt” file contains the following lines:
Welcome to your one-step solutions for all your study, practice and assessment needs for various competitive &
recruitment examinations and school segment. We have been working tirelessly for over a decade to make sure that
you have best in class study resources because you deserve SUCCESS AND NOTHING LESS...
The output will be:
The status file contents are
Total lines in file are: 4
Total spaces in file are: 43

28. (a) Consider the following tables SENDER and RECIPINT. Write SQL commands for the statements (i) to (iv).
TABLE: SENDER
SenderlD SenderName SenderAddress SenderCity
ND01 R Jain 2, ABC Appts New Delhi
MU02 H Sinha 12, Newtown Mumbai
MU15 S Jha 27/A, Park Street Mumbai
ND50 T Prasad 122-K, SDA New Delhi

TABLE: RECIPIENT
RecID SenderlD RecName RecAddress RecCity
KO05 ND01 R Bajpayee 5, Central Avenue Kolkata
ND08 MU02 S Mahajan 116, A Vihar New Delhi
MU19 ND01 H Singh 2A, Andheri East Mumbai
MU32 MU15 P K Swamy B5, C S Terminus Mumbai
ND48 ND50 S Tripathi 13, B1 D, Mayur New Delhi
Vihar
(i) To display the names of all Senders from Mumbai.
(ii) To display the RecID, SenderName, SenderAddress, RecName, RecAddress for every Recipient.
(iii) To display Recipient details in ascending order of RecName.
(iv) To display number of Recipients from each City.
(b) Display the Sender name and corresponding Recipient name from the tables where sender is from “NEW
DELHI” and recipient is from “KOLKATA”.

29. Write a user defined function change(L) to accept a list of numbers and replace the numbers in the list with their
sum of digits.
Example
Input : [32,142,215,26,7]
Output : [5, 7 , 8 , 8, 8,7]

30. Write Push (contents) and Pop() methods in Python to add numbers and remove numbers considering them to act as
Push and Pop operations of stack.
 o
Find the final contents of a stack on which the following operations are done.
1. Push(100) 2. Push(200)
3. Push(50) 4. Push(50)

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 5 Computer Science Class 12

5. Pop() 6. Push()
7. Pop(2) 8. Pop()

Section D
31. Freshminds University of India is starting its first campus in Ana Nagar of South India with its centre admission
office in Kolkata. The university has three major blocks comprising of Office block, Science block and Commerce
block is in 5 km area campus.
As a network expert, you need to suggest the network plan as per (i) to (v) to the authorities keeping in mind the
distance and other given parameters.

Expected wire distance between various locations.


Office Block to Science Block 90 m
Office Block to Commerce Block 80 m
Science Block to Commerce Block 15 m
Kolkata Admission Office to Ana Nagar Campus 450 km
Expected number of computers to be installed at various locations in the university are as follows:
Office Block 10
Science Block 140
Commerce Block 30
Kolkata Admission Office 8
(i) Suggest the authorities, the cable layout amongst various blocks inside university campus for connecting the
blocks.
(ii) Suggest the most suitable place (i.e. block) to house the server for this university with a suitable reason.
(iii) Suggest an efficient device from the following to be installed in each of the block to connect all the computers.
(a) Modem (b) Switch (c) Gateway
(iv) Suggest a suitable topology to connect the computers in each building.
(v) University is planning to connect its campus in Kolkata which is more than 100 km. Which type of network will
be formed?

32. (a) Underline the syntax errors in the following program


x = int(input(“Enter first number:))
y = int(input(“Enter second number:”))
z = int(input(“Enter third number:”)
a = x+ b+ z
print (“Result = ”, b)

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 5 Computer Science Class 12

(b) Write the code to create the following table Student with the following fields
RollNo FirstName LastName Address ContactNo
ContactNo Marks Course Rank
In the table, Rank should be Good, Best, Bad, Worst, Average.
 o
(a) Differentiate between a logical error and syntax error. Also, give suitable examples of each in Python.
(b) What is the use of fetchone() method? Write an example code to fetch a single record from a database.
Note :
Database : PythonDB
Table : Student
Host : localhost
UsedlD : root
Password : arihant

33. Which module is used to operate on CSV file?


Write a python program with following functions :
(a) addcsv():
File old.csv has come from branch in Pune and it needs to be added to file “updated.csv” which has data for all
branches. Write the code in the function to perform the same.
(b) convertcsv() :
A file old.csv has come with separator ‘:’ but your system can only read ‘;’ Write a program to convert to
“converted.csv” file. Write the function to change the separator of the file.
 o
CSV files are opened with which argument to suppress EOL translation. Write a python program to perform the
following using functions as follows :
(a) copytocsv() :
A CSV file “marks.csv” has name, class and marks separated by comma. Write the Python function to copy only
the name and class to another CSV file “class.csv”.
(b) copyselected() :
The CSV file “marks.csv” which has name, class and marks separated by comma. Write the Python function to
copy only rows of students of class 2 to another CSV file “class.csv”.

Section E
34. Consider the following table Person
P_Id LastName First Name Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
(i) What should be the constraint(s) of the P_Id column?

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 5 Computer Science Class 12

(ii) If 3 columns are added to the table , what will be its degree?
(iii) Write statements to :
(a) Display the Unique Cities.
(b) Display Firstnames of people who do not have a address.
 (Option for part (iii) only)
o
Write appropriate data types to store the following :
(a) Amounts carrying values with decimal.
(b) Joining dates.

35. The code given below reads a text file and displays those words that begin with an uppercase vowel and end with a
lowercase vowel . Some of the codes are missing .Write codes to fill up the blanks.
f=open(“emp.txt”)
filedata=f.read()
count=0
print(filedata)
data=filedata.split(‘ ’)
for.......... in data : #Blank1
if words[–1] in “aeiou” and ...in “AEIOU”: # Blank2
print(......... .) # Blank3
f.close()
(i) Write the missing code for Blank1.
(ii) Write the missing code for Blank2.
(iii) Write the missing code for Blank3.

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 6 Computer Science Class 12

Sample Paper 6
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. The output of the code will be :
L=[6,7,8,9,10]
print(L[2:20])
(a) [8, 9, 10] (b) [ ]
(c) Error (d) [6,7,8,9,10]

2. The random function returns a random value between


(a) 1 and 10 (b) 0 and 10
(c) 0 and 1 (d) 1 and 100

3. To read three characters from a file object f, we use..........


(a) f.read(3) (b) f.read()
(c) f.readline() (d) f.readlines()

4. State True or False


“The pop() method removes and displays the last element of a list.”

5. ............are drawn using certain special purpose symbols.


(a) Algorithm (b) Pseudocode
(c) Flowchart (d) Decision table

6. To arrange a table in descending order of field Salary the clause to be used is


(a) Order by Salary (b) Order by Salary Desc
(c) Arrange by SalaryDesc (d) Arrange by Salary

7. The BETWEEN clause can not be used for


(a) Integer Fields (b) Varchar Fields
(c) Date Fields (d) None of these

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 6 Computer Science Class 12

8. The constraint that ensures that the field does not get any NULL values is
(a) NULL (b) PRIMARY KEY
(c) CHECK (d) NOT NULL

9. is and is not are_____Operators.


(a) Membership (b) Identity
(c) Logical (d) Comparison

10. What will the following code display?


name = “Neha”
type (name)
(a) Invalid function <type>
(b) <class ‘str’>
(c) <class ‘int’>
(d) <class ‘float’>

11. Which of the following is not required while specifying the connection string in database connection?
(a) Host (b) Table name
(c) Username (d) Password

12. The ALTER TABLE command belongs to.............category


(a) DML (b) TCL
(c) DDL (d) DCL

13. Which of the following are possible relational operations?


(a) Join (b) Selection
(c) Cartesian product (d) All of these

14. Given a tuple tup = (20,50,10,60,30). The statement append(90) returns


(a) (20,50,10,60,30,90) (b) (90)
(c) Error (d) (30,90)

15. To open a text file for adding records keeping the existing records the mode should be
(a) ab (b) xb
(c) rb (d) w+

16. A device that connects two dissimilar networks is


(a) Modem (b) Repeater
(c) Bridge (d) Gateway

Directions : (Q.Nos. 17-18) are Assertion and Reason based questions.

17. Assertion (A) Binary files are processed faster than text files.
Reasoning (R) They are written in Binary format and are more close to the computer.
(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.

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 6 Computer Science Class 12

18. Assertion (A) A function that is neither built in nor modular must be defined.
Reason (R) The code of built in and modular functions are available for the Python compiler , but if the function is
not defined anywhere the compiler cannot get the code.
(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.

Section B
19. Observe the code given below and find the output.
s=“OceanView”
print(s[8] +s[2:] +str(len(s)))

20. What is the purpose of switch in a network?


 o
Write names of few network devices.

21. (a) What is the output of below questions?


l1 = [23, 45, 19, 77, 10, 22]
(i) l1.sort()
(ii) max(l1)
(b) Find error in defination of the function given.
def finderrors(x=20,y)
print(x+y*2)

22. List some commonly used DBMS software packages.

23. (a) Write the full forms of


(i) HTML
(ii) HTTPs
(b) Write any two advantages of tree topology.

24. What output will the following code produce?


empdict={‘Eno’:[1,2,3,4], ‘Ename’ : [‘Raj’, ‘Seema’, ‘John’, ‘Smith’],
‘Sal’:[10000, 20000, 30000, 40000]}
print(empdict[‘Ename’][0], empdict[‘Sal’][0])
 o
Write any two differences between Dictionary and Tuple.

25. Mention atleast three limitations of DBMS.


o
What are primary and alternate key in a database? Give suitable example to explain each.

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 6 Computer Science Class 12

SECTION C
26. Consider the tables Hotel and Room given below :
Table : Hotel
TId CName Roomld DtofArrival Charges
T1 Ritesh R1 2016-09-09 1800
T2 Sumana R2 2020-08-01 2000
T3 Abhi R3 1995-04-05 3000
T4 Ram R1 1994-02-02 2500
T5 Nitin R2 NULL 7000

Table : Room
RoomlD RoomType FLoor
R1 AC First
R2 Deluxe Second
R3 General Second
(a) Write a command to display the customer names and the types of rooms in which they are staying.
(b) With respect to the tables given above, write SQL commands for the following.
(i) Create the table hotel and insert the 1st record
(ii) Display the details of customers who have arrived after 01-05-2005
(iii) Display names and room types of customers whose charges are between 2000 and 3000.
(iv) Display Names of customers who are staying in “AC” rooms”

27. A binary file “data.dat” contains records of students as per following structure :
Ano Sname Marks
1 Raj 850
h
h
Write a Program in Python to search for a student whose number/id is input by the user. If not found appropriate
message should be displayed.
 o
Write a program with method countand ( ) to count the word ‘and’ or And’ as an independent word in a text file
“status.txt”. e.g. if the content of the file “status. txt” is as follows:
Welcome to your one-step solutions for all your study, practice and assessment needs for various competitive &
recruitment examinations and school segment. We have been working tirelessly for over a decade to make sure that
you have best in class study resources because you deserve SUCCESS AND NOTHING LESS...
Then the output of the program should be: Count of _and_ in file is/are: 3

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 6 Computer Science Class 12

28. (a) Write the SQL commands for (i) to (iv) on the basis of the table HOSPITAL
TABLE: HOSPITAL
No Name Age Department Date-ofadm Cha-rges Sex
1 Sandeep 65 Surgery 23/02/98 300 M
2 Ravine 24 Orthopaedic 20/01/98 200 F
3 Karan 45 Orthopaedic 19/02/98 200 M
4 Tarun 12 Surgery 01/01/98 300 M
5 Zubin 36 ENT 12/01/98 250 M
6 Ketaki 16 ENT 24/02/98 300 F
7 Ankita 29 Cardiology 20/02/98 800 F
8 Zareen 45 Gynaecology 22/02/98 300 F
9 Kush 19 Cardiology 13/01/98 800 M
10 Shailya 31 Nuclear Medicine 19/02/98 400 M
(i) To show all information about the patients of Cardiology Department.
(ii) To list the name of female patients, who are in Orthopaedic Department.
(iii) To list names of all patients with their date of admission in ascending order.
(iv) To display Patient’s Name, Charges, Age for male patients only.
(b) Write the command to view all the tables in database.

29. Write user defined functions factors(num) and factorial(num) to find the factors and factorial of a number accepted
from the user and passed to the functions from main function.

30. Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period(.) except digits. Assume that Pname is a class instance attribute.
 o
Find the final contents of a stack that encounters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes the result
to the stack.
45, 30, + , 50, 80, +, +

Section D
31. Quick Learn University is setting up its academic blocks at Prayag Nagar and planning to set up a network. The
university has three academic blocks and one human resource Centre as shown in the diagram below:

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 6 Computer Science Class 12

Centre to Centre distance between various blocks/Centre is as follows:


Law Block to Business Block 40 m
Law Block to Technology Block 80 m
Law Block to HR Centre 105 m
Business Block to Technology Block 30 m
Business Block to HR Centre 35 m
Technology Block to HR Centre 15 m
Number of computers in each of the blocks/centre are as follows:
Law Block 15
Technology Block 40
HR Centre 115
Business Block 25
(i) Suggest the most suitable place (i.e. block/Centre) to install the server of this university with a suitable reason.
(ii) Suggest an ideal layout for connecting these block/Centre for a wired connectivity.
(iii) Which device you will suggest to be placed/installed in each of these blocks/Centre to efficiently connect all the
computers with in these blocks/Centre ?
(iv) The university is planning to connect its admission office in the closest big city, which is more than 250 km from
university, which type of network out of LAN, MAN or WAN will be formed? Justify your answer.
(v) Expand the following
LAN
WAN

32. (a) Underline the errors in the following code and write the correct code :
while s>0
if a%2=0
print(a%2)
elseif a%3=0 then
print(a%3)
(b) What is database connectivity? How to create a connection object?
 o
(a) Differentiate between identifier and keyword.
(b) What conditions or terms are included by BD-API?

33. What does csv writer() function do?


Write a python program for operating on a csv file “people.csv” using following functions :
(a) addPeople() :To input details of people and add them to a csv file “people.csv” without removing the previous
records. The record structure is as follows :
AdhrNo Name City Age
The file should store only those people whose age is greater than and equal to 18.
(b) getPeople() : To open the file “people.csv” and display records whose name starts with “P”
 o
What is the use of writerow() function?
A file “Toys.csv” exists storing details of toys as per following structure :
ToyID Toyname Category Cost
Write a program in python with functions as follows

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 6 Computer Science Class 12

(a) addToy() : To append data of toys and store them to the file “Toys.csv” only if the Toy category is “Boys”.
Also display the number of toys added.
(b) showToys() : To open the file “Toys.csv” and display records of toys whose cost is above 1000.

Section E
34. Consider the following table Cab :
Table : Cab
CablD CabType Nop Rate
Cb1 Sedan 4 40
Cb2 Yellow Taxi 5 25
Cb3 Mini 3 30
Cb4 Micro 2 20
(i) Which column qualifies to be the primary key?
(ii) Write a command to display the fields of the table along with their types and sizes.
(iii) Write statements to :
(a) Add a new column Driver varchar(30)
(b) Change data type of Rate column to float(6,1).
(Option for part (iii) only)
(a) To display the cab type whose rate is more than 25.
(b) To display cab id and Number of passengers for cab sedan.

35. Riya wrote a program to search any string in text file “school”. Help her to execute the program successfully.
def check () :
datafile = open (.....)
found = input (“Enter any string to
be searched : ”)
f = False
for line in ....... :
if found in line :
f = .......
break
return f
f = check ()
if (f = =.......) :
print (“True”)
else :
print (......)
(i) Riya should open which file to search any string?
(ii) Which value will assign to f in Line 7?
(iii) Fill the blank in Line 5.

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 7 Computer Science Class 12

Sample Paper 7
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A

1. Which of the following functions write data to a binary file?


(a) pickle() (b) writer()
(c) load() (d) dump()

2. _____can be create using cursor( ) method of connection object.


(a) Cursor object (b) Cursor variable
(c) Connect (d) None of these

3. _____command displays the contents of a table.


(a) DISPLAY (b) VIEW
(c) SELECT (d) SHOW

4. State True or False


Integer is a mutable data type in Python.

5. Identify the output of the following Python statement:


b = 1
for a in range(1, 10, 2):
b += a + 2
print(b)
(a) 31 (b) 33
(c) 36 (d) 39

6. Which of the following Python function displays the memory id of a variable?


(a) type( ) (b) str( )
(c) getid( ) (d) id( )

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 7 Computer Science Class 12

7. Which of the following is an advantage of SQL?


(a) High speed (b) Client/Server language
(c) Easy to learn (d) All of these

8. Which of the following operator performs an integer division?


(a) * (b) //
(c) / (d) **

9. Predict the output of the following program:


a = 5
b = a = 15
c = (a < 15)
print (“a = ”, a)
print (“b = ”, b)
print (“c = ”, c)
(a) a=15 (b) a=15
b=15 b=10
c=False c=True
(c) a=15 (d) None of these
b=None
c=False

10. Given s=“AISSE@2023”. What will be the output of print(s[-1: :-1])?


(a) ‘3202@ESSIA’ (b) 3
(c) AISSE (d) ESSIA

11. A primary key of a relation must be_____.


(a) UNIQUE only (b) NOT NULL only
(c) Both UNIQUE and NOT NULL (d) Neither UNIQUE nor NOT NULL

12. The........clause can group records on the basis of common values in a field.
(a) AGGREGATE (b) GROUP
(c) GROUP BY (d) JOIN

13. The python function that adds a list at the end of another list is
(a) join() (b) add()
(c) append() (d) extend()

14. Which of the following functions will read entire contents of a text file?
(a) read() (b) readfull()
(c) readline() (d) readfile()

15. The cross join is also called


(a) Merging (b) Cartesian product
(c) Natural join (d) Equi join

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 7 Computer Science Class 12

16. ______is the base protocol for all application protocols.


(a) FTP (b) TCP/IP
(c) IRCP (d) Telnet

Direction : (Q.Nos. 17-18) are Assertion and Reason based questions.

17. Assertion (A)Pickling is a way to convey a Python object into character stream.
Reason (R) To perform pickling, the pickle module needs to be imported.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true. A.

18. Assertion (A) A recursive function does not require a loop.


Reason (R) A recursive function calls itself again and again until a certain condition is true.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

Section B
19. Observe the code given below and find the output :
s= “oceanview”
count=0
for a in s:
if a in “stuv”:
count+=1
print(count)

20. What is the difference between video conferencing and chat?


 o
What is WWW?

21. (a) Given the following code :


d={‘Bed’:145000, ‘Almirah’:9000,
‘Chair’:1000}
for v in d.keys():
if d[v]>100000:
d[v]– =10000
print(d)
What will be the output of the print statement?
(b) Write the value stored in the variable Num by each of the following statements.
(i) Num = 2 * 3 – 4
(ii) Num = 2+3–1*3
(iii) Num = (2+3)*2

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 7 Computer Science Class 12

22. Explain database and DBMS in detail.

23. (a) Write the full forms of :


(i) RJ45 (ii) XML
(b) Write one advantages of Bus topology compared to Star and one advantage of star topology compared to Bus.

24. What output will the following code produce?


y=str(123)
x= “hello”*3
print(x,y)
x=“hello” + “world”
y=len(x)
print(y,x)
o
Write function names for the following with respect to strings.
(i) To make the first letter of a string in capital
(ii) To find the index of the 1st occurrence of a string in another

25. What is DDL? Explain with its commands.


 o
What is DML? Explain with its commands.

Section C
26. (a) Consider the following tables PERSON and ORDERS
Table : PERSON
P_Id Last_Name First_Name City

1 Sharma Abhay Mumbai


2 Gupta Mohan Delhi

3 Verma Akhil Mumbai

Table : ORDERS
O_Id Order_No P_Id
1 10050 3
2 25000 3
3 5687 1
4 45000 1
5 35000 15
With respect to the tables given above write a command to display the Lastname, Firstname and corresponding
order number arranged by Lastname.

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 7 Computer Science Class 12

(b) With respect to the table PAYMENTS given below, write, output of the following questions.
TABLE : PAYMENTS
Empld Emp_Name Salary Department
1 Ridhi 20000 D1

2 Rohit 25000 D2

3 Rakesh 20000 D2

4 Roshan 44000 D1

5 Rohini 15000 D3
6 Radha 14000 D1

(i) To display the average of employees salary from PAYMENTS table.


(ii) To count the total number of employees from PAYMENTS table Department wise
(iii) To count distinct values of column Department from PAYMENTS table.
(iv) To display department wise number of employees , but for only those departments where number of employees
are more than 2.

27. Write a code in Python to open a Binary file “College.dat” containing records of students as per following structure:
Roll Name SemPercentage
The code should display only records of students from the file where the percentage is greater than 30.
 o
Write a method countopen( ) to count and display the number of lines starting with the word ‘OPEN’ (including
lower cases and upper cases) present in a text file “start. txt”.
e.g. If the file “start.txt” contains the following lines:
Get the data value to be deleted,
Open the file for reading from it.
Read the complete file into a list
Delete the data from the list
Open the file
Open same file for writing into it
Write the modified list into file.
Close the file.
The method should display
Total lines started with word ‘OPEN’ is/are: 3

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 7 Computer Science Class 12

28. (a) Write SQL commands from (i) to (iv) on the basis of the table INTERIORS given below
TABLE : INTERIORS

No ITEMNAME TYPE DATEOF- PRICE DISC-OUNT


STOCK

1 Red rose Double Bed 23/02/02 32000 15

2 Soft touch Baby cot 20/01/02 9000 10

3 Jerry’s home Baby cot 19/02/02 8500 10

4 Rough wood Office Table 01/01/02 20000 20

5 Comfort zone Double Bed 12/01/02 15000 20


6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20

8 Royal tiger Sofa 22/02/02 30000 25

9 Park sitting Sofa 13/12/01 9000 15

10 Dine Paradise Dining Table 19/02/02 11000 15

11 White Wood Double Bed 23/03/03 20000 20


12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/03 7000 10
(i) To show all information about the Sofa from the INTERIORS table.
(ii) To list the ITEMNAME, which are priced at more than 10000 from the INTERIORS table.
(iii) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before 22/01/02 from the
INTERIORS table in descending order of ITEMNAME.
(iv) To insert a new row in the INTERIORS table with the following data
{14, ‘TrueIndian’, ‘Office Table’, ‘25/03/03’, 15000, 20}
(b) Write the command to display the sum of prices of items of type “cot”.

29. Write a user defined function to accept a string and check whether it is palindrome or not.
(A palindrome is a string that is same as its reverse)

30. Explain the traversal operation in a stack.


Write the algorithm for Traversal of a stack to display its contents.
You need not to write the actual code.
 o
Find the final contents of a stack that encounters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes the result
to the stack.
7,11,*,80,+,50,+

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 7 Computer Science Class 12

Section D

31. Tech Up Corporation (TUC) is a professional consultancy company. The company is planning to set up their new
offices in. India with its hub at Hyderabad. As a network adviser, you have to understand their requirement and
suggest to them the best available solutions. Their queries are mentioned as (i) to (v) below.
Physical locations of the blocks of TUC

Block to block distances (in metre)


Block (From) Block (To) Distance
Human Resource Conference 60
Human Resource Finance 120
Conference Finance 80
Expected number of computers to be installed in each block
Block Computers
Human Resource 125
Finance 25
Conference 60
(i) What will the most appropriate block, where TUC should plan to install their server?
(ii) Draw a block to block cable layout to connect all the buildings in the most appropriate manner for efficient
communication.
(iii) Write names of different types of Modems.
(iv) Which of the following devices will be suggested by you to connect each computer in each of the buildings?
(a) Gateway (b) Switch (c) Modem
(v) Company is planning to connect its Block in Hyderabad which is more than 20 km. Which type of network will
be formed?

32. (a) Underline the errors in the following code and write the correct code:
s= “WelcometoCS”
For a IN s :
If a IN “aeiou” :
print(a)
else
print(“False”)
(b) Write a code in Python to update the class of a student to 12 whose roll number is 22. The table structure is as
follows :
RollNo Name Class Perc
Click the Following Button to See the Free MS/Solutions
Page 8 NODIA Sample Paper 7 Computer Science Class 12

Note :
Database : PythonDB
Table : Student
Host : localhost
UserId : root
Password : arihant
 o
(a) Write the output of the following function
def showOutput( ):
num=4 + float(7)/int(2.0)
print(“num =”, num)
(b) Write a code in Python to delete the record of a student whose rollno is 33. The table structure is as follows
RollNo Name Class Perc
Note :
Database : PythonDB
Table : Student
Host : localhost
UserId : root
Password : arihant

33. What is the use of writerows() function for CSV files?


A binary file “Hotel.dat” exists storing details of hotel customers as per following structure:
Roomld CustomerName Days
Write a program in python for adding and displaying records from the binary file using following functions
(a) Reserve() : To add data of customers to the binary file.
(b) ShowReservations() : To open the file “Hotel.dat” and display all the records.
 o
What is csv. reader() function?
A binary file “Telephone.dat” exists storing details of BSNL customers as per following structure:
PhoneNo CustomerName ConnType
Write a program in python for adding and displaying record count from the binary file using following functions
(a) NewCustomer() : To add data of customers to the binary file “Telephone.dat”.
Note : The existing connection data should be preserved.
(b) PrintConnections() : To open the file “Telephone.dat” and display the connections and number of connections.

Section E
34. Consider the following table
TABLE : INTERIORS
No ITEMNAME TYPE DATEOF- PRICE DIS-CO-UNT
STOCK
1 Red rose Double Bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10

Click the Following Button to See the Free MS/Solutions


Page 9 NODIA Sample Paper 7 Computer Science Class 12

(i) What should be the data type for the DATEOFSTOCK column?
(ii) Write a command to add a new record as follows :
4, “Morris”,”Sofa Set”
Rest of the field values are not given
(iii) Write statements to :
(a) Write a command to display only the Column ITEMNAME, Net Amount(PRICE-DISCOUNT)
(b) Display only ITEMNAME and Discount column.
(Option for part (iii) only)
(a) Which clause is to be used to search non blank values in the table?
(b) Which command will be used to make the “No” column as the primary key?

35. A program in python to modify records of a binary file “hotel.dat” using random access. The program would accept
the room id , search the record by random access and display. It will then accept the new data and modify the file.
The file structure is :
Roomld Customer Name Days
import pickle
1st=[]
f=open(“hotel.dat”, “rb+”)
ans=‘y’
while ans==‘y’:
r=int(input(“Enter roomid to
modify :”))
1st=pickle.load(f)
size=f.tell()
f.seek(0)
f.seek((r-1)*size)
1st=pickle.load(f)
print(“old record ”)
print(“Room Id :”, 1st[0])
print(“Customer :”, 1st[1])
print(“Days :”, 1st[2])
f.seek(0)
... ... ... # Statement 1
print(“Enter new record ”)
nm=input(“Enter, customer name
:”)
days=input(“Enter days :”)
rs=str(r)
1st=[rs,nm,days]
pickle.dump(1st,f)
ans=input(“Modify another(y/n)”)
f.close()
(i) What type of data is returned by the load() method?
(ii) Which method closes a binary file?
(iii) What will be inserted in statement 1?

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 8 Computer Science Class 12

Sample Paper 8
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. What is the output of the following code?
>>> a = 10
>>> b = 2
>>> print(“Output is”,(a+10*2+b))
(a) Output is 22 (b) Output is 32
(c) Output is None (d) None of these

2. The...............mode opens a file for both reading and writing.


(a) wr (b) rw
(c) r+ (d) a+

3. Give the output for the following program segment given below.
for i in range (-5,-7,-1):
print (i + 1)
(a) -7,-6,-5 (b) -5,-6,-7
(c) No output (d) Error

4. For readline(), a line is terminated by


(a) ‘\n’ (b) EOF
(c) Either (a) or (b) (d) None of these

5. The join operation can join..........tables.


(a) 1 (b) 2
(c) 3 (d) Multiple

6. A table can have maximum..........primary key(s).


(a) 1 (b) 2
(c) 3 (d) Many

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 8 Computer Science Class 12

7. State True or False


“A tuple is an Editable data store”.

8. Which comments start with # symbol?


(a) Double line (b) Multi-line
(c) Single line (d) All of these

9. A table needs to restrict Salary column values to more than 50000. The constraint that has to be used is
(a) NULL (b) PRIMARY KEY
(c) CHECK (d) NOT NULL

10. To insert a record from Python to a mysql database the...........function needs to be executed.
(a) execute() (b) executeUpdate()
(c) executeQuery() (d) None of these

11. You can repeat the elements of the tuple using which operator?
(a) * (b) +
(c) ** (d) %

12. A table can be sorted by...........fields.


(a) 1 (b) 2
(c) More than 2 (d) None of these

13. A device that connects the network cable to the NIC is


(a) RJ45 (b) Repeater
(c) Hub (d) Switch

14. Which index number is used to represent last character of string?


(a) – 1 (b) 1
(c) 0 (d) n – 1
15. What will be the output of the following code?
a, b = 10, 5
x, y = a + b, b – 2
z = x – y
print (“x:”, x, “y:”, y, “z:”, z)
(a) x: 16 y:3 z:20 (b) x: 15 y:3 z:20
(c) x: 16 y:3 z:12 (d) x: 15 y:3 z:12
16. The...........clause groups records by common values of a column.
(a) BETWEEN (b) ORDER BY
(c) HAVING (d) GROUP BY

Directions (Q. Nos. 17-18) are Assertion and Reason based questions.
17. Assertion (A) Default parameters to a function are not compulsory but are a good practice to specify.
Reason (R) If default parameters are specified the formal parameters will take the default values , if any of the actual
parameters are not passed.
(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.
Click the Following Button to See the Free MS/Solutions
Page 3 NODIA Sample Paper 8 Computer Science Class 12

18. Assertion (A) A recursive function requires a base condition.


Reason (R) The base condition is the one that makes the function exit at a point.
(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.

Section B
19. Predict the output.
(i) ‘wonders’.center(12, ‘*’)
(ii) ‘wonders25’.isalnum( )

20. Identify the types of networks formed in the following cases :


(a) Two friends sharing files between a distance of 1000 km.
(b) A device transmitting voice to stations within a distance of 30 km.
 o
Write names of protocols used in following cases :
(a) A network user downloading a photograph from a server
(b) Two friends chatting over the web.

21. (a) Given the following code :


str1 = input (“Enter the string:”)
final = “”
for i in range(len(str1)):
if (i%2 == 0):
final = final + str1[i]
print(“Modified string is : ”,
final)
What is the above code doing?
(b) Consider the following list and answer the below questions.
l = [6, 9, 8, ‘Hi’, ‘Hello’, 45,
23, ‘New’]
(i) l[4:]
(ii) l[-4]
(iii) l[2:5]
(iv) ‘World’ in l

22. Write few advantages of SQL.

23. (a) Identify whether the following address is a valid IP address or not 256.200.192.1
(b) What is the difference between domain name and IP address?

24. Distinguish between tuple and list.


 o
How can you add following data in empty dictionary?

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 8 Computer Science Class 12

Keys Values
A One
B Two
C Three
D Four

25. What is equi join ? Explain with an example.


o
Identify which of the functions given below are aggregate functions.
COUNT() , LEFT() , RIGHT() , MAX() , AVG() , TRIM()

Section C
26. (a) Consider the tables EMP and SALGRADE storing details of employees and their salaries.
Table: EMP
empno ename sal date
110 Priya 7000 11-11-2010

111 Seema 14000 15-02-2014

151 Sachin 30000 18-04-2015

142 Deepa 25000 20-05-2015

Table : SALGRADE

empno city lowsal hisal grade

110 Delhi 5000 10000 2


111 NCR 11000 13000 1

142 Meerut 10000 20000 5

With respect to the tables given above write a command to display the Employee names and the corresponding
cities.
(b) With respect to the tables given above , write commands for the following :
(i) To display the average salaries of all employees who are not from Delhi.
(ii) To display, maximum salary from the EMP table among employees whose date is after “2014”
(iii) To find the count of employees who are from “Delhi”
(iv) To display each employee’s name and Grade.

27. Write a method Filterwords() to find and display words from a text file ‘NewsLetter.txt’
whose length is less than 4.
 o
Write a method countAN() that checks the number of occurrance of “A” and “N” in a text file “Story.txt”.
Click the Following Button to See the Free MS/Solutions
Page 5 NODIA Sample Paper 8 Computer Science Class 12

28. (a) Given the following tables for a database LIBRARY


Write SQL commands (i) to (iv) with respect to the tables BOOKS and ISSUED
TABLE: BOOKS
Book_Id Book Name Author_ Publishers Price Type Qty
Name
F0001 The Tears William First Publ 750 Fiction 10
Hopkins
F0002 Thunder Anna First Publ 700 Fiction 5
bolts Roberts
T0001 My First Brain & EPB 250 Text 10
C++ Brooke
T0002 C++ A.W. TDH 325 Text 5
Brainworks Rossaine
C0001 Fast Cook Lata Kapoor EPB 350 Cookery 8

TABLE : ISSUED
Book_Id Quantity_Issued
F0001 3
T0001 1
C0001 5
(i) To show Book name, Author name and Price of books of EPB Publishers.
(ii) To list the names from books of Fiction type.
(iii) To display the names and price of the books in descending order of their price.
(iv) To increase the price of all books of First Publ Publishers by 50.
(b) Write the command to remove all the records of the BOOKS table keeping the structure.

29. Write user defined function patterns (n) to display the following pattern for n lines , as per the number passed to the
function. The number to be input in main() function.
Example :
Enter a number : 6
6
66
66 6
66 66
66 666
66 6666
Enter a number :7
7
77
777
7777
77777
777777
7777777

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 8 Computer Science Class 12

30. A linear stack called status contains the following information :


Phone number of Employee
Name of Employee
Write the following methods to perform given operations on the stack status :
(i) Push_element ( ) To Push an object containing Phone number of Employee and Name of Employee into the
stack.
(ii) Pop_element ( ) To Pop an object from the stack and to release the memory.
 o
Write a function to pop an element from a stack “s” using a function stackpop().

Section D
31. G.R.K International Inc. is planning to connect its Bengaluru Office Setup with its Head Office in Delhi. The
Bengaluru Office G.R.K. International Inc. is spread across an area of approx. 1 square kilometres consisting of 3
blocks. Human Resources, Academics and Administration. You as a network expert have to suggest answers to the
questions (i) to (v) raised by them.
Note Keep the distances between blocks and number of computers in each block in mind, while providing them the
solutions.

Shortest distances between various blocks


Human Resources to Administration 100 m
Human Resources to Academics 65 m
Academics to Administration 110 m
Delhi Head Office to Bengaluru Office Setup 2350 km
Number of computers installed at various blocks
Block Number of Computers
Human Resources 155
Administration 20
Academics 100
Delhi Head Office 20
(i) Suggest the most suitable block in the Bengaluru Office Setup to host the server. Give a suitable reason with
your suggestion.
(ii) Suggest the cable layout among the various blocks within the Bengaluru Office Setup for connecting the blocks.
(iii) Suggest the placement of switch.

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 8 Computer Science Class 12

(iv) Suggest the most suitable media to provide secure, fast and reliable data connectivity between Delhi Head
Office and the Bengaluru Office Setup.
(v) Expand the following
WAN
LAN

32. (a) Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, between
200 and 300 (both included).
(b) Consider the table Faculty whose columns’ name are
F_ID, Fname, Lname, Hire_date,
Salary, Course_name
Write the code to insert the following record into the above table.
101 Riya Sharma 12-10-2004 35000 Java Advance
102 Kiyaan Mishra 3-12-2010 28000 Data Structure
 o
(a) Which of the following are invalid, names and why?
(i) PaidInterest (ii) S-num
(iii) Percent (iv) 123
(b) What is the utility of fetchall() method? Write a code to fetch all the records of a Student table from PythonDB
Database.
Note :
Host : localhost
Database : PythonDB
User : root
Password:arihant
Table : Student

33. Which file can be opened with notepad as well as MS Excel?


A CSV file “Garment.csv” file exists containing records of different types of garments as per following structure.
GarmentlD Type Gender Cost
Write a python program to add and search records of garments from the csv file and display using the following
functions :
(a) AddGarment() : Function to input details of garments and store them to the file “Garment.csv”, if the garment
type is “cotton” or “silk”.
(b) ShowGarments() : To open the file “ Garment.csv”, display details and number of “silk”.garments
 o
What is with statement in Python?
A csv file “cricket.csv” exists to store data of cricketers as follows:
CID CricketerName Strikerate WorldRank
Write a program in python to add data of more cricketers along with the existing records . Also display the details
of cricketers as per the condition given using the functions given:
(a) AppendCricketer() : To accept data of cricketers and append them to the file “cricket.csv”
(b) GetCricketers() : To open the file “Cricket.csv” and display number of cricketers whose world ranking is above
50.

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 8 Computer Science Class 12

Section E
34. Consider the following table
TABLE : PATIENTS
No Name Age Department Dateofadm Charges Sex
1 Ketaki 16 ENT 24/02/98 300 F
2 Ankita 29 Cardiology 20/02/98 800 F
3 Zareen 45 Gynaecology 22/02/98 300 F
4 Kush 19 Cardiology 13/01/98 800 M
5 Shailya 31 Nuclear Medicine 19/02/98 400 M
(i) What would be the width of Dateofadm field?
(ii) Write commands to remove the records of “Cardiology” department.
(iii) Write statements to :
(a) Display a report showing Name, charges and discount (15%) for all patients.
(b) Display names of female patients .
 (option for part (iii) only)
o
(a) Which function will find the total charges of all patients?
(b) Name the constraint that will restrict duplicate values in Name column.

35. A user defined method to open a text file “para.txt” and display count of number of ‘c’ or ‘C’ and number of ‘e’ or
‘E’ separately.
def test():
f=open(“Para.TXT”)
n1=0
n2=0
while True:
1=........... //Statement
if not 1:
break
for i in 1:
if (i ==‘E’ or i ==‘e’):
n1=n1+1
elif(i==‘C’ or i==‘c’):
n2=n2+1
print(n1)
print(n2)
f.close()
(a) Which module needs to be imported to use text file handling functions?
(b) Write the functionname to close a file object.
(c) Write the code best suitable for statement as marked.

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 9 Computer Science Class 12

Sample Paper 9
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A

1. The alternate to math.pow() function is______operator.


(a) ** (b) c $
(c) + = (d) /

2. Two relations are joined using a common field called______


(a) Alternate key (b) Foreign key
(c) Candidate key (d) None of these

3. To print all elements of tuple in reverse order using______.


(a) [: – 1] (b) [: : – 1]
(c) [1 : : ] (d) [: : 1]

4. Given : s=“Olympic@gmail.com”. What will be the output of print(s[2: :2])?


(a) ‘ypcalcm’ (b) ‘ypcgalcm’
(c) ‘ypcglcm’ (d) ‘pcgalm’

5. State True or False


“A tuple is a immutable data type.”

6. Which of the following Python functions do not require importing of a module?


(a) type() (b) input()
(c) sqrt() (d) Both (a) and (b)

7. Which of the following modes open a text file, such that the new data is written in it keeping the existing contents ?
(a) r+ (b) rw+
(c) w+ (d) a

Click the Following Button to See the Free MS/Solutions


Page 2 NODIA Sample Paper 9 Computer Science Class 12

8. The_____clause with the update command specifies the attribute to be modified.


(a) FIELD (b) ATTRIBUTE
(c) CHANGE (d) SET

9. Which of the following refers to a small, single site network?


(a) DSL (b) RAM
(c) WAN (d) PAN

10. Write the output of given code:


s1 = ‘Hello’
s2 = ‘World’
s = s1 + s2
print(s)
(a) Hello World (b) HelloWorld
(c) ‘Hellow’ ‘World’ (d) Error

11. The_____clause with GROUP BY, can filter groups from the query output.
(a) WHERE (b) FILTER
(c) HAVING (d) CHECK

12. Given a list L= [6,12,9,40,2,1]. Which of the following statements will arrange the list in reverse order
(a) L.arrange()
(b) L.sort()
(c) L.sort(reverse=True)
(d) L.sort(reverse=False)

13. Which method returns the next row from the result set as tuple?
(a) fetchone( ) (b) fetchmany( )
(c) fetchall( ) (d) rowcount

14. An alternate key can be


(a) only 1 in a table. (b) a table can have maximum 2 alternate keys.
(c) a table can have at most 3 alternate keys. (d) multiple in a relation.

15. Which statement of SQL provides statements for manipulating the database objects?
(a) DDL (b) DML
(c) DCL (d) TCL

16. Which attribute is used to return access mode with that file was opened?
(a) file.mode (b) mode.file
(c) file*mode (d) None of these

Directions : (Q. Nos. 17 and 18) are Assertion and Reason based questions.

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 9 Computer Science Class 12

17. Assertion (A) A python function can return more than one value to the calling function.
Reason (R) The return statement takes only a list as parameter.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) While opening a binary file the mode may not be specified.
Reason (R) The open function for file opening by default takes the mode parameter as ‘rb’ for binary files, if no
mode is specified.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.

Section B
19. Find the output of the following code :
i=1
while(i<5):
print(i)
i = i*2

20. Give one suitable example of each URL and domain name.
 o
Can we use URL to access a web page? How?

21. (a) Correct the error if any in the following statement.


(i) a + 5 = b
(ii) 1 = 2b + c * d
(iii) name = Aryan
(iv) a = 20
print a;
(b) Evaluate the following expression
If a = b = 10, c = 5
a = b*3//4 + c//4 + 4– b + 5//6

22. Define UPDATE command of SQL with its basic syntax and also give one of its example.

23. (a) Write any two characteristics of IP address.


(b) What is VoIP?

24. Write the one example of following terms.


(i) Identifier (ii) Punctuator
(iii) Keyword (iv) Constant
 o

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 9 Computer Science Class 12

What will be the output of the following code?


a, b = 10, 5
x, y = a + b, b – 2
z = x – y
print (“x:”, x, “y:”, y, “z:”, z)

25. Expand the following abbreviation :


(i) SQL (ii) DML
(iii) DDL (iv) TCL
 o
Mention two characteristics of SQL.

Section C
26. Consider the following tables PRODUCT and CLIENT
TABLE : PRODUCT
PID ProductName Manufacturer Price
TP01 Talcom Powder LAK 40
FW05 Face Wash ABC 45
BS01 Bath Soap ABC 55
SH06 Shampoo XYZ 120
FW12 Face Wash XYZ 95

TABLE : CLIENT
C_ID ClientName City P_ID
01 Cosmetic Shop Delhi FW05
06 Total Health Mumbai BS01
12 Live Life Delhi SH06
15 Pretty Woman Delhi FW12
16 Dreams Bengaluru TP01
(a) To display the ClientName, City from table CLIENT and ProductName and Price from table PRODUCT, with
their corresponding matching P_ID.
(b) Write SQL queries for statements (i) to (iv)
(i) To display the details of those Clients, whose City is Delhi.
(ii) To display the details of products, whose Price is in the range of 50 to 100 (both values included).
(iii) To display product name and their manufacturer whose Price is more than 100.
(iv) To display client name for those whose product id is FW12.

27. Define a function in Python to accept a sentence and count the number of occurrences of the word “is” and “was”.
Example
Input : “He is a good boy. She was and is a good girl”
Output :
No. of is : 2
Click the Following Button to See the Free MS/Solutions
Page 5 NODIA Sample Paper 9 Computer Science Class 12

No. of was : 1
 o
Write a definition of a function that takes input a sentence and display the list of words that start with a lowercase
vowel and list of words that start with a uppercase vowel separately.
Example
Input : A quick black elephant enters Into a jungle.
Output
List of words starting with lowercase vowels [‘elephant’, ‘enters’, ‘a’]
List of words starting with uppercase vowels [‘A’, ‘Into’]

28. (a) Write SQL commands (i) to (iv) for the following tables :
TABLE : STUDENT
S NO NAME STREAM FEES AGE SEX AID
1 ARUN KUMAR COMPUTER 750.00 17 M A1
2 DIVYA JENEJA COMPUTER 750.00 18 F A2
3 KESHAR MEHRA BIOLOGY 500.00 16 M A2
4 HARISH SINGH ENG. DR 350.00 18 M A1
5 PRACHI ECONOMICS 300.00 19 F A3
6 NISHA ARORA COMPUTER 750.00 15 F A3
7 DEEPAK KUMAR ECONOMICS 300.00 16 M A1
8 SARIKA VASWANI BIOLOGY 500.00 15 F A1

TABLE: ADDRESS
AID City
Al Jamshedpur
A2 Kolkata
A3 Mumbai
(i) List the name of all the students, who have taken stream as COMPUTER.
(ii) To count the number of female students.
(iii) To display the number of students stream wise.
(iv) To display names of the students with corresponding cities.
(b) Write the command to display all the tables in the database.

29. Write a program to calculate the sum and mean of the elements which are entered by user.

30. Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period (.) except digits. Assume that Pname is a class instance attribute.
 o
Find the final contents of a stack that encounters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes the result
to the stack.
100,8,3,*,50,2,+,+,*
Click the Following Button to See the Free MS/Solutions
Page 6 NODIA Sample Paper 9 Computer Science Class 12

Section D

31. Expertia Professional Global (EPG) in an online corporate training provider company for IT related courses. The
company is setting up their new campus in Mumbai. You as a network expert have to study the physical locations
of various buildings and the number of computers to be installed. In the planning phase, provide the best possible
answers for the queries (i) to (v) raised by them.
Physical locations of the buildings of EPG

Building to building distance (in metre)


From To Distance

Administrative Building Finance Building 60


Administrative Building Faculty Studio Building 120

Finance Building Faculty Studio Building 70

Expected computers to be installed in each building


Buildings Computers

Administrative Building 20
Finance Building 40
Faculty Studio Building 120

(i) Suggest the most appropriate building, where EPG should plan to install the server.
(ii) Suggest the most appropriate building to building cable layout to connect all three buildings for efficient
communication.
(iii) Which type of network out of the following is formed by connection the computers of these three buildings?
(a) LAN (b) MAN (c) WAN
(iv) Write the difference between LAN and MAN.
(v) Expand the following
(a) WAN (b) MAN

32. (a) Write a Python program to find maximum and minimum elements in a tuple.
(b) Consider the table MobileStock with following fields
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database Mobile.

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 9 Computer Science Class 12

o
(a) Which of the following are invalid names and why?
(i) Paidlnterest (ii) S-num
(iii) Percent (iv) 123
(b) Write the steps for Database connectivity with short explanation of each step.

33. What does tell() method do?


(a) AddRegistration() :To accept more student registration data and store them to the binary file keeping the existing
registration data.
A Binary file “Registration.dat” exists storing details of students who have been registeredfor CBSE board
exams. The file stores following data of students :
RegnNo StudName class No of subjects
(b) CountRegistrations() : Display count of registrations using the functions.
 o
What does seek() method do?
(a) PutBike() : To accept data of more bikes and store them to the file “Bikes.csv”
A CSV file “Bikes.csv” stores details of bikes with their brand names, cc and cost.
Record structure of “Bikes.csv”
BID Bname Brand Cost
(b) SearchBike(bikeid) : To open the file “Bikes.csv” and display details of the bike whose from id is supplied as
the parameter to the function.

Section E

34. Consider the following table ORDERS :


TABLE : ORDERS
O_Id OrderDate OrderPrice Customer
1 2008/11/12 1000 Hansen
2 2008/10/23 1600 Nilsen
3 2008/09/02 700 Hansen
4 2008/09/03 300 Hansen
5 2008/08/30 2000 Jensen
6 2008/10/04 100 Nilsen
(i) Write a statement to create the above table.
(ii) Write a command to change the width of Customer column to varchar(30)
(iii) Write statements to :
(a) Display the field names, their type , size and constraints .
(b) Display details of orders where orderprice is in the range 500 to 1500
 (Option for part iii only)
o
(a) Write a command to increase orderprice of all orders by 15%.
(b) Name the constraint that will restrict both NULL and DUPLICATE values in the O_Id field.

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 9 Computer Science Class 12

35. A user-defined method to open a text file “para.txt” and write its contents to another file fter removing the 3rd line
def Func():
with open (‘Para.txt’, ‘r’) as f:
l=f.readlines()
f.close()
print(l)
del l[3]
print(l)
f=open (‘Para.txt’, ‘w’)
f...........
f.close()
(a) Which module needs to be imported to use operating system functions like rename() and remove().
(b) Write the function name to open a text file.
(c) Fill the blank as marked in above code.

 EN

Click the Following Button to See the Free MS/Solutions


Page 1 NODIA Sample Paper 10 Computer Science Class 12

Sample Paper 10
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.

Section A
1. The output of print(math.ceil(17.34)) is
(a) 18 (b) 17
(c) 10 (d) 20

2. The...........clause is used in SQL to specify a range of values.


(a) WHERE (b) DROP
(c) BETWEEN (d) RANGE

3. Two friends have connected their computers , but are getting weak signals. Which device need to be used to get
better signals?
(a) Repeater (b) Hub
(c) Switch (d) Modem

4. ______method creates a cursor object while connecting a Python application with a Mysql database.
(a) connection( ) (b) connect( )
(c) cursor( ) (d) None of these

5. The default mode in which a file is opened is


(a) r (b) rw+
(c) w (d) a

6. Which attribute is used to return access mode with that file was opened?
(a) mode.file (b) mode.file.name
(c) file.mode (d) file.mode.type

7. Which of the following is not a DDL command ?


(a) ALTER (b) CREATE
(c) DROP (d) DELETE

8. State True or False


‘A dictionary is ordered by index”.
Click the Following Button to See the Free MS/Solutions
Page 2 NODIA Sample Paper 10 Computer Science Class 12

9. The module required to use the mode function is


(a) math (b) statistics
(c) random (d) Pandas

10. The.........command can be used to remove all records of a table along with the table structure.
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) None of these

11. What is the output of the following code?


>>> a = 10
>>> b = 2
>>> print(a + 10 * 2 + b)
(a) 32 (b) 22
(c) 40 (d) 80

12. Which function is used to generate a sequence of numbers overtime?


(a) range() (b) len()
(c) limit() (d) lim()

13. Which of the following symbol is used in Python for comments?


(a) $ (b) @
(c) // (d) #

14. Given a list Lst= [65,182,90,420,20,10]. What will be the correct statement to take out the 3rd element from the list?
(a) Lst.pop(2) (b) L.find(2)
(c) L.pop(–1) (d) L.del(90)

15. The relation between Primary key , Candidate key and Alternate key is
(a) Primary key = Candidate key - Alternate key
(b) Candidate key= Primary key - Alternate key
(c) Alternate key= Primary key+ Candidate key
(d) None of the above

16. The first integrity rule for relational databases ensures that_____
(a) Primary key is unique
(b) Foreign key is unique
(c) Primary key is unique and NOT NULL
(d) There is only one candidate key

Directions (Q.Nos. 17-18) are Assertion and Reason based questions.

17. Assertion (A) User-defined functions must stay in a Python module.


Reason (R) Each user-defined function must stay in a module ,which is linked to a folder where all the user defined
functions of the module stay.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

Click the Following Button to See the Free MS/Solutions


Page 3 NODIA Sample Paper 10 Computer Science Class 12

18. Assertion (A) Python supports addition of data in file , preserving the previous data.
Reason (R) The write mode erases all previous data of a pre-existing file.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

Section B
19. Write the corresponding Python expression for the following mathematical expression.
(i) z= a/a+ b – d2
(ii) z= x2 + y3

20. Mr. GopiNath Associate Manager of Unit. Nations corporate recently discovered that the communication between
his company’s accounts office and HR office is extremely slow and signals drop quite frequently. These offices are
120 metre away from each other and connected by an Ethernet cable.
(i) Suggest him a device which can be installed in between the office for smooth communication.
(ii) What type of network is formed by having this kind of connectivity out of LAN, MAN and WAN?
 o
Define hub and write its functions and types.

21. (a) Determine which of the following identifiers are valid. If invalid, explain with reason.
(i) name_1 (ii) _SUM
(iii) $Sum (iv) num ^ 2
(b) Find the output of the following code
i=1
while (i<5):
print(i)
i=i*2

22. Differentiate between char(n) and varchar(n) data types with respect to databases.

23. (a) Mention any two advantages of E-mail over conventional, mail.
(b) Mr. Lal owns a factory which manufactures automobile spare parts. Suggest him the advantages of having a
web page for his factory

24. Name the tokens that are available in Python.


 o

Find the syntax error in the following program and underline after correct them.
90 = w
while(w > 60)
print(w)
w = w – 50

25. Explain the use of ORDER BY clause.


 o
What are DDL and DML?

Click the Following Button to See the Free MS/Solutions


Page 4 NODIA Sample Paper 10 Computer Science Class 12

Section C
26. Consider the tables FAMILY and Occupation:
TABLE FAMILY
No Name Female Members Male Members Income Occup-ationId
1 Mishra 3 2 7000 O1
2 Gupta 4 1 50000 O2
3 Khan 6 3 8000 O2
4 Chaddha 2 2 25000 O1
5 Yadav 7 2 20000 O3
6 Joshi 3 2 14000 O2
7 Maurya 6 3 5000 O1
8 Rao 5 2 10000 O3

Table : OCCUPATION
Occupationld Type
O1 Service
O2 Business
O3 Mixed
(a) To display Family name , corresponding occupation and income where male members are more than 2.
(b) Write SQL queries for statements (i) to (iv) based on tables FAMILY and Occupation.
(i) To select all the information of family, whose Occupation is Service.
(ii) To list the name of family, where female members are more than 3.
(iii) To list all names of family with income in ascending order.
(iv) To count the number of family, whose income is less than 10000.

27. Write a method countFile() to count and display the number of lines starting with the word ‘FILE’ (including small
cases and upper cases) present in a text file “start.txt”.
e.g. If the file “start.txt” contains the following lines:
Get the data value to be deleted,
Open the file for reading from it.
Read the complete file into a list
Delete the data from the list
Open the file
Open same file for writing into it
Write the modified list into file.
Close the file.
The method should display
Total lines started with word ‘FILE’ is/are: 0

o
Write definition of a function that takes input a sentence and display the list of words that end with a lowercase
vowel and list of words that end with a lowercase consonant

Click the Following Button to See the Free MS/Solutions


Page 5 NODIA Sample Paper 10 Computer Science Class 12

28. (a) Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (iv).
TABLE: DOCTOR
ID NAME DEPT SEX E X P E R -
IENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15

TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
130 21700 2600 300
(i) Display NAME of all doctors who are in MEDICINE department having more than 10yrs experience from
the table DOCTOR.
(ii) Display the average salary of all doctors working in ENT department using the tables DOCTOR and
SALARY. SALARY = BASIC + ALLOWANCE.
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee among all male doctors.
(b) Write the command to change the data type of consultation to double(8,3).

29. Write a program to count the frequency of elements in a list entered by user.

30. Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period (.) except digits. Assume that Pname is a class instance attribute.

 o

Find the final contents of a stack that encq]lnters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes the result
to the stack.
(100, 8, 3, *, 50, 2, +, +, *)

Click the Following Button to See the Free MS/Solutions


Page 6 NODIA Sample Paper 10 Computer Science Class 12

Section D
31. Workalot consultants are setting up a secured network for their office campus of Gurgaon for their day-to-day office
and web based activities. They are planning to have connectivity between 3 buildings and the head office situated
in Mumbai.
Answer the questions (i) to (v) after going through the building positions in the campus and other details, which are
given below:

Distance between various buildings


Building GREEN to Building RED 110 m
Building GREEN to Building BLUE 45 m
Building BLUE to Building RED 65 m
Gurgaon Campus to Head Office 1760 km
Number of computers
Building GREEN 32
Building RED 150
Building BLUE 45
Head Office 10
(i) Suggest the most suitable place (i.e. building) to house the server of this organisation. Also, give a reason to
justify your suggested location.
(ii) Suggest a cable layout of connections between the buildings inside the campus.
(iii) Suggest the placement of the following devices with justification :
(a) Switch
(b) Repeater
(iv) Write the use of Modem in a network.
(v) What is the use of firewall in network?

32. (a) Write a Python program to concatenate following dictionaries to create a new one.
d1={‘A’:10, ‘B’:20}
d2={‘C’:30, ‘D’:40}
d3={‘E’:50, ‘F’:60}
(b) Consider the table MobileStock with following fields
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database Mobile.

Click the Following Button to See the Free MS/Solutions


Page 7 NODIA Sample Paper 10 Computer Science Class 12

o
(a) Sohan has a list containing 8 integers as marks of subject Science. You need to help him to create a program
with separate user defined function to perform the following operations based on the list.
(i) Push those marks into a stack which are greater than 75.
(ii) Pop and display the content of the stack.
Simple Input
Marks = [75, 80, 56, 90, 45, 62, 76, 72]
Sample Output
80 90 76
(b) Consider the following table Traders with following fields

TCode TName City

T01 Electronic Sales Mumbai

T03 Busy Store Corp Delhi

T02 Disp House Inc Chennai

Write Python code to display the names of those traders who are either from Delhi or from Mumbai.

33. What is difference between tell() and seek() methods?


A Binary file “lottery.dat” stores details of lottery ticket holders . The file stores the following details :
TicketNo State Type Prizemoney
Write a program using two functions to operate the file data.
(a) AddBuyers(State) : To accept more ticket details and store them into the file only if the ticket is not from state
passed as parameter to the function.
(b) TicketSearch(tid) : To open the file “lottery.dot” and display details of the ticket whose id is supplied as the
parameter to the function.
 o
Compare text files and binary files.
A Binary file “car.dat” stores details of cars. The file stores the following details :
CarNo Brand Kms Cost
Write a program using two functions to operate the file data.
(a) AddCardata() : To accept car details and store them into the file “car.dat”
(b) CarReport() : To open the file “car.dat” and display details of the cars who have run more than 100000 kilometres.

Click the Following Button to See the Free MS/Solutions


Page 8 NODIA Sample Paper 10 Computer Science Class 12

Section E
34. Consider the following table FLIGHTS :
TABLE : FLIGHTS
FL_NO STARTING ENDING NO_FLIGHT NO_
STOPS
IC301 MUMBAI DELHI 8 0
IC799 BENGALURU DELHI 2 1
MC101 INDORE MUMBAI 3 0
IC302 DELHI MUMBAI 8 0
AB812 KANPUR BENGALURU 3 1
IC899 MUMBAI KOCHI 1 4
AM501 DELHI TRIVANDRUM 1 5
MU499 MUMBAI MADRAS 3 3
IC701 DELHI AHMEDABAD 4 0
(i) The command to create the table was written as :
Create table FLIGHTS( FL_NO integer, STARTING char(20), ENDING char(30), NO_FLIGHT integer, NO_
STOPS integer);
What is wrong with command ?
(ii) What is the cardinality of the table ?
(iii) Which functions will be used to :
(a) Display total number of flights .
(b) Display number of flights whose FL_NO starts with “IC”
(option for part (iii) only)
Write function names to :
(a) Show the average Number of stops.
(b) Show the maximum number of stops.

35. A user-defined method to open a text file ‘Author.txt” and display the lines that have even number of words.
def evenwords():
f=open(“Author.txt”)
ln=f.readlines()
for line in ln:
linex=............// Statement
if len(linex)%2==0:
print(line)
f.close()
(a) How is readline() method different from readlines() method in Python?
(b) Write the use of the reader object in csv file operations.
(c) Fill the blank as marked statement.

 EN

Click the Following Button to See the Free MS/Solutions

You might also like