0% found this document useful (0 votes)
10 views4 pages

Computer Science Mid-Term Exam 2025

Uploaded by

suajag7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Computer Science Mid-Term Exam 2025

Uploaded by

suajag7
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

II PUC Mid-Term, October-2025

SUB: COMPUTER SCIENCE (41)

Time: 3hr Date: /10/2025 Max marks: 70


----------------------------------------------------------------------------------------------------------------
PART-A
I. Answer all the following questions with appropriate choice 15 X 1 = 15
(Each question carries ONE Mark).

1. What does the IOError exception indicate?


a) Anundefined variable b) A file that cannot be opened
c) Adivision by zero d) Anincorrect argument type
2. Which method is used to write Python objects to a binary file?
a) write() b) dump() c) load() d) pickle()
3. In Python, which data type is commonly used to implement a stack?
a)Tuple b)Set c) List d)Dictionary
4. Which operation would you perform to add an element at the front of a deque?
a) insertRear() b) append()
c) insertFront() d) enqueue()
5. Which operation removes an element from the rear of a deque?
a) deletionFront b) pop(0) c) deletionRear d) enqueue
6. Which of the following algorithms uses a temporary variable during swapping?
a) Bubble Sort b) Selection Sort
c) Insertion Sort d) All of the above
7. The number of comparisons in the worst case for Bubble Sort is:
a) n b) n-1 c) n(n-1)/2 d) log n

8. What is the mid index calculated as in the binary search algorithm?


a) (first + last) / 2 b) (first + last) % 2
c) (first + last) // 2 d) (first + last) * 2

9. What is a requirement for the binary search algorithm to work properly?


a) The list must be hashed b) The list must be unsorted
c) The key must be negative d) The list must be sorted
10. What does metadata represent?
a) Multimedia content b) Data about data
c)Only numerical data d) None of the above
11. Which of these is a benefit of DBMS over a file system?
a) Redundancy increases b) Harder to access
c) Better data integrity d) Data stored manually
12. What type of value is considered ‘atomic’?
a) Anull value b) Aunique identifier
c) An indivisible value d)Acomposite key
13. What is meta-data in a database system?
a) Summary table b) Data about the data
c) Atype of primary key d) Redundant data
14. A tuple is:
a) Aunique column name b) Adata file
c)Arow in a table d) Atype of schema
15. Which DBMSfeature allows data changes over time?
a) Static schema b) Database instance
c) Meta-data d) Query cache

II. Fill in the blanks choosing the appropriate word/words from those
given the brackets. (Write complete sentence with option.) 5X 1= 5
(collision resolution,Searching,finally,append(),deque)
1. A ____________ block is always executed, regardless of whether an exception
occurred or not.
2. In stack implementation using Python list, elements are added using the ___________
method.
3. A data structure that can behave like both a queue and a stack is known as
________________.
4. Sorting helps to improve the efficiency of _______________ operations on large
datasets.
5. The process of finding a new position for elements during collision is known as
______________.

Part-B
III. Answer any Four questions: 2X 4 = 8
(Each question carries TWO Marks).
1. Differentiate between syntax errors and exceptions in Python.
2. Differentiate between text and binary files with three points each
3. Mention any two applications of stack in computer science.
4. Differentiate between Linear Search and Binary Search.
5. Define ‘collision’ in hashing. What is a perfect hash function?
6. What is meant by data redundancy in a file system?
7. Differentiate between Database Schema and Database Instance.

PART-C
IV Answer any FOUR questions: 4X 3 = 12
(Each question carries THREE Marks).
1. What are built-in exceptions? List any five with examples.
2. Explain user-defined exceptions with an example
3. Evaluate the postfix expression: P Q R * + S T / -
where P = 10, Q = 6, R = 2, S = 8, T = 4 post on the stack.
4. Write difference between queue and Deque
5. Write the algorithm for Bubble Sort and explain its steps.
6. Distinguish between range and standard deviation with formula and example.
7. What are the main limitations of a file system that are overcome by a DBMS?

PART-D
IV Answer any Four questions: 4X 5 = 20
(Each question carries Five Marks).
1. Explain try..except..else clause in python with example.
2. Write steps of Implementation of Stack in Python.
3. Write Algorithm of Conversion of expression from infix to postfix notation.
4. Write algorithm to check weather string is palindrome or not.
5. Explainn the implementation of Dqueue.
6. Explain the limitations of a file system that are overcome by using a
Database Management System (DBMS).
7. Define the following:
a. a)Meta-data b) Domain c) DBMS d) Degree e) Cardinality

PART – E
V. Answer any Two questions. (2X5= 10)
(Each question carries FIVE marks.)
1. Write the algorithm and Python program for Selection Sort.
2. Consider a list numList = [5,4,7,3,0,2,1-6,9] sort elements of list using
insertion sort method.
3. Consider numList=[5,8,12,18,22,25,30,34,55,66]. Find the position of key 66
using binary search method.

************

Common questions

Powered by AI

Linear search iterates through each element in a dataset to find a target value, operating efficiently with both sorted and unsorted datasets but being less optimal for large datasets due to its O(n) complexity. Binary search, on the other hand, is much more efficient with a time complexity of O(log n) but requires the dataset to be sorted beforehand . These differences significantly impact the performance based on the dataset organization .

A 'perfect hash function' is a type of hashing function where there are no collisions; every input maps uniquely to a distinct hash value. This is significant as it ensures constant time complexity O(1) for search operations, enhancing performance significantly. However, constructing a perfect hash function can be computationally challenging and is typically used when the set of keys is fixed and known beforehand .

Metadata in a database system represents data about data, providing information about other data's structure, origin, usage constraints, and more. This differs from actual data as metadata does not represent the content but rather describes the data's attributes, making it essential for data management, understanding the data context, ensuring data integrity, and optimizing queries .

The 'finally' block in Python exception handling is used to execute code regardless of whether an exception occurs or not. It ensures that the specified block of code runs no matter what, typically used for cleanup actions like releasing resources or closing files. In contrast, the 'try' block contains code that might cause an exception, and the 'except' block handles the exception if it occurs. Unlike 'except', 'finally' is always executed after 'try', regardless of the success or failure of the try block .

Bubble Sort and Selection Sort both have O(n^2) time complexity, but Bubble Sort has the advantage of potentially finishing early if the list becomes sorted ahead of time due to its ability to detect sorted sequences during passes. This adaptivity is absent in Selection Sort, making Bubble Sort sometimes faster in practice for nearly sorted datasets .

A Tuple in Python is an immutable sequence, meaning once it is created, its elements cannot be modified, which makes it distinct from Lists that are mutable. Sets, meanwhile, are unordered collections of unique items. The immutability of Tuples makes them suitable for use as dictionary keys and ensures data isn't changed accidentally, which is critical for maintaining data integrity and program stability .

The mid-index in the Binary Search algorithm is crucial as it determines the middle point for dividing the dataset into halves, enabling a divide-and-conquer approach to efficiently locate the target value. It is calculated using integer division as \((first + last) // 2\), ensuring an accurate midpoint selection by avoiding floating-point arithmetic issues, thus maintaining performance efficiency .

A Database Management System (DBMS) offers several advantages over traditional file systems, including better data integrity, reduced redundancy, easier access to data, and more security. Unlike file systems, DBMS provides a centralized framework to manage data, allowing for concurrent access and transaction management, which enhances the system's reliability and efficiency .

A Deque (double-ended queue) differs from a regular Queue as it allows insertion and deletion of elements from both ends, making it more versatile. In contrast, a Queue follows the First-In-First-Out (FIFO) principle, permitting insertions at the back and deletions at the front only. The flexibility of deques makes them suitable for scenarios needing access to both ends, efficiently supporting operations like O(1) insertions and deletions .

A stack in Python can be implemented using a list where the append() method is used to add elements to the stack (push), and the pop() method is used to remove elements from the top of the stack (pop). The stack follows the Last-In-First-Out (LIFO) principle, with the 'append()' method adding elements at the end of the list and 'pop()' removing the last element. This simplicity in methods facilitates efficient stack management .

You might also like