As the CBSE board exams approach, students across the country are gearing up for one of the most important assessments of their academic journey. To help Class 12 Computer Science students prepare effectively, we have provided the 2024 CBSE Computer Science question paper along with detailed solutions. These solutions are designed to guide students through each question, offering clear explanations and insights to enhance their understanding and exam readiness.
Section A – Multiple Choice Questions (Each carries 1 mark)
- True or False: While defining a function in Python, the positional parameters in the function header must always be written after the default parameters.
- The SELECT statement when combined with the ________ clause returns records without repetition:
- (a) DISTINCT
- (b) DESCRIBE
- (c) UNIQUE
- (d) NULL
- What will be the output of the following statement:
print(16*5/4*2/5-8)
- (a) -3.33
- (b) 6.0
- (c) 0.0
- (d) -13.33
- What possible output from the given options is expected to be displayed when the following Python code is executed?
import random Signal = ['RED', 'YELLOW', 'GREEN'] for K in range(2, 0, -1): R = random.randrange(K) print(Signal[R], end='#')
- (a) YELLOW # RED #
- (b) RED # GREEN #
- (c) GREEN # RED #
- (d) YELLOW # GREEN #
- In SQL, the aggregate function which will display the cardinality of the table is ________.
- (a) sum()
- (b) count()
- (c) avg()
- (d) sum(*)
- Which protocol out of the following is used to send and receive emails over a computer network?
- (a) PPP
- (b) HTTP
- (c) FTP
- (d) SMTP
- Identify the invalid Python statement from the following:
- (a) d = dict()
- (b) e = {}
- (c) f = []
- (d) g = dict{}
- Consider the statements given below and choose the correct output from the given options:
myStr = "MISSISSIPPI" print(myStr[:4] + "#" + myStr[-5:])
- (a) MISS#SIPPI
- (b) MISS#SIP
- (c) MISS#IPPIS
- (d) MISSI#IPPIS
- Identify the statement from the following which will raise an error:
- (a) print(“A”*3)
- (b) print(5*3)
- (c) print(“15” + 3)
- (d) print(“15” + “13”)
- Select the correct output of the following code:
event = "G20 Presidency@2023" L = event.split(' ') print(L[::-2])
- (a) [‘G20’]
- (b) [‘Presidency@2023’]
- (c) [‘G20’]
- (d) ‘Presidency@2023’
- Which of the following options is the correct unit of measurement for network bandwidth?
- (a) KB
- (b) Bit
- (c) Hz
- (d) Km
- Observe the given Python code carefully:
a = 20 def convert(a): b = 20 a = a + b convert(10) print(a)
- (a) 10
- (b) 20
- (c) 30
- (d) Error
- True or False: While handling exceptions in Python, the name of the exception has to be compulsorily added with the except clause.
- Which of the following is not a DDL command in SQL?
- (a) DROP
- (b) CREATE
- (c) UPDATE
- (d) ALTER
- Fill in the blank: _________ is a set of rules that needs to be followed by the communicating parties in order to have a successful and reliable data communication over a network.
- Consider the following Python statement:
F = open('CONTENT.TXT')
Which of the following is an invalid statement in Python?
- (a) F.seek(1, 0)
- (b) F.seek(0, 1)
- (c) F.seek(0, -1)
- (d) F.seek(0, 2)
- Assertion (A): A CSV file is a human-readable text file where each line has a number of fields, separated by a comma or some other delimiter.Reason (R): The writerow() method is used to write a single row in a CSV 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.
- Assertion (A): The expression
"HELLO".sort()
in Python will give an error.Reason (R): Thesort()
method does not exist for strings 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.
Section B – Very Short Answer Questions (Each carries 2 marks)
- Rewrite the following code to correct syntactical errors:
def max_num(L): max = L(0) for a in L: if a > max: max = a return max
- Differentiate between wired and wireless transmission.
- Differentiate between URL and domain name with the help of an example.
- Consider the Python list:
Listofnames = ["Aman", "Ankit", "Ashish", "Rajan", "Rajat"]
. Write the output of:print(Listofnames[-1::-4:-1])
- Explain the concept of “Alternate Key” in a Relational Database Management System with an example.
- Write the full forms of:
- (i) HTML
- (ii) TCP
- Write the output of the following code:
subject = ['CS', 'HINDI', 'PHYSICS', 'CHEMISTRY', 'MATHS'] short_sub(subject, 5) print(subject)
Section C – Short Answer Questions (Each carries 3 marks)
- Differentiate between CHAR and VARCHAR data types in SQL with an example.
- Consider the following tables – LOAN and BORROWER. How many rows and columns will be there in the natural join of these two tables?
- Write a Python function
LongLines()
that reads the contents of a text file and displays lines with at least 10 words. - Write the SQL queries for:
- SELECT MIN(PRICE), MAX(PRICE) FROM COMPUTER;
- SELECT COMPANY, COUNT(*) FROM COMPUTER GROUP BY COMPANY HAVING COUNT(COMPANY) > 1;
- Write a function
EOReplace()
in Python which accepts a list of numbers and increments all even numbers by 1 and decrements all odd numbers by 1.
Section D – Long Answer Questions (Each carries 5 marks)
- Write a function
Push_Cust()
to push customer names staying in ‘Delux’ room type in a stack, andPop_Cust()
to pop and display customer names. - An IT-based firm is planning to set up a network for its branches. Suggest an ideal layout to connect the branches and justify your choice.
- Write a program in Python that defines and calls the following user-defined functions:
COURIER_ADD()
: Takes values from the user and adds them to a CSV filecourier.csv
.COURIER_SEARCH()
: Takes the destination as input and displays all the courier records going to that destination.
Section E – Internal Choice Questions (Each carries 4 marks)
- The school has asked their estate manager Mr. Rahul to maintain the data of all the labs in a table LAB. Based on the data, identify the columns which can be considered as Candidate keys and write the degree and cardinality of the table.
- Write a user-defined function
write_bin()
to create a binary file calledCust_file.dat
and store customer information (customer number, name, quantity, price, and amount).
Disclaimer
The question bank provided on this website is meant to be a supplementary resource for final term exam preparation. While we strive to offer accurate and relevant content, students should not rely solely on these answers. It is essential to conduct further research and consult teachers, school authorities, or subject experts to ensure thorough understanding and preparation. The solutions here are based on general interpretations and may not reflect the exact responses expected by examination boards. We are not responsible for any discrepancies or outcomes in exams resulting from the use of this material. By using this resource, you acknowledge that your academic success depends on comprehensive preparation, including active engagement with school materials and guidance from educators.