Electrical

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Students must start practicing the questions from CBSE Sample Papers for Class 12 Computer Science with Solutions Set 3 are designed as per the revised syllabus.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Time: 3 hrs Max.
Marks: 70

Instructions

1. Please check this question paper contains 35 questions.
2. The paper is divided into 5 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

Question 1.
State True or False
Integer is a mutable data type in Python. [1]Answer:
False

Question 2.
Which of the following Python function displays the memory id of a variable? [1](a) type()
(b) str()
(c) getid()
(d) id()
Answer:
(d) id()

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 3.
Which of the following operator performs an integer division? [1](a) *
(b) //
(c) /
(d)**
Answer:
(b) //

Question 4.
Identify the output of the following Python statement: [1]b = 1
for a in range(1, 10, 2):
b += a + 2
print(b)
(a) 31
(b) 33
(c) 36
(d) 39
Answer:
(c) 36

Question 5.
Given s=”AISSE@2023”. What will be the output of
print (s [-1: : -1 ]) ?
(a) ‘3202@ESSIA’
(b) 3
(c) AISSE
(d) ESSIA
Answer:
(a) ‘3202@ESSIA’

Question 6.
Which of the following functions write data to a binary file?
(a) pickle()
(b) writer()
(c) load()
(d) dump()
Answer:
(d) dump()

Question 7.
Which of the following is not an inherent application of stack ?
(a) Reversing a string
(b) Evaluation of postfix expression
(c) Implementation of recursion
(d) Job scheduling
Answer:
(d) Job scheduling

Question 8.
Which of the following is an advantage of SQL?
(a) High speed
(b) Client/Server language
(c) Easy to learn
(d) All of these
Answer:
(d) All of these

Question 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=15
c=False
(b) a=15
b=10
c=True
(c) a=15
b=None
c=False
(d) None of these
Answer:
(a) a= 15
b=15
c=False

Question 10.
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
Answer:
(c) Both UNIQUE and NOT NULL

Question 11.
Fill in the blank function will read entire contents of a text file.
(a) read()
(b) readfull()
(c) readline()
(d) readfile()
Answer:
(a) read()

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

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

Question 13.
State whether the following statement is True or False :
TCP/IP is the base protocol for all application protocols.
Answer:
True

Question 14.
The Python function that adds a list at the end of another list is
(a) join()
(b) add()
(c) append()
(d) extend()
Answer:
(d) extend()

Question 15.
Fill in the blank : ……….. the protocol primarily used for browsing data. [1]Answer:
HTTP

Question 16.
Which of the following is an advantage of networking? [1](a) Application sharing
(b) File sharing
(c) User communication
(d) All of these
Answer:
(d) All of these

Directions In the question numbers 17 and 18, a statement of Assertion (A) is followed by a statement of Reason (R). Choose the correct option.

Question 17.
Assertion (A) A Python function that accepts parameters can be called without any parameters.
[1]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.
Answer:
(a) Both A and R are true and R is the correct explanation of A.

Question 18.
Assertion (A) A CSV file is by default delimited by comma(,), but the delimiter character can be
changed. [1]Reason (R) The writerowf) 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.
Answer:
(a) Both A and R are true and R is the correct explanation of A.

Section – B

Question 19.
(i) Expand the following terms: [1+1=2]LAN, HTTP
(ii) What do you mean by 3G mobile technology?

Or

(i) Can we use URL to access a web page? How?
(ii) Name any two web browsers.
Answer:
(i) LAN Local Area Network
HTTP HyperText Transfer Protocol
(ii) 3G is short for Third Generation of mobile telecommunication technology. 3G telecommunication networks support services that provide an information transfer rate of atleast 200 kbps.

Or

(i) Yes, as a location on a web server, which is called a website and each website has a unique address known as URL. So, URL can be used to access a web page.
(ii) Google Chrome, Internet Explorer

Question 20.
What will be the output for the following Python statement? [2]L = [10, 20, 30, 40, 50]L = L + 5
print(L)
Answer:
Error, the list data type does not allow addition of integers with it. So, L + 5 is an invalid statement.

Question 21.
What will be the output of the following Python code? [2]

L = [10, 20]
L1=[30, 40]
L2=[50, 60]
L.append (L1)
L.extend(L2)
print(L)

Or

Find the output

>>> l1 = [1, 2, 3, 4]
>>> l2 = [1, 2, 3, 4]
>>> l1 > l2
>>> l2 [2] = 9
>> l1 > l2

Answer:
[10, 20, [30, 40], 50, 60]

Or

False
False

Question 22.
Mention the various advantages of using a DBMS. [2]

Or

Create a table named Programmers with the following structure :

P_Name VARCHAR(20)
DOJ Date
SAL NUMBER

(i) Display the name of the programmer, which has the highest salary.
(ii) Update the salary of all programmer by 2000, whose name start with letter R.
Answer:
DBMS has the following advantages:

  1. Reduced data redundancy
  2. Elimination of inconsistency
  3. Data sharing
  4. Data integrity
  5. Data security
  6. Ease of application development

Or

(i) SELECT P_Name MAX(SAL) FROM Programmers;
(ii) UPDATE Programmers SET SAL = SAL + 2000 WHERE P_Name LIKE ‘R%’;

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 23.
Define the update() method with its syntax in dictionary. [2]Answer:
update() method is used to update the dictionary with the elements from the another dictionary object or from an iterable of key/value pair.

Syntax dictionary_name1.update(dictionary_name2)

Question 24.
Write the output of the following code. [2]

number = 2
def Fun ():
number = 5
print (“Number(s):”)
print (number)
Fun ()
print (number)

Or

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]Answer:
Output
Number(s)
5
2

Or

(i) (‘Hello’, 22)
(ii) 22

Question 25.
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.

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)

Answer:

The error is run time error
x = int(input(”Enter the value of x : ")
y = int(input(”Enter the value of y : “))
if (y! = 0):
z = x/y
print (“The value of z : “, z)

Section – C

Question 26.
Write outputs for the SQL commands (i) to (iii) based on the table CUSTOMER given below: [1 × 3 = 3]TABLE: CUSTOMER
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 1
(i) SELECT COUNT(*). GENDER FROM CUSTOMER GROUP BY GENDER;
(ii) SELECT CNAME FROM CUSTOMER WHERE CNAME LIKE ‘L%’;
(iii) SELECT DISTINCT AREA FROM CUSTOMER;
Answer:
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 2

Question 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’. [3]

Or

Write a program in Python to open a text file “lines.txt” and display all those words whose length is greater than 5.
Answer:

import os
def Delete (word):
file1=open(‘original.dat’.'rb’)
nfile=open(‘duplicate.dat’.'wb’)
while True :
line=file1.readline()
if not line :
break
else :
if word in line :
pass
else:
print(line)
nfile.write(line)
file1.close()
nfile.close()

Or

f=open(”lines.txt”)
data=f.read()
str=data.split(' ')
print("Words with length greater than 5”)
for w in str: 
if len(w)>5 :
print(w)
f.close( )

Question 28.
Write the queries for the questions (i) to (iii) on the basis of the following tables SHOPPE and ACCESSORIES. [1 × 3 = 3]TABLE: SHOPPE
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 3
TABLE: ACCESSORIES
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 4
(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.
Answer:
(i) SELECT Name, Price FROM ACCESSORIES ORDER BY Price;
(ii) SELECT Id, SName FROM SHOPPE WHERE Area = ‘Nehru Place’;
(iii) SELECT MIN(Price) ‘‘Minimum Price”, MAX(Price) “Maximum Price”, Name FROM ACCESSORIES GROUP BY Name;

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 29.
Write a user-defined 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. [3]Answer:

newLeven=[ ]
newLodd=[ ]
i=j=0
def parser(L):
for num in L :
if num%2 ==0:
newLeven[i]=num
i+=1
else :
newLodd[j]=num
j+=1
print(“Even number list :” , newLeven)
print(“Odd number list :” , newLodd)

Question 30.
Consider the following stack of characters, where STACK is allocated N = 8 memory cells.
STACK : A, C, D, F, K, …, …, … [3]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)
(v) Pop (STACK, ITEM)
(vi) Push (STACK, R)
(vii) Push (STACK, S)
(viii) Pop (STACK, ITEM)
Answer:
The stack contents will be as follows after the operations of stack :
(i) STACK : A, C, D, F (K is deleted)
(ii) STACK : A, C, D (F is deleted)
(iii) STACK : A, C, D, L (L is inserted)
(iv) STACK: A, C, D, L, P (P is inserted)
(v) STACK : A, C, D, L (P is deleted)
(vi) STACK : A, C, D, L, R (R is inserted)
(vii) STACK : A, C, D, L, R, S (S is inserted)
(viii) STACK : A, C, D, L, R (S is deleted)

Section – D

Question 31.
Consider the following table STORE. [1 × 4 = 4]TABLE: STORE
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 5
Write SQL queries for statements:
(i) Display the number of distinct Scodes.
(ii) Display the maximum and minimum quantities.
(iii) Display the structure of the STORE table.
(iv) Add a new column Location varchar(50) in the table to store the location details of the items.
Answer:
(i) SELECT COUNT (DISTINCT Scode) FROM STORE;
(ii) SELECT MAX(Qty) . MIN(Qty) FROM STORE;
(iii) DESCRIBE STORE;
(iv) ALTER TABLE STORE ADD Location varchar(50);

Question 32.
Shubham is an employee in ABC company who works as a Python expert. For annual appraisal, he has created a CSV file named annual.csv, to store the tasks of employee in different projects. The structure of annual.csv is: [4][emp_id, empName, project, duration]For efficient data of employee, Shubham wants to write the following user-defined functions:
Accept( ) To accept the details of employee and add them to the annual.csv
Show ( ) To display the details of all employees.
Write the program in Python for above information.
Answer:

import csv
1st = ['EmpID', 'EmpName', 'Project', 'Duration']
def Accept( ):
f = open("annual.csv", "a", newline="\n")
wr = csv.writer(f, delimiter = "\t")
lst = ['EmpID’, 'EmpName', 'Project', 'Duration']
wr.writerow(lst)
while True:
ch = int(input("Enter 1 to add and 0 to exit"))
if (ch == 1):
emp_id = input("enter employee id:")
empName = input("Enter employee name:")
project = input("Enter project name:")
duration = int(input("Enter project completion duration in weeks:"))
wr.writerow[emp_id, empName, project, duration])
elif ch==0:
break 
f.close( )
def Show():
f1 = open("annual.csv", 'r')
data = csv.reader (f1)
next (f1)
rw = 0
for i in data:
rw = rw+1
print ("Number of details:",rw)
f1.close ( )
Accept( )
Show( )

Section – E

Question 33.
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. [1 × 5 = 5]Physical locations of the blocks of TTC
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 6
Block to block distance (in m)

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.
(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?
Answer:
(i) TTC should install its server in finance block as it has maximum number of computers.
(ii)
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 7
The above layout is based on minimum cable length required.
(iii) Star topology, as it has independent connections that help easy network setup and fault detection.
(iv) (a) Switch/Hub These are devices that can connect multiple nodes in a network, together.
(v) Since, the distance is less than 1 km.
LAN (Local Area Network) will be formed.

CBSE Sample Papers for Class 12 Computer Science Set 3 with Solutions

Question 34.
(i) What do you mean by file and file handling? [2 + 3 = 5](ii) Write a program code in Python to perform the following using two functions as follows :
addBook() To write to a CSV file “book.csv” file book no, book name and no of pages with separator as tab.
countRecords() To count and display the total number of records in the “book.csv” file.

Or

(i) Explain open( ) function’s syntax.
(ii) Write Python code to perform the following using two user defined functions.
showData( ) To display only roll no and student name of the file “student.csv”

RollNo, Name, Marks
1, Nilesh, 65
2, Akshay, 75

showSelect() To display only roll number and marks of the students from the CSV file “student.csv”
Answer:
(i) The file refers to the collection of bytes stored in computer storage.
File handling refers to the process of handling data using software for I/O operations.

(ii)

import csv
def addBook( ):
f1 = open("book.csv", ’w', newline = "\n")
w1 = csv.writer(f1, delimiter = "\t")
w1.writerow['BookNo', 'BookName', 'Pages'])
while True:
op = int(input("Enter 1 to add and 0 to exit"))
if(op == 1):
Bookno = int(input("Enter Book No: "))
Bookname = input("Enter Book Name: ")
Pages = int(input("Enter Pages: "))
w1.writerow([Bookno, Bookname, Pages])
elif op == 0:
break
f1.close( )
def countRecords( ):
f = open("book.csv" , "r")
d = csv.reader(f)
next(f) #to skip header row
r = 0
for row in d:
r = r+1
print("Number of records are " , r)
f.close()
addBook( )
countRecords( )

Or

(i) The open( ) function has the following syntax:
= open(file_name,access_mode)
where, file object It is just like a variable or an object.
open( ) It is a function with two parameters.
file_name It accepts a file name with .txt or .dat extension.
access_mode It specifies the mode to access the file. The default mode is r.

(ii)

import csv
def showData( ):
f = open("student.csv", 'r')
r = csv.reader(f, delimiter=" , ")
for row in r :
print(row[0], row[1])
f.close()
def showSelect( ):
f = open("student.csv", 'r’)
r = csv.reader(f, delimiter=" , ")
for row in r :
print(row[0], row[2])
f.close( )
showData( )
showSelect( )

Question 35.
(i) If R1 is 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? [1 + 4 = 5](ii) Below is a table Item in database Inventory.
CBSE Sample Papers for Class 12 Computer Applications Set 3 with Solutions 8
Riya created this table but forget to add column ManufacturingDate. Can she add this column after creation of table?
Note the following to establish the connection between Python and MySQL:
Host: localhost
Username : system
Password : test
Database : Inventory

Or

(i) Identify command/function for the following action.
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) 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
Answer:
(i) Cardinality means the number of rows in a table. Degree means the number of columns of a table. Relation R1 has 8 rows, so cardinality will be 8.
If 5 rows are added cardinality become 8+5 = 13. Degree remains the same, that is 5.

(ii) Yes, she can add new column after creation of table,

import mysql.connector
mycon = mysql .connector.connect(
host = “local host”,
user = “system”,
passwd = “test”,
database = “Inventory”)
cursor = mycon.cursor ( )
cursor.execute (“ALTER TABLE Item ADD ManufacturingDate Date NOT NULL”)
mycon.close ( )

Or

(i) SELECT*FROM Train WHERE Start=”NDLS”.;

(ii)

import mysql.connector
mycon = mysql.connector.connect (
host = “localhost”,
user = “root”,
passwd = “system”,
database = “School”)
cursor = mycon.cursor ( )
db = cursor.execute ("CREATE TABLE Faculty (
F_ID varchar (3) Primary key,
Fname varchar (30) NOT NULL,
Lname varchar (40),
Hire_date Date,
Salary Float))
mycon.close ( )


Show More
यौगिक किसे कहते हैं? परिभाषा, प्रकार और विशेषताएं | Yogik Kise Kahate Hain Circuit Breaker Kya Hai Ohm ka Niyam Power Factor Kya hai Basic Electrical in Hindi Interview Questions In Hindi