CBSE 2025, Compartment, Set 4 Solutions
CBSE Computer Science (2025)
Question Paper
49 QuestionsWhich of the following is a mapped data type?
Assertion (A): Foreign key column of a table cannot have NULL entries. Reason (R): Primary key column of a table cannot have NULL entries.
Choose the correct option:
What is the value of the following expression?
[Code Block]
What is the output of the following expression?
[Code Block]
What will be the output of the following code segment?
[Code Block]
Which of the following devices is essential to set up a wired LAN?
Which of the following is not a valid relational operator used with WHERE clause in SQL?
What is the default format of date in MySQL?
If the dictionary D1 is defined as:
[Code Block]
then which of the following statements is incorrect and hence will result in an error?
Which of the following list methods accepts exactly 2 parameters?
Assuming that D1 and D2 are Python dictionaries, write the statement using built-in functions/methods:
To update dictionary D2 with the elements of D1.
A text file song.txt contains the following contents in it:
Life goes on as it never ends
What will be the output of the following code snippet?
[Code Block]
What will be the output of the following code segment?
[Code Block]
Assuming that D1 and D2 are Python dictionaries, write the statement using built-in functions/methods:
To generate a tuple of keys of D2.
Assertion (A): Every object in Python is assigned a unique identity (ID). Reason (R): ID remains the same for the lifetime of that object.
Choose the correct option:
State whether the following statement is True or False.
In Python, the print() evaluates the expression before displaying it on the screen.
Identify the output of the following code segment:
[Code Block]
What is the difference between = and == in Python? Give an example of each.
Assuming that D1 and D2 are Python dictionaries, write the statement using built-in functions/methods:
To delete all the elements of D1.
Ginni has created a table, SCORES in MySQL to store runs scored by players in a cricket match. The table contains the following records:
Which of the following statements will give 10 as output?
Assuming that D1 and D2 are Python dictionaries, write the statement using built-in functions/methods:
To generate a list of values of D1.
Identify the correct possible output(s) of the following code segment. Also write the minimum and the maximum possible values of the variable b.
[Code Block]
Write a function in Python to display the line which has the maximum number of vowels from a text file, "Novel.txt".
The code provided below is intended to input a positive integer from the user and display the total number of its factors. However, there are syntax and logical errors in the code. Rewrite the code after removing all the errors. Underline all the corrections made.
[Code Block]
Write any one difference between CHAR and VARCHAR data types in MySQL.
Write a Python function that displays all the lines ending with a dot (.) from a text file "Colors.txt". For example, if the file contains: White is a mix of seven colors. What are these seven colors ? VIBGYOR - violet, indigo, blue, green, orange and red. When we mix all these colors we just get one light which is the WHITE light.
Then the output should be : White is a mix of seven colors. VIBGYOR - violet, indigo, blue, green, orange and red.
(Hint: You will have to ignore trailing white spaces to check the last character)
Write an SQL command to remove a column named ADDRESS, from a table named CUSTOMER.
Give an example of each of the following: \n (i) An expression using any one identity operator. \n (ii) An arithmetic expression which uses any one augmented assignment operator.
A stack named KeyStack contains records of some computer keyboards. Each record is represented as a list containing Make, Keys, Connectivity. The Make and Connectivity are strings, and Keys is an integer. For example, a record in the stack may be ("Hitech", 105, "USB").
Write the following user-defined functions in Python to perform the specified operations on KeyStack:
(I) push_key (KeyStack, new_key): This function takes the stack KeyStack and a new record new_key as arguments and pushes this new record onto the stack.
(II) pop_key (KeyStack): This function pops the topmost record from the stack and returns it. If the stack is already empty, the function should display the message "Underflow".
(III) isEmpty(KeyStack): This function checks whether the stack is empty. If the stack is empty, the function should return True, otherwise the function should return False.
Write the following user-defined functions in Python:
(I) push_vowels (S, St): Here s is a string and st is a list representing a stack. The function should push all the vowels of the string s onto the stack st. For example, if the string s is "Easy Concepts", then the function push_vowels() should push the elements "E", "a", "o", "e" onto the stack.
(II) pop_one (St): The function should pop an element from the stack st, and return this element. If the stack is empty, then the function should display the message "Stack Underflow", and return None.
(III) display_all(St): The function should display all the elements of the stack st, without deleting them. If the stack is empty, the function should display the message "Empty Stack".
In a particular examination, there are 50 candidates with roll numbers from 997601 to 997650. The data of these candidates is stored in a table in a database. What is the domain of the column which stores the roll numbers of the candidates?
Write the output on execution of the following Python code :
[Code Block]
Consider the table STAFF given below :
Write the suitable SQL queries to perform the following tasks: (I) To display the average salary of each department. (II) To insert the following record in the table, STAFF. STAFF ID: S333 STAFF NAME: GURMEET SALARY: 15000 DEPARTMENT: ADMIN DESIGNATION: CLERK (III) To display the unique designations from the table. (IV) To display all the details of the staff whose name is of four letters.
Consider the table STAFF given below :
Write the output for the queries given below:
(I) SELECT STAFF_NAME FROM STAFF WHERE SALARY BETWEEN 25000 AND 30000;
(II) SELECT * FROM STAFF WHERE DEPARTMENT = "MATHS" AND SALARY > 25000;
(III) SELECT STAFF_NAME, STAFF_ID FROM STAFF WHERE DEPARTMENT LIKE "%S";
(IV) SELECT MAX(SALARY) FROM STAFF;
Suman is an intern at a software startup. The company has assigned her a task to create a CSV file named CLUB.CSV, to store the records of the Club members. After discussing with Club Incharge, Suman has planned to store the following content of members in the file CLUB.CSV:
[Mno, Name, Mobile, Fee]
Where
Mno: Member NumberName: Name of the MemberMobile: Member's Mobile NumberFee: Fee amount
Assuming you are asked to help Suman in her assignment, write a Python code for performing the following tasks with the help of user-defined functions:
NewMembers(): to accept records of members from the user and add them to the file CLUB.CSV.
PriorityMember(): to find and display those members from the file CLUB.CSV, who are paying Fee more than 35000.
Write the output on execution of the following Python code :
[Code Block]
Assume that you are working for ABC Corporation (ABCC). ABCC allots contracts to different contractors for some of its works. The data of Contracts and Contractors are kept in the tables Work and Contractor respectively. Following are a few records from these two tables of ABCC's database.
Note: The tables contain many more records than shown here. As an employee of ABCC, you are required to write the SQL queries for the following: (I) To display all the records from the Work table in alphabetical order of W_Name. (II) To display the names of contractors where W_Amt is more than 15000. (III) To display the structure of Work table. (IV) To count total number of records present in Work table.
Assume that you are working for ABC Corporation (ABCC). ABCC allots contracts to different contractors for some of its works. The data of Contracts and Contractors are kept in the tables Work and Contractor respectively. Following are a few records from these two tables of ABCC's database.
Note: The tables contain many more records than shown here. As an employee of ABCC, you are required to write the SQL queries for the following: (I) To display all the records from the Work table in alphabetical order of W_Name. (II) To display the names of contractors where W_Amt is more than 15000. (III) To display the structure of Work table. (IV) To delete the records of contractors whose phone number is not known.
Keshav is the IT Head in a hospital. He needs to manage the records of all the doctors in the hospital. For this, he wants to store the following information of each doctor in a file:
D_ID: An integer to store Doctor ID.D_Name: A string to store doctor's name.D_Dept: A string to store the Department of the doctor. (Surgery, Radiology, etc.)Experience: An integer to store doctor's experience (in years)
For example, a doctor's information may be:
[1256, "R. Gupta", "Cardiology", 15]
As an applicant for the post of a Programmer, you have to answer the following questions in this context:
(I) Write one difference of storing this data in a binary file over a CSV file.
(II) Assume that the data is stored in a binary file, named DOCTORS.DAT, and each record is stored as a list. Write a function, in Python, to read and display all the records from the file DOCTORS.DAT.
(III) Write a function addDoctor(), in Python, which accepts a doctor's data from the user and writes it in the file DOCTORS.DAT.
Write any two DDL commands.
Write one difference between Primary key and Unique constraint.
Write an SQL command to add a column named ADDRESS, of type VARCHAR(20) in a table named CUSTOMER.
State if following statement is True or False:
If T is a tuple and L is a list, then T+L is a valid statement in Python.
Nutan Kumar is using Python connectivity with MySQL for maintaining data for a table named MEDICINES in a database PHARMACY. The table has the following attributes:
MId(Medicine number) : stringMname(Medicine Name) : stringExpiry(Expiry Date) : DateStatus(Active/Discard) : string
Consider the following to establish connectivity between Python and MySQL:
- Username: root
- Password: tiger
- Host: localhost
Help Nutan to write the definition of a user-defined function named ChangeStatus() in Python to change the Status of the Medicines whose Expiry is before "2022-12-31" as "DISCARD".
Which network device serves as the entry and exit point of a network, as all data coming in or going out of a network must first pass through it ?
(a) Expand the following terms: POP, TCP (b) Write any one difference between a hub and a switch used in computer networks.
(a) Write any one difference between HTTP and HTTPS. (b) Write names of any two wireless transmission media.
'CKNG Auto' is a big car-selling agency having its Head Office in Delhi. It is planning to set up a new branch in Patiala. The Patiala branch will have four blocks - ADMIN, SALES, SERVICE and INSURANCE. You, as a network expert, need to suggest the best network-related solutions for them to resolve the issues/problems mentioned in points (I) to (V), keeping the following parameters in mind.
Distance of Delhi Head Office from Patiala branch = 250 km
Number of computers in each block is as follows:
(I) Suggest the most appropriate location of the server inside the Patiala branch. Justify your choice.\n (II) What kind of network (PAN/LAN/MAN/WAN) will be formed by interconnecting all the computers inside a block ?\n (III) Draw the most effective cable layout to connect all four blocks of Patiala branch.\n (IV) Which device should be used to provide Internet connection to all the computers in the Patiala branch ?\n (V) (a) Which is the best wired medium to connect server of Patiala office to the head office at Delhi ?\n OR \n (b) Is there a need for repeater(s) in Patiala branch ? Why, or why not?
Which of the following IP addresses is valid ?
Paper Overview
Total Marks
70
Time
3 Hrs
Content Weightage
Question Pattern
- MCQ17
- Subjective30
- TRUE FALSE2
Decoding the 2025 CBSE Computer Science Paper
The 2025 Computer Science examination paper (CBSE 2025, Compartment, Set 4) is a crucial resource for understanding the examiner's mindset. By analyzing the content weightage above, you can see exactly which units carried the most focus and required deep conceptual understanding.
Click on any question to view its detailed, step-by-step solution. We provide the official marking scheme breakdown, ensuring you know exactly where marks are awarded for formulas, substitution, and final answers.
Edvaya Target
Board & Competitive Exams Made Easy
Edvaya Target is built for students preparing for JEE (Main & Advanced), NEET UG, and Board Exams (CBSE, ISC & State Boards) — using a practice-first approach that actually works.

