CUET Exam  >  CUET Tests  >  CUET UG Mock Test Series 2026  >  Computer Science: CUET Mock Test - 4 - CUET MCQ

Computer Science: CUET Mock Test - 4 - CUET MCQ


Test Description

30 Questions MCQ Test CUET UG Mock Test Series 2026 - Computer Science: CUET Mock Test - 4

Computer Science: CUET Mock Test - 4 for CUET 2025 is part of CUET UG Mock Test Series 2026 preparation. The Computer Science: CUET Mock Test - 4 questions and answers have been prepared according to the CUET exam syllabus.The Computer Science: CUET Mock Test - 4 MCQs are made for CUET 2025 Exam. Find important definitions, questions, notes, meanings, examples, exercises, MCQs and online tests for Computer Science: CUET Mock Test - 4 below.
Solutions of Computer Science: CUET Mock Test - 4 questions in English are available as part of our CUET UG Mock Test Series 2026 for CUET & Computer Science: CUET Mock Test - 4 solutions in Hindi for CUET UG Mock Test Series 2026 course. Download more important topics, notes, lectures and mock test series for CUET Exam by signing up for free. Attempt Computer Science: CUET Mock Test - 4 | 50 questions in 60 minutes | Mock test for CUET preparation | Free important questions MCQ to study CUET UG Mock Test Series 2026 for CUET Exam | Download free PDF with solutions
Computer Science: CUET Mock Test - 4 - Question 1

Which of the following words cannot be a variable in python language?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 1

A Python variable is a reserved memory location to store values. In other words, a variable in a python program gives data to the computer for processing. Variables cannot, however, be named the same as keywords (as in case with "try" which is a python variable). Variables cannot contain any special character except "_". They cannot start with numbers and can only contain alphabets, numbers, and underscore (_)

Computer Science: CUET Mock Test - 4 - Question 2

Identify the SQL query which displays the data of table Stulibrary in ascending order of student ID.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 2

The correct answer is Select * from Stulibrary order by StulD Asc;

Key PointsAn educational institute in Delhi uses a DBMS to store student details. The database named 'school-record' has two tables:

  • Student: Stores general student information
  • Stulibrary: Tracks issued books

SELECT * FROM Stulibrary ORDER BY StuID ASC;
Explanation:

  • SELECT *: This clause retrieves all columns (*) from the Stulibrary table.
  • FROM Stulibrary: This clause specifies the table from which data will be retrieved (Stulibrary).
  • ORDER BY StuID: This clause sorts the results based on the StuID column.
  • ASC: This keyword specifies ascending order for sorting (StuID values from lowest to highest).
Computer Science: CUET Mock Test - 4 - Question 3

The primary key of Stulibrary table is / are:

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 3

The primary key of the Stulibrary table should be BookID, StuID.

  • A primary key must uniquely identify each record in the table.
  • BookID alone is not sufficient because the same book can be issued multiple times (to different students or the same student at different times).
  • StuID alone is not sufficient because a student can borrow multiple books.
  • The combination of BookID and StuID ensures that each record represents a unique issuance of a book to a student. If the same book is issued to the same student again, the Issued_date would differentiate the records, but typically, a library system would not allow the same book to be issued to the same student until it is returned, making BookID, StuID a practical primary key.
Computer Science: CUET Mock Test - 4 - Question 4

Which of the following SQL query will fetch ID of those issued books which have not been returned?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 4

The correct answer is Select BookID from Stulibrary where Return_date is NULL;

Key PointsThis query fetches the BookID of books from the Stulibrary table where the Return_date is NULL, indicating that the books have been issued but have not yet been returned.

  • SELECT BookID: This retrieves only the `BookID` column, focusing on book identification.
  • FROM Stulibrary: This specifies the `Stulibrary` table as the source of data.
  • WHERE Return_date is NULL: This crucial part filters the results. A `NULL` value in the `Return_date` column indicates that the book has not been returned yet.
Computer Science: CUET Mock Test - 4 - Question 5

The alternate key for Student table will be ________.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 5

The correct answer is StuAadhar

Key PointsAn alternate key in database terminology is a candidate key that is not chosen as the primary key but is still unique and can identify each record in a table. For the Student table, the ideal alternate key would be an attribute that uniquely identifies each student, aside from the primary key (which we may assume to be something like StuID if following common conventions).

  • StuName is generally not unique because different students can share the same name.
  • StuContact could be unique, as typically each student would have a unique contact number. However, this depends on the policy of the organization (e.g., whether parents' contact numbers are used for younger students).
  • StuAadhar is a highly likely candidate for uniqueness. The Aadhar number is a unique identifier issued by the UIDAI to residents of India, and it is meant to be a unique identifier for each individual.
  • StuClass would not be unique as many students belong to the same class.

Given these options, the most definitive and universally unique across all possible scenarios would be: StuAadhar
This assumes that StuAadhar refers to the Aadhar number, which is unique to every individual in India. As such, it would serve as an excellent alternate key, assuming that uniqueness and the ability to identify each record in the table are the primary criteria.

Computer Science: CUET Mock Test - 4 - Question 6

Which of the following SQL queries will display dates on which number of issued books is greater than 5?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 6

The correct answer is Select Issued_date from Stulibrary group by Issued date having count(*) > 5;

Key PointsIn SQL, when you want to filter groups of data resulting from a GROUP BY clause, you should use the HAVING clause instead of the WHERE clause. The WHERE clause is used to filter rows before they are grouped, while the HAVING clause filters groups after they have been created by GROUP BY.

Given the description of the queries and the requirement to display dates on which the number of issued books is greater than 5:

  • Option 1) is incorrect because it uses where count(*) > 5 after the GROUP BY clause, which is a syntax error. The correct keyword for setting conditions on groups is HAVING.
  • Option 2) is incorrect because it groups by Return date instead of Issued_date. We are interested in counts of books issued on particular dates, not their return dates.
  • Option 3) is correct. This query correctly uses GROUP BY Issued_date followed by HAVING count(*) > 5. It correctly aggregates the data by the issuance date and then filters to find only those dates where more than 5 books were issued.
  • Option 4) has the same issue as Option 1 with an added mistake: it uses where instead of HAVING for filtering aggregated results and incorrectly groups by Return date.

So, the correct option is: Select Issued_date from Stulibrary group by Issued_date having count(*) > 5;
This SQL query groups the records by Issued_date and filters for those dates where the total count of issued books is greater than 5.

Computer Science: CUET Mock Test - 4 - Question 7

Srishti writes a program to find an element in the array A[5] with the following elements in order: 8 30 40 45 70. She runs the program to find a number X. X is found in the first iteration of binary search. What is the value of X?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 7

Key Points

​Binary search: ​ Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise, narrow it to the upper half. Repeatedly check until the value is found or the interval is empty.

Binary search is a fast search algorithm with run-time complexity of Ο(log n). This search algorithm works on the principle of divide and conquer. A binary search looks for a particular item by comparing the middlemost item of the collection. If a match occurs, then the index of the item is returned.

Algorithm;
int binarySearch(int arr[ ], int l, int r, int x)
{ if (r >= l) {

if (arr[mid] == x)
return mid;

if (arr[mid] > x)
return binarySearch(arr, l, mid - 1, x);

return binarySearch(arr, mid + 1, r, x);
}
return -1;
}

So as per the question, She X is found in the first iteration of the binary search.

Here l=0, r=4

mid= (4 + 0) / 2

mid= 4/2

mid= 2

By default, the array index starts from 0. So the 1st element of an array is at 0th index.

In the first iteration, it found means, so the element is found at index 2.

a[2]=40

Hence the correct answer is 40.

Computer Science: CUET Mock Test - 4 - Question 8
MODEM word is made from:
Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 8

The correct answer is Modulation, Demodulation

Key Points

  • MODEM:
    • It stands for Modulation, Demodulation
    • The modem is an electronic device that is used by a computer for sending and receiving information over telephone lines.
      • Computer information is stored digitally, whereas information transmitted over telephone lines is transmitted in the form of Analog waves.
      • A modem converts Analog to Digital and vice versa.
      • It allows a computer, router, or switch to connect to access, connect internet.
      • It takes the Analog signal from a telephone line are cable wire and converts it in the form of the digital form (0s and 1s) and vice-versa.
      • A modulator is a circuit that combines two different signals in such a way.
      • A demodulator is an electronic circuit that is used to recover the information content from the modulated carrier wave.
      • In electronics, the multiplexer selects one of several Analog or Digital input signals and further devices the line of the selected input.
Computer Science: CUET Mock Test - 4 - Question 9

Which statement about IPv6 addresses is true?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 9

The correct option is 1

Concept:-

An IPv6 address is 128 bits long and is divided into eight 16-bit fields, each separated by a colon. In contrast to IPv6 addresses, which use dotted-decimal notation, each field must include a hexadecimal number.Key Points

  • The basic IPv6 header and the IPv6 extension headers are two types of headers defined by the IPv6 protocol.
  • Separate extension headers are added between the IPv6 header and the transport-layer header in a packet to store IPv6 options.
  • Until a packet reaches its final destination, most IPv6 extension headers are not reviewed or processed by any router along its delivery path.
  • IPv6 extension headers, unlike IPv4 options, can be any length. Furthermore, a packet carrier's options are not restricted to 40 bytes.

The figure, IPv6 Basic Header Format:-

Computer Science: CUET Mock Test - 4 - Question 10

Consider the following statements regarding statistical data analysis:

Statement I: In a skewed distribution, the median is always found between the mean and the mode.

Statement II: The range of a dataset is defined as the difference between its maximum and minimum values.

Choose the correct answer from the options given below based on the truthfulness of the above statements:

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 10

The correct answer is Statement I is false but Statement II is true

Key Points

  • Statement I: "In a skewed distribution, the median is always found between the mean and the mode." This is incorrect. In a positively skewed distribution (right skew), the order is typically mode < median < mean, and in a negatively skewed distribution (left skew), it’s mean < median < mode. The median is not always between the mean and mode; rather, the mean is pulled toward the tail of the skew.
  • Statement II: "The range of a dataset is defined as the difference between its maximum and minimum values." This is correct.
    The conclusion (Statement I is false, Statement II is true) is correct, but the explanation for Statement I could be more precise.
Computer Science: CUET Mock Test - 4 - Question 11

Two statements are given below:

Statement I: A ring topology is a type of network topology in which all devices are connected to a single cable.
Statement II: A bus topology is a type of network topology in which all devices are connected to a central hub or switch.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 11

A bus topology is a type of network topology in which all devices are connected to a single cable called a bus, not in ring topology. A star topology is a type of network topology in which all devices are connected to a central hub or switch not in a bus topology. Both are not correct.

Computer Science: CUET Mock Test - 4 - Question 12

What is the purpose of the rewind() function?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 12

The rewind() function sets the file position to the beginning of the file for the stream pointed to by stream. It also clears the error and end-of-file indicators for stream.

Computer Science: CUET Mock Test - 4 - Question 13

Directions: Match the contents under List I with those under List II.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 13
  • Client-server architecture is an architecture in which devices are connected to a central server, which provides services to clients. Clients request services from the server, which then provides a response.
  • Peer-to-peer architecture is an architecture in which devices communicate directly with each other without a central server. Each device can act as both a client and a server.
  • Service-oriented architecture (SOA) is an architecture in which services are exposed as independent components that can be accessed over a network. Services can be combined to create more complex applications.
  • Cloud architecture is an architecture in which resources are provisioned dynamically and accessed over a network. It allows users to access resources such as storage and computing power on-demand.
Computer Science: CUET Mock Test - 4 - Question 14

What will the following statement do?

FILE *fp1;
char Tch;
fp1=fopen("TCY.c","r");
while((Tch=getc(fp1)) != EOF)
printf("%c",Tch);

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 14

In this program, getc() function within the while loop will read the characters from TCY.c one by one and display on the screen through the variable Tch.

Computer Science: CUET Mock Test - 4 - Question 15

This method returns an integer that specifies the current position of the file object.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 15

The tell() method can be used to get the position of File Handle. It returns the current position of the file object. This method takes no parameters and returns an integer value.

Computer Science: CUET Mock Test - 4 - Question 16

What is the output of the following program:
print((1, 2) + (3, 4))

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 16

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.

Computer Science: CUET Mock Test - 4 - Question 17

Which of the following is an application of stack?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 17

Following is the various Applications of Stack in Data Structure:

  • Evaluation of Arithmetic Expressions
  • Backtracking
  • Delimiter Checking
  • Reverse a Data
  • Processing Function Calls
Computer Science: CUET Mock Test - 4 - Question 18

____ command helps to add new data to the database.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 18

Insert is a widely-used command in the Structured Query Language (SQL) data manipulation language (DML) used by SQL Server and Oracle relational databases. The insert command is used for inserting one or more rows into a database table with specified table column values.

Computer Science: CUET Mock Test - 4 - Question 19

Which of the following best describes a white hat hacker?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 19

White hat hackers are security professionals who follow ethical and legal behavior. Their objective is to help improve security.

Computer Science: CUET Mock Test - 4 - Question 20

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. Identify the suitable code for the blank of Statement 1.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 20
  • Statement 1: Country.insert(len(Country), N)
    • The insert() method takes two arguments: an index and a value. Here, len(Country) is the index (which is the end of the list), and N is the value to insert. This effectively adds N to the end of the list, similar to append(), but matches the given syntax.
    • In this context, Country.insert(len(Country), N) achieves the same result as Country.append(N), but the question’s syntax requires insert().
  • The required output ['Indian', 'UK', 'Sri Lanka'] is achieved by the loop in Statement 2, which we can infer as for i in range(0, len(C), 2) to select every other element from C.
Computer Science: CUET Mock Test - 4 - Question 21

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 3, to check if the stack is empty.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 21

The len function returns the length of the stack, i.e. number of items in stack. The value 0 itself means that the stack is empty.

Computer Science: CUET Mock Test - 4 - Question 22

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 5, to call the pop function.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 22

This will call the function pop() by passing the stack 'Country' as an argument. The function pop is already defined in the given code as: def pop (Country):.

Computer Science: CUET Mock Test - 4 - Question 23

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 2, to insert the alternate element from Country list.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 23

The '2' in the given 'for' statement is the step value which specifies the difference between two consecutive values in the range. Here, the step value is used to refer to the index position of the items in stack. To insert the alternate element, the step value will be taken as 2.

Computer Science: CUET Mock Test - 4 - Question 24

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.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 24

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

Computer Science: CUET Mock Test - 4 - Question 25

Which of the following File open modes is used for opens the file in read,write and binary mode?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 25

The correct answer is option C.
Concept:
To open a file in Python:

we use the open() function. The syntax of open() is as follows:
file_object= open(file_name, access_mode)
The access_mode is an optional argument that represents the mode in which the file has to be accessed by the program. It is also referred to as processing mode.
Different File open modes:

  • <wb+> or <+wb> Opens the file in read, write, and binary mode. If the file already exists, the contents will be overwritten. If the file doesn’t exist, then a new file will be created.
  • <r> Opens the file in read-only mode.
  • <rb> Opens the file in binary and read-only mode.
  • <w> Opens the file in write mode. If the file already exists, all the contents will be overwritten. If the file doesn’t exist, then a new file will be created.
  • <a> Opens the file in append mode. If the file doesn’t exist, then a new file will be created.​

Hence the correct answer is<wb+> or <+wb>.

Computer Science: CUET Mock Test - 4 - Question 26

How many swaps are required to sort the list L2 using selection sort?

L2: [54, 23, 12, 44, 18, 22, 14]

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 26

Selection sort works in the algorithm like we have to pick the smallest element from the unsorted array/list and move that to the beginning of the list. This process can be described  as 1 Swap.
Applying Selection sort on the given list - 
Pass 1 = {12}   {23,54,44,18,22,14}  - 1 swap 
Pass 2 = {12,14}  {54,44,18,22,23}  - 2nd swap
Pass 3 = {12,14,18}   {44,54,22,23} - 3rd  swap
Pass 4 = {12,14,18,22}  {44,54,23} - 4th  swap 
Pass 5 = {12,14,18,22,23}   {44,54}  - 5th swap 
Pass 6 = {12,14,18,22,23,44}  {54}  - 6th swap 
For the last element we do not need any swap, So, in total 5 swaps required to sort the list.

Computer Science: CUET Mock Test - 4 - Question 27

In python, to support enqueue and dequeue operations which operations are used?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 27

Queue is a data structure which follows FIFO pattern ( first in first out) means the element which inserted first should come out first. 
In queue , enqueue means inserting an element and dequeue means deleting an element from the queue. 
Remember , delete should happen from the front and insert should happen from back ( rear ) side.
So, To implement the enqueue operation , we need to first check the queue is full or not, for that we use isfull() function , which returns a binary value - either true or false .
To implement dequeue operation we need to first check if element present in the queue or not, for that we need isempty() function , if the function returns false that means queue have at least 1 element and we can delete that. 
peek() function used to return the front element of the queue , as deletion happens from the front , so, we need peek operation to find out the front element.
So, option 3 will be the correct answer .
Why option 1 and 2 got eliminated - 
we need 3 operation ( isempty,isfull,peek ) combine for the operation , and the options does not satisfy that . 
why option 4 got eliminated - 
insertrear() function used to insert an element in the rear position , but here , in this question , we do not require that. 

Computer Science: CUET Mock Test - 4 - Question 28

Which of the following statement are true?

Statement 1: dump() method is used to write the objects in a binary file. 
Statement 2: load() method is used to read data from a binary file.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 28

The correct answer is option C.
Concept:
Statement 1: dump() method is used to write the objects in a binary file. 
True, the dump() method is used to convert (pickling) Python objects for writing data in a binary file. The file in which data are to be dumped needs to be opened in binary write mode (wb).
Syntax of dump() is as follows:
dump(data_object, file_object)
Statement 2: load() method is used to read data from a binary file.
True, The load() method is used to load (unpickling) data from a binary file. The file to be loaded is opened in binary read (rb) mode. Syntax of load() is as follows:
Store_object = load(file_object)
Hence the correct answer is Both statement 1 and statement 2 are true.

Computer Science: CUET Mock Test - 4 - Question 29

Which method is called before calling POP() method in the program.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 29

The POP() method is generally called when we want to remove an element from the queue, So, before that, we have to check whether the queue has an element or not. else, we cannot remove an element from an empty queue.
So, to check queue contains an element or not, we use Isempty() function, if it returns true that means the queue is empty and we cannot apply pop(). 
if it returns false that means the queue has some element and we can use the pop() function. Remember empty() always returns binary value - "either true or false"
Why option 1 got eliminated - 
Len() used to check the length of a list in python, we cannot apply it in the queue. 
Why option 2 got eliminated - 
is full() is used to check queue is full or not. This is the reverse case of the question asked. it is used when we want to insert an element
why option 3 got eliminated - 
the str() function is used to convert any data type to a string data type in python. it has no relation to queue deletion. 

Computer Science: CUET Mock Test - 4 - Question 30

What is the output for the given python program?

try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    
try:
    sum=5/0;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 30

The correct answer is option A.
 

Concept:
The given python code is,
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    
try:
    sum=5/0;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  

Explanation:
ZeroDivisionError:
It is raised when the denominator in a division operation is zero.
try:
    sum=5/2;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")    

The above executes and it can not raise the exception and prints the Hello world as output.

try:
    sum=5/0;
except ZeroDivisionError:    
    print("Hello India")    
else:    
    print("Hello world")  
The above executes and it can raise the exception and print the Hello India as output.
Hence the correct answer is  
Hello world

Hello India

View more questions
39 docs|145 tests
Information about Computer Science: CUET Mock Test - 4 Page
In this test you can find the Exam questions for Computer Science: CUET Mock Test - 4 solved & explained in the simplest way possible. Besides giving Questions and answers for Computer Science: CUET Mock Test - 4, EduRev gives you an ample number of Online tests for practice
Download as PDF