English

Computer Science (Python) Set 4 2022-2023 Commerce (English Medium) Class 12 Question Paper Solution

Advertisements
Computer Science (Python) [Set 4]
Marks: 70 CBSE
Commerce (English Medium)
Science (English Medium)
Arts (English Medium)

Academic Year: 2022-2023
Date & Time: 23rd March 2023, 10:30 am
Duration: 3h
Advertisements

General Instructions :

  1. This question paper contains five sections, Section A to E.
  2. All questions are compulsory.
  3. Section A has 18 questions carrying 01 mark each.
  4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
  5. Section C has 05 Short Answer type questions carrying 03 marks each.
  6. Section D has 03 Long Answer type questions carrying 05 marks each.
  7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q 35 against part C only.
  8. All programming questions are to be answered using Python Language only.

SECTION - A
[1]1 | State True or False

"Identifiers are names used to identify a variable or function in a program". 

True

False

Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]2

Which of the following is a valid keyword in Python?

false

return

non_local

none

Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]3

Given the following Tuple.

Tup = (10, 20, 30, 50)

Which of the following statements will result in an error?

print(Tup [0])
Tup.insert (2, 3)
print(Tup[1:2])
print(len(Tup))
Concept: undefined - undefined
Chapter: [0.08] Database Concepts
[1]4

Consider the given expression:

5<10 and 12>7 or not 7>4

Which of the following will be the correct output if the given expression is evaluated?

TRUE
FALSE
NONE
NULL
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]5

Select the correct output of the code:

S="Amrit Mahotsav @ 75"
A=S.partition (" ")
print(a)
(‘Amrit Mahotsav’, ‘@’, ‘75’)
[‘Amrit’, ‘Mahotsav’, ‘@’, ‘75’]
(‘Amrit’, ‘Mahotsav @ 75’)
(‘Amrit’, “, ‘Mahotsav @ 75’)
Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
[1]6

Which of the following mode keeps the file offset position at the end of the file?

r+
r
w
a
Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
[1]7

______ function is used to arrange the elements of a list in ascending order.

sort()
arrange()
ascending()
asort()
Concept: undefined - undefined
Chapter:
[1]8

Which of the following operators will return either True or False?

+=
!=
=
*=
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]9

Which of the following statement(s) would give an error after executing the following code?

Stud = {"Murugan": 100, "Mithu": 95} # Statement 1
print (Stud [95])                    # Statement 2 
Stud ["Murugan"]=99                  # Statement 3
print (Stud.pop())                   # Statement 4 
print (Stud)                         # Statement 5 

Statement 2

Statement 3

Statement 4

Statements 2 and 4

Concept: undefined - undefined
Chapter:
[1]10

The number of tuples in a relation is called ______.

Attribute

Tuple

Cardinality

Degree

Domain

Concept: undefined - undefined
Chapter: [0.03] Python - Databases and SQL [0.08] Database Concepts
[1]11
The syntax of seek() is:
file_object.seek(offset[,reference_point])

What is the default value of reference_point?

0

1

2

3

Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
[1]12

______ clause is used with a SELECT statement to display data in a sorted form with respect to a specified column.

WHERE
ORDER BY
HAVING
DISTINCT
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[1]13

______ is used for point-to-point communication or unicast communication such as radar and satellite. 

INFRARED WAVES
BLUETOOTH
MICROWAVES
RADIOWAVES
Concept: undefined - undefined
Chapter: [0.11] Data Communication [0.11] Data Communication
[1]14

What will the following expression be evaluated for in Python?

print (4 + 3 * 5/3 − 5 % 2)
8.5
8.0
10.2
10.0
Concept: undefined - undefined
Chapter: [0.03] Stack
[1]15

Which function returns the sum of all elements of a list?

count()
sum()
total()
add()
Concept: undefined - undefined
Chapter: [0.03] Python - Databases and SQL [0.09] Structured Query language (SQL)
[1]16

fetchall() method fetches all rows in a result set and returns a:

Tuple of lists
List of tuples
List of strings
Tuple of strings
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
Directions: Q. 17 and 18 areĀ· ASSERTION (A) and REASONING (R) based questions.
[1]17

Assertion (A): To use a function from a particular module, we need to import the module.

Reason (R): Import statement can be written anywhere in the program, before using a function from that module.

Both (A) and (R) are true and (R) is the correct explanation for (A).

Both (A) and (R) are true and (R) is not the correct explanation for (A).

(A) is true, but (R) is false.

(A) is false, but (R) is true.

Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]18

Assertion (A): A stack is a LIFO structure.

Reason (R): Any new element pushed into the stack always gets positioned at the index after the last existing element in the stack.

Both (A) and (R) are true and (R) is the correct explanation for (A).

Both (A) and (R) are true and (R) is not the correct explanation for (A).

(A) is true, but (R) is false.

(A) is false, but (R) is true.

Concept: undefined - undefined
Chapter:
SECTION - B (Attempt any 5 questions)
[2]19

Atharva is a Python programmer working on a program to find and return the maximum value from the list. The code written below has syntactical errors. Rewrite the correct code and underline the corrections made.

def max_num (L):
        max=L(O)
        for a in L:
                if a > max
                 max=a
        return max
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[2]20
[2]20.a

Differentiate between wired and wireless transmission.

Concept: undefined - undefined
Chapter: [0.11] Data Communication [0.11] Data Communication
Advertisements
OR
[2]20.b

Differentiate Domain name and URL.

Concept: undefined - undefined
Chapter: [0.05] Python - Communication Technologies [0.1] Computer Networks
[2]21
[1]21.a

Given is a Python list declaration:

Listofnames = ["Aman", "Ankit", "Ashish", "Rajan", "Rajat"]

Write the output of:

print (Listofnames [−1:−4:−1])
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[1]21.b

Consider the following tuple declaration:

tup1 = ( 10, 20, 30, (10, 20, 30), 40)

Write the output of:

print(tupl.index(20))
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[2]22

Explain the concept of “Alternate Key” in a Relational Database Management System with an appropriate example.

Concept: undefined - undefined
Chapter: [0.08] Database Concepts
[2]23
[1]23.a
[0.5]23.a.i

Write the full form of the following:

HTML

Concept: undefined - undefined
Chapter: [0.05] Python - Communication Technologies [0.1] Computer Networks
[0.5]23.a.ii

Write the full form of the following protocol:

TCP

Concept: undefined - undefined
Chapter: [0.05] Python - Communication Technologies [0.11] Data Communication
[1]23.b

What is the need for Protocols?

Concept: undefined - undefined
Chapter: [0.11] Data Communication
[2]24
[2]24.a

Write the output of the code given below:

def short_sub (1st, n):
for i in range (0, n):
      if len (1st) > 4:
          lst [i] = lst [i] + lst [i]
      else:
          lst [i] = lst [i]
subject = ['CS', 'HINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS'] 
short_sub (subject, 5)
print (subject)
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
OR
[2]24.b

Write the output of the code given below:

a = 30
def call (x):
          global a
          if a%2==0:
             x+=a
          else:
             x−=a
          return x 
x=20
print (call (35), end="#") 
print (call (40), end="@")
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[2]25
[2]25.a

Differentiate between CHAR and VARCHAR data types in SQL with appropriate examples.

Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
OR
[2]25.b

Name any two DDL commands.

Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)

Name any two DML commands.

Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
SECTION - C
[3]26
[1]26.a

Consider the following tables – LOAN and BORROWER:

Table: LOAN

LOAN_NO B_NAME AMOUNT
L-170 DELHI 3000
L-230 KANPUR 4000

Table: BORROWER

CUST_NAME LOAN_NO
JOHN L-171
KRISH L-230
RAVYA L-170

How many rows and columns will be there in the natural join of these two tables?

Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[2]26.b

Write the output of the queries (i) to (iv) based on the table, WORKER given below:

TABLE: WORKER

W_ID F_NAME L_NAME CITY STATE
102 SAHIL KHAN KANPUR UTTAR PRADESH
104 SAMEER PARIKH ROOP NAGAR PUNJAB
105 MARY JONES DELHI DELHI
106 MAHIR SHARMA SONIPAT HARYANA
107 ATHARVA BHARDWAJ DELHI DELHI
108 VEDA SHARMA KANPUR UTTAR PRADESH
  1. SELECT F_NAME, CITY FROM WORKER ORDER BY STATE DESC;
  2. SELECT DISTINCT (CITY) FROM WORKER;
  3. SELECT F_NAME, STATE FROM WORKER WHERE L_NAME LIKE '_HA%';
  4. SELECT CITY, COUNT(*) FROM WORKER GROUP BY CITY;
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[3]27
[3]27.a

Write the definition of a Python function named LongLines() which reads the contents of a text file named 'LINES.TXT' and displays those lines from the file which have at least 10 words in it. For example, if the content of 'LINES.TXT' is as follows: 

Once upon a time, there was a woodcutter
He lived in a little house in a beautiful, green wood.
One day, he was merrily chopping some wood.
He saw a little girl skipping through the woods, whistling happily.
The girl was followed by a big gray wolf. 

Then the function should display output as:

He lived in a little house in a beautiful, green wood.
He saw a little girl skipping through the woods, whistling happily.

Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
Advertisements
OR
[3]27.b

Write a function count_Dwords() in Python to count the words ending with a digit in a text file "Details.txt".

Example:
If the file content is as follows:
On seat2 V1P1 will sit and
On seat1 VVIP2 will be sitting
The output will be:
The number of words ending with a digit is 4

Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
[3]28
[2]28.a

Write the outputs of the SQL queries (i) to (iv) based on the relations COMPUTER and SALES given below:

Table: COMPUTER
PROD_ID PROD_NAME PRICE COMPANY TYPE
P001 MOUSE 200 LOGITECH INPUT
P002 LASER PRINTER 4000 CANON OUTPUT
P003 KEYBOARD 500 LOGITECH INPUT
P004 JOYSTICK 1000 IBALL INPUT
P005 SPEAKER 1200 CREATIVE OUTPUT
P006 DESKET PRINTER 4300 CANON OUTPUT
Table: SALES
PROD_ID QTY_SOLD QUARTER
P002 4 1
P003 2 2
P001 3 2
P004 2 1
  1. SELECT MIN(PRICE), MAX(PRICE) FROM COMPUTER;
  2. SELECT COMPANY, COUNT(*) FROM COMPUTER GROUP BY COMPANY HAVING COUNT(COMPANY) > 1;
  3. SELECT PROD_NAME, QTY_SOLD FROM COMPUTER C, SALES S WHERE C.PROD_ID=S.PROD_ID AND TYPE = 'INPUT';
  4. SELECT PROD_NAME, COMPANY, QUARTER FROM COMPUTER C, SALES S WHERE C.PROD_ID=S.PROD_ID;
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[1]28.b

Write the command to view all databases.

Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[3]29

Write a function EOReplace() in Python, which accepts a list L of numbers. Thereafter, it increments all even numbers by 1 and decrements all odd numbers by 1.

Example:

If Sample Input data of the list is:

L = [10, 20, 30, 40, 35, 55]

Output will be:

L = [11, 21, 31, 41, 34, 54]
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[3]30
[3]30.a

A list contains the following records of customers.

[Customer_name, Room Type]

Write the following user-defined functions to perform given operations on the stack named 'Hotel':

  1. Push_Cust() - Push customers names of those customers who are staying in the 'Delux' Room Type.
  2. Pop_Cust() - Pop the names of customers from the stack and display them. Also, display "Underflow" when there are no customers in the stack.

For example:
If the lists with customer details are as follows:

["Siddarth", "Delux"]
["Rahul", "Standard"]
["Jerry", "Delux"]

The stack should contain

Jerry
Siddharth 

The output should be:

Jerry
Siddharth 
Underflow
Concept: undefined - undefined
Chapter:
OR
[3]30.b

Write a function in Python, Push (Vehicle) where, Vehicle is a dictionary containing details of vehicles – {Car_Name: Maker}. The function should push the name of car manufactured by 'TATA' (including all the possible cases like Tata, TaTa, etc.) to the stack.

For example:
If the dictionary contains the following data:

Vehicle=["Santro":"Hyundai","Nexon":"TATA","Safari":"Tata"]

The stack should contain

Safari
Nexon
Concept: undefined - undefined
Chapter:
SECTION - D
[5]31

Quickdev, an IT based firm, located in Delhi is planning to set up network for its four branches within a city with its Marketing department in Kanpur. As a network professional, give solution to the questions, after going through the branches locations and other details which are given below: 

DELHI BRANCH
BRANCH A BRANCH B
BRANCH C BRANCH D

 

KANPUR BRANCH
MARKETING DEPT.

Distance between various branches is a follows:

Branch Distance
Branch A to Branch B 40 m
Branch A to Branch C 80 m
Branch A to Branch D 65 m
Branch B to Branch C 30 m
Branch B to Branch D 35 m
Delhi Branch to Kanpur 300 km

Number of computers in each of the branches:

Branch Number of Computers
Branch A 15
Branch B 25
Branch C 40
Branch D 115
  1. Suggest the most suitable place to install the server for the Delhi branch with a suitable reason.
  2. Suggest an ideal layout for connecting all these branches within Delhi.
  3. Which device will you suggest, that should be placed in each of these branches to efficiently connect all the computers within these branches?
  4. Delhi firm is planning to connect to its Marketing department in Kanpur which is approximately 300 km away. Which type of network out of LAN, WAN, or MAN will be formed? Justify your answer.
  5. Suggest a protocol that shall be needed to provide help for transferring of files between Delhi and Kanpur branch.
Concept: undefined - undefined
Chapter: [0.05] Python - Communication Technologies [0.1] Computer Networks
[5]32
[5]32.a
[2]32.a.i

What possible output(s) are expected to be displayed on the screen at the time of execution of the following program:

import random
M=[5, 10, 15, 20, 25, 30]
for i in range(1, 3):
first=random.randint(2, 5)-1
sec=random.randint(3, 6)-2
third=random.randint(1, 4)
print(M[first],M[sec],M[third],sep="#") 
10#25#15
20#25#25
5#25#20
25#20#15
30#20#20
20#25#25
10#15#25#
15#20#10#
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[3]32.a.ii

The code given below deletes the record from the table employee, which contains the following record structure:

E_code - String
E_name - String
Sal - Integer
City - String

Note the following to establish connectivity between Python and MySQL:

  • Username is root
  • Password is root
  • The table exists in a MySQL database named emp.
  • The details (E_code, E_name, Sal, City) are the attributes of the table.

Write the following statements to complete the code:

Statement 1 – to import the desired library.

Statement 2 – to execute the command that deletes the record with E_code as 'E101'.

Statement 3 – to delete the record permanently from the database. ____________

import ____________ as mysql #Statement1
def delete():
      mydb=mysql.connect(host="localhost",use r="root", 
      passwd="root",database="emp")

mycursor=mydb.cursor()
____________ #Statement 2
____________ #Statement 3
print ("Record deleted") 
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
OR
[5]32.b
[2]32.b.i

Predict the output of the code given below: 

def makenew(mystr):
     newstr.=.""
     count=0
     for i in mystr:
        if count%2 ! = 0:
           newstr=newstr+str(count)
        else:
           if i.lower():
      newstr = newstr + i.upper ()
           else:
               newstr = newstr + i
       count+=1
    Print(newstr)
makenew("No@1") 
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
[3]32.b.ii

The code given below reads the following records from the table employee and displays only those records that have employees coming from the city 'Delhi':

E_code - String
E_name - String
Sal - Integer
City - String

Note the following to establish connectivity between Python and MySQL:

  • Username is root
  • Password is root
  • The table exists in a MySQL database named emp.
  • The details (E_code,E_name,Sal,City) are the attributes of the table.

Write the following statements to complete the code:

Statement 1 - to import the desired library.

Statement 2 - to execute the query that fetches records of the employees/coming from the city ‘Delhi’.

Statement 3 - to read the complete data of the query (rows whose city is Delhi) into the object named details, from the table employee in the database.

import ____________ as mysql  #Statement 1
def display():
   mydb=mysql.connect(host="localhost",user="root"
   passwd="root", database=" emp")
   mycursor=mydb.cursor()
   ____________ #Statement 2
   details = ____________ # Statement 3
   for i in details:
       print (i)
Concept: undefined - undefined
Chapter: [0.09] Structured Query language (SQL)
[5]33
[5]33.a

Write one difference between CSV and text files.

Concept: undefined - undefined
Chapter: [0.02] Advance Programming with Python [0.02] File Handling in Python

Write a program in Python that defines and calls the following use of defined functions:

  1. COURIER_ADD(): It takes the values from the user and adds the details to a CSV file 'courier.csv’. Each record consists of a list with field elements as cid, s_name, Source, destination to store Courier ID, Sender name, Source, and destination address, respectively.
  2. COURIER SEARCH(): Takes the destination as the input and displays all the courier records going to that destination. 
Concept: undefined - undefined
Chapter: [0.02] File Handling in Python
OR
[5]33.b

Why it is important to close a file before exiting?

Concept: undefined - undefined
Chapter: [0.02] File Handling in Python

Write a program in Python that defines and calls the following user-defined functions:

  1. Add_Book(): Takes the details of the books and adds them to a CSV file ‘Book. csv'. Each record consists of a list with field elements such as book_ID, B_name and pub to store book ID, book name and publisher, respectively.
  2. Search_Book(): Takes publisher name as input and counts and displays the number of books published by them. 
Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python
SECTION - E
[4]34

The school has asked their estate manager Mr Rahul to maintain the data of all the labs in a table LAB. Rahul has created a table and entered data from 5 labs.

LAB NO LAB_NAME INCNCHARGE CAPACITY FLOOR
L001 CHEMISTRY Daisy 20 I
L002 BIOLOGY Venky 20 II
L003 MATH Preeti 15 I
L004 LANGUAGE Daisy 36 III
L005 COMPUTER Mary 37 II

Based on the data given above answer the following questions:

(i) Identify the columns which can be considered as Candidate keys.

(ii) Write the degree and cardinality of the table.

(iii) Write the statements to:

      (a) Insert a new row with appropriate data.

      (b) Increase the capacity of all the labs by 10 students which are on
           the 'I' Floor.

                                     OR

(iii) Write the statements to:

        (a) Add a constraints PRIMARY KEY to the column LABNO in the table.

        (b) Delete the table LAB.

Concept: undefined - undefined
Chapter: [0.08] Database Concepts
[4]35

Shreyas is a programmer, who has recently been given a task to write a user-defined function named write_bin () to create a binary file called Cust_file.dat containing customer information – customer number (c_no), name (c_name), quantity (qty), price (price) and amount (amt) of each customer. 

The function accepts customer number, name, quantity and price. Thereafter, it displays the message 'Quantity less than 10.....Cannot SAVE', if the quantity entered is less than 10. Otherwise, the function calculates the amount as price*quantity and then writes the record in the form of a list into the binary file. 

import pickle
def write_bin ():
bin_file = ____________ # Statement 1
while True:
c_no = int (input (“enter customer name”))
c_name = input (“enter customer name”)
qty = int (input ("enter qty"))
price = int (input ("enter price”))
if ________ # Statement2
print (“Quantity less than 10.. Cannot SAVE")
else:
amt = price * gty
c_detail = [c_no, c_name, qty, price, amt]
__________ # Statement 3
ans = input (" Do you wish to enter more records y/n”) if ans. lower () == 'n’:
          __________ # Statement 4
    ____________ # Statement 5
____________#Statement 6

(i) Write the correct statement to open a file 'Cust_file.dat’ for writing the data of the customer.

(ii) Which statement should Shreyas fill in statement 2 to check whether the quantity is less than 10?

(iii) Which statement should Shreyas fill in Statement 3 to write data to the binary file and in Statement 4 to stop further processing if the user does not wish to enter more records?
                                      OR
(iii) What should Shreyas fill in Statement 5 to close the binary file named Cust_file.dat and in Statement 6 to call a function to write data in the binary file?

Concept: undefined - undefined
Chapter: [0.01] Exceptional Handling in Python

Other Solutions



































Submit Question Paper

Help us maintain new question papers on Shaalaa.com, so we can continue to help students




only jpg, png and pdf files

CBSE previous year question papers Class 12 Computer Science (Python) with solutions 2022 - 2023

     CBSE Class 12 Computer Science (Python) question paper solution is key to score more marks in final exams. Students who have used our past year paper solution have significantly improved in speed and boosted their confidence to solve any question in the examination. Our CBSE Class 12 Computer Science (Python) question paper 2023 serve as a catalyst to prepare for your Computer Science (Python) board examination.
     Previous year Question paper for CBSE Class 12 Computer Science (Python)-2023 is solved by experts. Solved question papers gives you the chance to check yourself after your mock test.
     By referring the question paper Solutions for Computer Science (Python), you can scale your preparation level and work on your weak areas. It will also help the candidates in developing the time-management skills. Practice makes perfect, and there is no better way to practice than to attempt previous year question paper solutions of CBSE Class 12.

How CBSE Class 12 Question Paper solutions Help Students ?
• Question paper solutions for Computer Science (Python) will helps students to prepare for exam.
• Question paper with answer will boost students confidence in exam time and also give you an idea About the important questions and topics to be prepared for the board exam.
• For finding solution of question papers no need to refer so multiple sources like textbook or guides.
Share
Notifications

Englishą¤¹ą¤æą¤‚ą¤¦ą„€ą¤®ą¤°ą¤¾ą¤ ą„€


      Forgot password?
Use app×