All Exams  >   CUET  >   CUET UG Mock Test Series 2025  >   All Questions

All questions of Computer Science for CUET Exam

Which of the following is not a type of computer network?
  • a)
    Local Area Network (LAN)
  • b)
    Personal Area Network (PAN)
  • c)
    Remote Area Network (RAN)
  • d)
    Metropolitan Area Network (MAN)
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
Remote Area Network or RAN was a network method that enabled wireless transfer of data via landline, RS232 serial port, cell phone or satellite connections. The Symax 8030 CRM 560 was a Remote Network Interface Module that used this method of linking IO from field devices to local area and remote area networks. The RAN methodlogy is the basis for transmitting data via radio modems.

Which of the following provides a command for defining relation schema?
  • a)
    DDL
  • b)
    DML
  • c)
    TCL
  • d)
    DQL
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
Data Definition Language: The SQL DDL provides commands for defining relation schemas, deleting relations, and modifying relation schemas.

A text file student.txt is stored in the storage device. Identify the correct option out of the following options to open the file in read mode.
(i) myfile = open('student.txt','rb')
(ii) myfile = open('student.txt','w')
(iii) myfile = open('student.txt','r')
(iv) myfile = open('student.txt')
  • a)
    Only i
  • b)
    Both i and iv
  • c)
    Both iii and iv
  • d)
    Both i and iii
Correct answer is option 'C'. Can you explain this answer?

Amita Das answered
  • There are some codes to handle a file in a programming language.
  • myfile=open('student. txt', 'w') is the mode that allows opening a file in write mode.
  • myfile=open('student.txt', 'r') is the mode that open file in only read mode.
  • myfile= open ('student.txt') is also allowed to open in reading mode.

Referential integrity constraint in a relational database is specified with the help of a _________.
  • a)
    primary key
  • b)
    secondary key
  • c)
    foreign key
  • d)
    none of the above
Correct answer is option 'C'. Can you explain this answer?

Sarthak Joshi answered
Referential integrity constraint in a relational database is specified with the help of a foreign key.

The referential integrity constraint is a rule that ensures the consistency and accuracy of data in a relational database. It specifies that values in one table's foreign key column must match the values in another table's primary key column. This constraint helps maintain the relationships between tables and prevents inconsistencies or errors in the data.

Foreign Key:
A foreign key is a column or a set of columns in a table that refers to the primary key of another table. It establishes a link between two tables based on a common field. The foreign key acts as a cross-reference between the tables and represents the relationship between them. In other words, it provides a way to connect data from multiple tables in a relational database.

Role of Foreign Key in Referential Integrity Constraint:
When a foreign key is defined in a table, it establishes a relationship between that table (known as the referencing table) and another table (known as the referenced table). The foreign key column in the referencing table contains values that match the primary key values in the referenced table. This relationship is enforced by the referential integrity constraint.

The referential integrity constraint ensures that the values in the foreign key column of the referencing table are always valid and consistent. It prevents the insertion of values that do not exist in the referenced table's primary key column. If an attempt is made to insert such invalid values, the database management system will raise an error and reject the operation.

Similarly, the referential integrity constraint also maintains the integrity of the data during updates and deletions. If a referenced primary key value is modified or deleted, the database management system can automatically update or delete the corresponding foreign key values in the referencing table to maintain consistency.

In summary, the foreign key plays a crucial role in specifying and enforcing the referential integrity constraint in a relational database. It ensures that the relationships between tables are maintained and that the data remains accurate and consistent.

In which case is the NameError exception raised in Python?
  • a)
    When a requested module definition is not found
  • b)
    When a keyword is used as a variable name
  • c)
    When a variable name cannot be found
  • d)
    When a file to be opened cannot be found
Correct answer is option 'C'. Can you explain this answer?

Amita Das answered
  • When a requested module definition is not found, the ImportError exception is raised.
  • When a keyword or a reserved word is used as a variable name, it leads to a syntax error.
  • When a statement accessed a variable that is not found in the local or global scope, then the program raises a NameError.
  • When a specified file cannot be opened by a program, it causes an exception of IOError type.

Consider the list of data [56, 80, 39, 41, 29, 61] and the hash function h[i] = i % 7 where i is each element of the list. What will be the index value of the element 39?
  • a)
    9
  • b)
    3
  • c)
    2
  • d)
    4
Correct answer is option 'D'. Can you explain this answer?

Amita Das answered
  • The hash function is modulo 7. This means, that each element is divided by 7 and the number is positioned at the index equal to the remainder.
  • 39 % 7 = 4 and so the element is located at index position 4.

What is the significance of the tell() method?
  • a)
    It tells the path of file.
  • b)
    It tells the current position of the file pointer within the file.
  • c)
    It tells the end position within the file.
  • d)
    It checks the existence of a file at the desired location.
Correct answer is option 'B'. Can you explain this answer?

Debolina Ahuja answered
The significance of the tell() method in file handling is that it tells the current position of the file pointer within the file. The file pointer is a marker that indicates the next position from where data will be read or written in a file. The tell() method returns the current position of this file pointer, which can be useful in various scenarios during file operations.

Understanding the file pointer
In file handling, the file pointer is used to keep track of the current position within a file. Whenever data is read from or written to a file, the file pointer is automatically moved to the next position. Initially, the file pointer is set to the beginning of the file (position 0). As data is read or written, the file pointer moves forward.

Working of the tell() method
The tell() method in file handling is used to determine the current position of the file pointer. It returns an integer value that represents the offset from the beginning of the file. This value can be used to keep track of the progress when reading or writing large files, or to perform specific operations at certain positions within a file.

Usefulness of the tell() method
The tell() method has several practical applications in file handling:

1. Reading and writing at specific positions: By using the tell() method, the current position of the file pointer can be determined. This information can then be used to read or write data at specific positions within a file.

2. Resuming file operations: If a file operation is interrupted or halted for some reason, the tell() method can be used to store the current position. Later, when the operation is resumed, the file pointer can be set to the stored position using the seek() method, ensuring that the operation continues from where it left off.

3. Progress tracking: The tell() method can be used to track the progress of reading or writing large files. By printing or storing the current position at regular intervals, the progress can be displayed to the user or used for other purposes.

Conclusion
In conclusion, the tell() method in file handling is significant because it provides information about the current position of the file pointer within a file. This information can be used for various purposes, such as reading or writing at specific positions, resuming interrupted file operations, or tracking the progress of file operations.

Syntax of seek function in Python is myfile.seek(offset, reference_point) where myfile is the file object. What is the default value of reference_point?
  • a)
    0
  • b)
    1
  • c)
    2
  • d)
    3
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
The reference_point is selected by the from_what argument. It accepts three values:
0: sets the reference_point at the beginning of the file.
1: sets the reference_point at the current file position.
2: sets the reference_point at the end of the file.
By default from_what argument is set to 0.

How many swaps are required using bubble sort to sort the list L1?
L1: [127,119,223,136,233,134]
  • a)
    2
  • b)
    3
  • c)
    4
  • d)
    5
Correct answer is option 'D'. Can you explain this answer?

Amita Das answered
In bubble sort, the maximum element will move to the extreme right side of the list.
Applying Bubble sort in L1- [127,119,223,136,233,134] Take 127 to be the bubble element and compare that with the next element, if the next element is greater than the current element then shift the bubble element, if not then swap two elements.
Pass-1:
127 is greater than 119, So, swapping is required. Swap 127 and 119.
Total swap-1 
L1- [119,127,223,136,233,134]
Now, compare 127 with 223, No swapping required.
Compare 223 with 136, and swap them.
Total swap - 2 
L1- [119,127,136,223,233,134]
Compare 223 with 233, no swapping is required. 
Compare 233 and 134,1 Swapping required as 134 is smaller than 233. Pass 1 ends here.
Total swap -3 
L1- [119,127,136,223,134,233]
Pass-2:
Compare 119 with 127, no swap is required.
Compare 127 with 136 no swap is required.
Compare 136 with 223, no swap is required.
Compare 223 with 134 - 1 swap required as 134 is smaller than 223. 
Total swap-4
L1- [119,127,136,134,223,233]
Pass-3:
Now, compare 119 with 127, no swap is required.
Compare 127 with 136, no swap is required.
Compare 136 with 134  and 1 swap is required as 134 is smaller than 136.
Total swap - 5 
L1- [119,127,134,136,223,233]
Pass-4:
Now compare 119 with 127, no swap is required.
Compare 127 with 134, no swap is required.
So, the list is already sorted.
In total 5 swaps are required to sort the list using bubble sort.
Option 4 will be the answer.

How many passes are required for sorting 8 elements list using bubble sort?
  • a)
    0
  • b)
    9
  • c)
    8
  • d)
    7
Correct answer is option 'D'. Can you explain this answer?

Anjali Sharma answered
Bubble Sort is one of the simplest sorting algorithms which works by repeatedly swapping the adjacent elements if they are in the wrong order.
The logic of working- Greatest element of the list will be at the end after the 1st pass.
Compare with the neighbors, if greater then swap it.
Let's take a simple example to understand it better.
Example:
No. of element = 8(70,25,10,75,80,85,90,15)
1st pass - {70,25,10,75,80,85,15} 90 = 7 comparison
2nd pass - {70,25,10,75,80,15} 85,90 = 6 comparison 
3rd pass - {70,25,10,75,15} 80,85,90 = 5 comparison
4th pass- {70,25,10,15}75,80,85,90= 4 comparison
5th pass- {25,10,15}70,75,80,85,90 = 3 comparison
6th pass- {10,15}25,70,75,80,85,90= 2 comparison
7th pass- {10}15,25,70,75,80,85,90 = 1 comparison  (Element list sorted)
So, we need 7 pass to sort 8 element list by bubble sort.(option 4)
FORMULA-  if the number of an element is n, then we need (n-1) passes to sort the element list. 

What is the output of the following program:
print((1, 2) + (3, 4))
  • a)
    (1, 2), (3, 4)
  • b)
    (4, 6)
  • c)
    (1, 2, 3, 4)
  • d)
    Invalid Syntax
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
The following program, print((1,2) + (3,4)) gives:
For the given program, we have two tuples, and we are printing the concatenation of these tuples.
i.e print((1, 2) + (3, 4))
A collection of Python objects separated by comma is called a Tuple.
In this, we are using the concatenation operator +, to join the two tuples.
So, (1,2,3,4) is the answer.

Which of the following error will be raised by the given Python code:
randomList = ['a', 2, 3]
for element in randomList:
        print("The element is ", element)
        x = int(element+1)
print("The incremeant of ", element, "is", x)
  • a)
    NameError
  • b)
    ValueError
  • c)
    TypeError
  • d)
    IOError
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
CONCEPT:
 Type Error occurs when the data type of objects in an operation is inappropriate.
Example dividing an integer with a string.
In the above question, a for loop is executing through the list which tries to increment the value of each element of the list by 1 and store it in variable x.
" x=int(element + 1) " but will result in type error when it tries to increment the element 'a' at index 0 of the list by 1.
This is because 'a' is of type string and we cannot add an integer to a string. 

Read the statements given below and choose the correct answer:
Statement A: It is very difficult to organize unstructured data.
Statement B: CSV helps into organize a huge amount of data in a proper and systematic way.
  • a)
    Only statement A is correct.
  • b)
    Only statement B is correct.
  • c)
    Both A and B are correct.
  • d)
    Neither A nor B is correct.
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
Unstructured data offers more flexibility and scalability. The absence of the pre-defined purpose of unstructured data makes it super flexible as the information can be stored in various file formats. Yet, this data is subjective and more difficult to work with. CSV helps into organize a huge amount of data in a proper and systematic way.

Which method is used to sets the position of a file pointer?
  • a)
    tell()
  • b)
    fseek()
  • c)
    seek()
  • d)
    ​ftell()
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
Concept:
The seek() method :
This method is used to position the file object at a particular position in a file.
The syntax of seek() is:
file_object.seek(offset [ , reference_point])
In the above syntax, offset is the number of bytes by which the file object is to be moved. reference_point indicates the starting position of the file object. That is, with reference to which position, the offset has to be counted.
  • It can have any of the following values:
    • 0 - beginning of the file
    • 1 - current position of the file
    • 2 - end of file
  • By default, the value of reference_point is 0, i.e. the offset is counted from the beginning of the file.
Hence the correct answer is seek().

Standard Ethernet cards can support data transfer between _____________________.
  • a)
    10 Mbps and 10Gbps
  • b)
    10 Mbps and 1 Gbps
  • c)
    1 Mbps and 1 Gbps
  • d)
    10 Kbps and 1 Mbps
Correct answer is option 'B'. Can you explain this answer?

Anjali Sharma answered
Concept:
10 Mbps to 1 Gbps of data transport are supported by Ethernet cards (1000 Mbps). A MAC address, which is present on every NIC, aids in uniquely identifying each computer on the network.
  • A network adapter used to set up a wired network is an Ethernet card, sometimes referred to as a Network interface card. It serves as the network's and computer's interface.
  • A computer's motherboard has a circuit board attached to it. The computer's NIC links it to the network through the ethernet wire.
  • An ethernet connection is the most often used network connection for personal computers. Actually, Ethernet is a communication protocol and hardware description standard for computer network architectures.
  • With its wide applications, there are various types of network interface cards emerging in the market like PCIe cards and server network cards.
  • A network interface card connects the clients, servers, and peripherals to the network through a port.
  • NIC allows a computer to connect to a computer network through Ethernet or WiFi. Ethernet: wired connection. WiFi: wireless connection.

Binary Search algorithm uses which of the following approach
  • a)
    Linear way to search elements 
  • b)
    Divide and Conquer way to search elements 
  • c)
    Sort and search Linearly 
  • d)
    None of the above
Correct answer is option 'B'. Can you explain this answer?

Amita Das answered
The correct option is Divide and Conquer way to search elements 
CONCEPT:
Binary search follows the divide and conquer technique.
To search for an element, first, find the middle element, if a match is found, then return the location.
Or, if the element is less than the middle element search will proceed in the left half, else the search will proceed into the right half.
Example:
List =  [7, 12, 27, 30, 43]   with index range from 0 to 4. and Key to search = 12
Thus the above searching takes 2 iterations for binary search to search key 12.

Millions of computer science students have taken a course on algorithms and data structures, typically the second course after the initial one introducing programming. One of the basic data structures in such a course is the stack. The stack has a special place in the emergence of computing as a science, as argued by Michael Mahoney, the pioneer of the history of the theory of computing. The stack can be used in many computer applications; a few are given below:
(a) In recursive function
(b) When function is called
(c) Expression conversion such as – Infix to Postfix, Infix to Prefix, Postfix to Infix, Prefix to Infix
In stack, insertion operation is known as push, whereas deletion operation is known as pop.
Code – 1
def push(Country,N):
Country._________(len(Country),N)) #Statement 1
#Function Calling
Country=[]
C=['Indian', 'USA', 'UK', 'Canada', 'Sri Lanka']
for i in range(0,len(C),________): #Statement 2
push(Country,C[i])
print(Country)
Required Output:
['Indian', 'UK', 'Sri Lanka']
Code - 2
def pop(Country):
if ______________: #Statement 3
return "Under flow"
else:
return Country.________() #Statement 4
#Function Calling
for i in range(len(Country)+1):
print(_______________) #Statement 5
Required Output:
Sri Lanka
UK
India
Under flow
Fill the statement based on the given question:
Q. Fill Statement 4, to delete an element from the stack.
  • a)
    pop(1)
  • b)
    pop()
  • c)
    del country[1]
  • d)
    Country.delete(1)
Correct answer is option 'B'. Can you explain this answer?

Amita Das answered
pop() removes the last value from the stack and returns it.

Which of the following is the correct extension of the Python file?
  • a)
    .py
  • b)
    .python
  • c)
    .p
  • d)
    None of these
Correct answer is option 'A'. Can you explain this answer?

Amita Das answered
" .py " is the correct extension of the Python file.
.PY file is a program or script written in Python, which is an interpreted object-oriented programming language. It may be written in a text editor and may be edited, but it must be run using a Python interpreter. .PY files are often used to program web servers and other administrative computer systems.

Given Tuple: tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90)
What will be the output of print (tup1 [3:7:2])?
  • a)
    (40,50,60,70,80)
  • b)
    (40,50,60,70)
  • c)
    (60,40)
  • d)
    (40,60)
Correct answer is option 'D'. Can you explain this answer?

Anjali Sharma answered
The output will be (40,60).
In tuples, indexing starts with 0. Therefore on third index, the element will be 40.
Similarly, the element on the seventh index will be 80, but it will not be included as the end value is not included in slicing.
2 represents the iteration gap or steps. Therefore, only 2nd place numbers from start will be printed between the range 40 and 70, i.e. 40 and 60.

Syntax of the seek function in python is myfile.seek(offset, reference_point) where myfile is the file object. What is the default value of reference_point?
  • a)
    0
  • b)
    1
  • c)
    2
  • d)
    3
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
Python file method seek() sets the file's current position at the offset. The whence argument is optional and defaults to 0, which means absolute file positioning; other values are 1, which means seek relative to the current position, and 2, which means seek relative to the file's end. There is no return value.

Consider a declaration, L = (1, 'Python', '3.14').
Which of the following represents the data type of L?
  • a)
    List
  • b)
    Tuple
  • c)
    Dictionary
  • d)
    String
Correct answer is option 'B'. Can you explain this answer?

Anjali Sharma answered
A tuple is almost like a List and contains python objects and objects inside are separated by comma (,) and enclosed within parentheses.
Example:
list1 = (6.25, 'brinjal', 'onion', 'beans')
list1 is a tuple.

Consider a tuple tup1 = (10, 15, 25 and 30). Identify the statement that will result in an error.
  • a)
    print(tup1[2])
  • b)
    tup1[2] = 20
  • c)
    print(min(tup1))
  • d)
    print(len(tup1))
Correct answer is option 'B'. Can you explain this answer?

Anjali Sharma answered
'tup1[2]=20' will make an error.
Here, the first option 'print(tup1[2])' will display the value at the position.
Therefore, print(tup1[2])=25. The starting position is 0.
print(min(tup1)) will display the minimum value in that tuple.
Here, print(min(tup1))=10
print(len(tup1)) will give output as the tuple length.
print(len(tup1)) = 4
But, tup1[2]=20 means assigning a new value to the position.
In tuples, values are constant.
So, tup1[2]=20 will result in an error.

Which is the correct postfix expression for this P+Q*R/S-T+P infix expression?
  • a)
    PQR*S+/TP+-
  • b)
    PQR*+S/TP+-
  • c)
    PQR*S/+TP+-
  • d)
    PQR*S/+TP-+
Correct answer is option 'C'. Can you explain this answer?

Amita Das answered
Converting of infix to postfix is a direct application of stack. 
infix- a+b ( operator within operand ) 
postfix - ab+ ( operator after operand ) 
Few rules to follow while converting Infix to postfix - 
  • We use an operator stack to convert infix to postfix . 
  • Always high priority operator should be on the top of the stack ( for priority refer to the operator precedence table ) 
  • if two operator having the same priority the operator came first will go out first . 
  • if anytime during the process , a high priority operator will be their on the top, at that time if low priority operator will come , then we have to first pop the high priority operator . 
  • Brackets are special person here , so, in case any open bracket comes to top of stack , will have to pop all operator below it . 
Now , in this expression P+Q*R/S-T+P
Step 1 - print P , push + onto the stack . output - P  , Stack content = + 
Step 2 - print q , push * onto the stack , output =PQ    Stack content = +,*(top) 
Step 3 - print R, while pushing / onto stack , pop * as they have same priority , output - PQR*  , stack content = +,/(top) 
Step 4 - print S , while pushing - pop / first as / have high priority than - , then pop + also because + and - have same priority , output - PQR*S/+ ,stack content =  -  (top) 
Step 5 - Print T , push + onto the stack , and print P . output - PQR*S/+TP  Stack content =   -,+ (top)
Step 6 - now , as + is on the top of stack print that followed by - to empty the stack . 
FINAL POSTFIX EXPRESSION - PQR*S/+TP+- (option 3 will be the answer ) 

A ___________ is a request to a database to obtain information in the desired way.
  • a)
    Command
  • b)
    Trigger
  • c)
    Query
  • d)
    Statement
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
Concept:
A query is a request to a database to obtain information in the desired way. The query can be made to get data from one table or from a combination of tables. For example, " finds names of all those students present on attendance date 20001-01-02" is a query to the database.
  • The SQL statement SELECT is used to retrieve data from the tables in a database and is also called a query statement.
  • This data may be generated as results returned by Structured Query Language (SQL) or as pictorials, graphs or complex results, and trend analyses from data-mining tools.
  • One of several different query languages may be used to perform a range of simple to complex database queries.
  • The query database feature is equal to the necessity of data storage capability.

Which of the following is true about a Modem?
  • a)
    Modem is a device that modulates/demodulates carrier waves with digital information to transmit the data
  • b)
    Modems are measured in terms of speed by the amount of data they can send in a given unit time eg. bits per second.
  • c)
    A modem shares the internet connection with multiple devices by dispatching packets of information
  • d)
    The modem communicates with the Internet Service Provider
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
The correct answer is Modem is a device that modulates/demodulates carrier waves with digital information to transmit the data.
  • A modem or broadband modem is a hardware device that connects a computer or router to a broadband network.
  • Some examples of modems are - cable modems and DSL modems.
  • A modem is a short form for modulator/demodulator.

Python is a/an ______based language.
  • a)
    Compiler
  • b)
    Interpreter
  • c)
    Both 1 and 2
  • d)
    Neither 1 nor 2
Correct answer is option 'B'. Can you explain this answer?

Isha Kaur answered
Python is an Interpreter-based language



  • Explanation:



Python is an interpreted programming language, which means that it executes the code line by line, without the need for a compilation step. The source code is directly executed by an interpreter, which reads and executes each instruction one by one.


Let's further understand the concept of interpreted languages and how they differ from compiled languages:


Compiled Languages



  • Definition:



A compiled language is a programming language where the source code needs to be transformed into machine code (binary code) before it can be executed. This transformation is done by a compiler, which converts the entire source code into an executable file.



  • Process:



In a compiled language, the source code is first written by the programmer. Then, the compiler analyzes the entire code and translates it into machine code, specific to the target platform or architecture. This machine code can be directly executed by the operating system without any further translation or interpretation.


Examples of compiled languages include C, C++, Java, and Go.


Interpreted Languages



  • Definition:



An interpreted language is a programming language where the source code is directly executed line by line, without the need for a compilation step. The interpreter reads each instruction, interprets it, and executes it immediately.



  • Process:



In an interpreted language, the interpreter translates and executes the code line by line, without transforming the entire source code into machine code beforehand. This allows for a more interactive and dynamic development process, as changes in the code can be immediately reflected during execution.


Python falls into the category of interpreted languages, where the interpreter reads and executes the code directly. This makes Python a highly flexible and accessible language for beginners and experienced developers alike.


Therefore, the correct answer to the given question is option B: Interpreter.

Consider the following relation.
Table: Customers(C_id, C_name, C_age, C_Country)
What is the output for the given SQL Query?
Query:
ALTER TABLE Customers
ADD income INT;
What is the degree of the customer relationship?
  • a)
    4
  • b)
    5
  • c)
    6
  • d)
    error
Correct answer is option 'B'. Can you explain this answer?

Amita Das answered
The correct answer is option B.
Concept:
Add an attribute to an existing table:

Sometimes, we may need to add an additional attribute to a table. It can be done using the syntax given below:
Syntax:
ALTER TABLE table_name ADD attribute_name DATATYPE;
DEGREE:
The number of attributes in a relation is called the Degree of the relation.
Explanation:
The customer relation adds a new attribute to the customer relationship. Now the Customers relation becomes the Customers(C_id, C_name, C_age, C_Country, income)
Query:
ALTER TABLE Customers
ADD income INT;
Hence the degree of the relation becomes 5.
Hence the correct answer is 5.

Statement I: MAC address of a device can change.
Statement II: IP address of a device cannot change.
  • a)
    Both I and II are correct
  • b)
    I is correct, II is incorrect
  • c)
    II is correct, I is incorrect
  • d)
    Both I and II are incorrect
Correct answer is option 'D'. Can you explain this answer?

Anjali Sharma answered
  • The MAC address is printed on the Ethernet card at the time of manufacturing. When the Ethernet card is placed on a device, the address on the card becomes the MAC address of the device. Thus, the MAC address of a device cannot change.
  • The IP address is assigned to a device when it is connected to a network. When the device is connected to a different network, the IP address automatically changes. Thus, the IP address of a device can change.

How many iterations are done until the key element 5 is found in the given list = [5, 64, 77, 82, 90]  using binary search?
  • a)
    3
  • b)
    2
  • c)
    1
  • d)
    4
Correct answer is option 'A'. Can you explain this answer?

Amita Das answered
The correct option is 3
CONCEPT:
In binary search, the key to be searched is compared with the middle element of a sorted list by repeatedly dividing the search interval in half, 
If the element at the middle position matches the key then the search is successful.  
If the element at the middle position is found to be smaller than the key, then the key element may be present in the right part of the list. Thus first=mid +1,
Else the key element may be present in the left part of the list. Thus last=mid -1, for searching the left half part only.
In the above question,
List =  [5, 64, 77, 82, 90]   with index range from 0 to 4.
Thus the above searching takes 3 iterations for binary search to search key 5.
In binary search, we start by comparing the key element with the middle element of the list. If the middle element is equal to the key element, we have found the element, and the search ends. If the middle element is greater than the key element, we search the left half of the list. If the middle element is less than the key element, we search the right half of the list.
  • Here's how the binary search proceeds in this case:
  • Initial list: [5, 64, 77, 82, 90]
  • Middle element: 77
  • 77 is greater than 5, so we search the left half of the list
  • New list: [5, 64, 77]
  • Middle element: 64
  • 64 is less than 5, so we search the right half of the list
  • New list: [77]
  • Middle element: 77
  • 77 is equal to 5, so we have found the element
  • Therefore, the key element 5 is found after 3 iterations of binary search.

The relational model uses some unfamiliar terminology. A tuple is equivalent to _________.
  • a)
    record
  • b)
    field
  • c)
    file
  • d)
    database
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
You can treat a tuple as a kind of record, where the index of an element in a tuple is its name within the equivalent record, so (10, 25) is {0 : 10, 1 : 25}. I believe 'Standard ML' and related languages use records as the basic unit of type conjunction (algebraic data types provide type dis-junction) and treat tuples as a kind of record in this way.

In searching, the hash function takes an element from a list and divides it by the size of the hash. This method is known as the  __________  method.
  • a)
    Hash
  • b)
    Divisior
  • c)
    Dividend
  • d)
    Remainder
Correct answer is option 'D'. Can you explain this answer?

Anjali Sharma answered
Hashing is a searching technique in which we use a hash table and a hash function in the format of h(k) = k mod m, where m is the size or the slot available in the hash table, and k is given the key.
That's the process in which the position of a key is determined in the hash table.
For example - we have a 12-slotted hash table and we want to locate the position of 100 in that table, then 
h(k) = 100 mod 12 = 4 (12*8 will be 96 , and 4 as remainder ) 
A simple rule for calculating mod function - 
1- if we have m mod n and m>n, then the mod will return only the remainder. 
2- and if m=n then it will result in 0. 
3- if m<n then it will return m as the answer. 

Which of the following statement can be used to display all built in exceptions?
  • a)
    print(dir(locals()['__builtins__']))
  • b)
    print(dir(locals()['__annotations__']))
  • c)
    print(dir(locals()['__spec__']))
  • d)
    print(dir(locals()['__doc__']))
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
CONCEPT:
In Python, there are several built-in exceptions that are raised when errors occur.
To view these built-in exceptions local() function is used which returns a dictionary of the current local symbol table.
dir() is a function that returns a list of the attributes and methods of the object passed to it.
>>> print(dir(locals()['__builtins__']))

Where are stack and stack pointers located?
  • a)
    Both reside in memory. 
  • b)
    Both reside in CPU.
  • c)
    Former resides in CPU and the latter in memory.
  • d)
    Former resides in memory and the latter in CPU.
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
A stack pointer is a small register that stores the address of the last program request in a stack. A stack is a specialized buffer which stores data from the top down. Both stack and stack pointers reside in the memory.

Which statement, if any, will return an error in the following code snippet?
import pickle #statement 1
f=open("data.dat",'rb')  #statement 2
d=pickles.load(f) #statement 3
f.close() #statement 4
  • a)
    No error
  • b)
    Statement 2
  • c)
    Statement 3
  • d)
    Statement 4
Correct answer is option 'C'. Can you explain this answer?

Anjali Sharma answered
  • The first statement imports the Pickle package of Python. This package is used to save an object structure along with the current data. This package is useful for retrieving a previous data state at any time. The statement does not contain any error.
  • The second statement opens a binary file, data.dat in the “read in binary” mode using the open() function. The file handle is stored in the variable f. The open() function takes the file name and the mode of operation as parameters. Thus, this statement is correct.
  • The load() function of the Pickle module is used to unpickling data from a binary file. The returned data then needs to be stored in a variable. In statement 3, the load() function is invoked using ‘pickles’, but the module which contains this function is called pickle. So, this statement is incorrect.
  • A file must be closed after working on it. The close() function is used with the file handler variable for this.

Which operation is  used to view elements at the front of the queue, without removing it from the queue?
  • a)
    PEEK
  • b)
    IS FULL 
  • c)
    SEEK
  • d)
    IS EMPTY
Correct answer is option 'A'. Can you explain this answer?

Anjali Sharma answered
Queue is a data structure which uses FIFO mode of operation ( first in first out), means the element inserted first should be removed first from the queue.
peek() method of the queue returns the front or first element of the queue.but it does not delete that element , it just return that element. 
why option 2 got eliminated - 
IS FULL() method is used to check the queue is full or not at certain point of time, We generally check this if we want to insert a element in the queue.else it will throw "queue out of memory " error.
Why option 3 got eliminated - 
seek() is used to change the option of file handle in python , to move a file to some specific place , we use seek function. it is not related with queue. 
Why option 4 got eliminated -
IS EMPTY() method is used to check queue is empty or not at certain point of time. we generally use this if we want to delete a element from queue.Else it will give " no element in queue " error . 

Which of the following is not a built-in exceptions in Python?
  • a)
    ZeroDivisionError
  • b)
    OverFlowError
  • c)
    KeyboardInterrupt
  • d)
    None of the above
Correct answer is option 'D'. Can you explain this answer?

Anjali Sharma answered
Concept:
Built-in exceptions are the exceptions that are available in Python libraries. These exceptions are suitable to explain certain error situations. Some of the commonly occurring built-in exceptions are SyntaxError, ValueError, IOError, KeyboardInterrupt, ImportError, EOFError, ZeroDivisionError, IndexError, NameError, IndentationError, TypeError,and OverFlowerror.
ZeroDivisionError:
It is raised when the denominator in a division operation is zero.
OverFlowError:
It is raised when the result of a calculation exceeds the maximum limit for the numeric data type.
KeyboardInterrupt:
It is raised when the user accidentally hits the Delete or Esc key while executing a program due to which the normal flow of the program is interrupted.
SyntaxError:
It is raised when there is an error in the syntax of the Python code.
ValueError:
It is raised when a built-in method or operation receives an argument that has the right data type but mismatched or inappropriate values.
IOError:
It is raised when the file specified in a program statement cannot be opened.
ImportError:
It is raised when the requested module definition is not found.
EOFError:
It is raised when the end of the file condition is reached without reading any data by input().
Hence the correct answer is None of the above.

Consider the following example.
Example:
A University name BITS has maintained the two relations to store the information about the faculty table and Teaches table. The faculty table stores the faculty_id (faculty_id has the unique id of faculty in the whole university) and faculty_name. The Teaches table stores the Course_id, Course_Name, and faculty_id. So the university admin department prints the faculty_name and Course_Name.
How many primary keys are there at the BITS University?
  • a)
    0
  • b)
    1
  • c)
    2
  • d)
    3
Correct answer is option 'C'. Can you explain this answer?

Amita Das answered
Concept:
Attribute:
  • An attribute is a characteristic. In a database management system (DBMS), an attribute refers to a database component, such as a table.
  • It also may refer to a database field. Attributes describe the instances in the column of a database.
Candidate Key:
 A relation can have one or more attributes that take distinct values. Any of these attributes can be used to uniquely identify the tuples in the relation. Such attributes are called candidate keys as each of them are candidates for the primary key.
Primary Key:
Out of one or more candidate keys, the attribute chosen by the database designer to uniquely identify the tuples in a relation is called the primary key of that relation.
Explanation:
From the given data we had two tables which are faculty and Teach.
faculty (faculty_id, faculty_name )
Here faculty_id and faculty_name are attributes.
Here faculty_id is the unique id of faculty in the whole university So it is the primary key in the faculty table.
Example:
Teaches (Course_id, Course_Name, faculty_id )
  • Course_id, Course_Name, and faculty_id are attributes.
  • Here Course_id is the unique id of the course in the whole university So it is the primary key in the teaches table.
  • Here faculty_id is not unique so not be the primary key, candidate key, and super key because a faculty member may teach more than one subject.
Unique attributes are maintaining the BITS University has  faculty_id, faculty_name, Course_id, and Course_Name. Hence it has four unique attributes. 
Example:
Hence there are two primary keys which are faculty_id and Course_id.
Hence the correct answer is B.

Consider an array [1, 3, 2, 4]. How many iterations are needed to sort this array in the selection sort method?
  • a)
    2
  • b)
    4
  • c)
    1
  • d)
    3
Correct answer is option 'D'. Can you explain this answer?

Amita Das answered
  • The selection sort algorithm selects the smallest value at each iteration and places it in its correct position.
  • Since there are 4 elements in the given array, the algorithm works 3 times in order to sort the array in ascending order.
  • Even though the array is sorted in the 2nd pass, the selection sort runs three times.

Chapter doubts & questions for Computer Science - CUET UG Mock Test Series 2025 2025 is part of CUET exam preparation. The chapters have been prepared according to the CUET exam syllabus. The Chapter doubts & questions, notes, tests & MCQs are made for CUET 2025 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests here.

Chapter doubts & questions of Computer Science - CUET UG Mock Test Series 2025 in English & Hindi are available as part of CUET exam. Download more important topics, notes, lectures and mock test series for CUET Exam by signing up for free.

Signup to see your scores go up within 7 days!

Study with 1000+ FREE Docs, Videos & Tests
10M+ students study on EduRev