CUET Exam  >  CUET Tests  >  CUET Mock Test Series  >  Computer Science: CUET Mock Test - 2 - CUET MCQ

Computer Science: CUET Mock Test - 2 - CUET MCQ


Test Description

30 Questions MCQ Test CUET Mock Test Series - Computer Science: CUET Mock Test - 2

Computer Science: CUET Mock Test - 2 for CUET 2025 is part of CUET Mock Test Series preparation. The Computer Science: CUET Mock Test - 2 questions and answers have been prepared according to the CUET exam syllabus.The Computer Science: CUET Mock Test - 2 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 - 2 below.
Solutions of Computer Science: CUET Mock Test - 2 questions in English are available as part of our CUET Mock Test Series for CUET & Computer Science: CUET Mock Test - 2 solutions in Hindi for CUET Mock Test Series 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 - 2 | 50 questions in 45 minutes | Mock test for CUET preparation | Free important questions MCQ to study CUET Mock Test Series for CUET Exam | Download free PDF with solutions
Computer Science: CUET Mock Test - 2 - Question 1

Two statements are given below:
Statement I: A primary key in DBMS is a field that uniquely identifies each record in a table and can be Null.
Statement II: A foreign key in DBMS is a field that contains unique values and is used to link related tables together.

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

A primary key is a field or set of fields in a table that uniquely identifies each record in the table and cannot be Null. It is used to enforce data integrity and to ensure that there are no duplicate records in the table. A foreign key is a field in one table that refers to the primary key in another table. It is used to establish a relationship between two tables, and it ensures that data in one table is linked to data in another table.

Computer Science: CUET Mock Test - 2 - Question 2

The postfix form of A*B + C/D is

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

The correct answer is AB*CD/+

Key PointsThe postfix (also known as Reverse Polish Notation - RPN) is a way of writing expressions without the need for parenthesis. It places operators after their operands. To convert the infix expression (A*B + C/D) to postfix, we follow the operands and operators in their order of operation, considering the precedence of operators.

Given infix expression: (A*B + C/D)

  • Multiply A and B ((A*B))
  • Divide C by D ((C/D))
  • Add the results of steps 1 and 2

Following these steps in postfix notation:

  • Multiplication of A and B is represented as (AB*)
  • Division of C by D is represented as (CD/)
  • Addition of the results of the above operations is represented by appending a plus (+) symbol after them.

Therefore, putting it all together, the postfix expression becomes: (AB*CD/+)

So, the correct option is: AB*CD/+

Computer Science: CUET Mock Test - 2 - Question 3

The file offset position of a file opened in < r > mode is _________.

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

The correct answer is Begining of the file

  • File offset position: It's the point within a file where the next read or write operation will occur.
  • < r > mode: This mode is designed specifically for reading from a file.

When you open a file in < r > mode, the file offset position is automatically set to the beginning of the file. This means that any subsequent read operations will start from the first byte of the file.

Key Points

  • The file offset position can be changed using functions like fseek (in C) or seek (in Python), but it's initially at the beginning in < r > mode.
  • Other file opening modes have different default offset positions:
    • < w > mode (write): Sets the offset to the beginning, overwriting existing content.
    • < a > mode (append): Sets the offset to the end, appending new content.
    • < r+ > mode (read and write): Sets the offset to the beginning, but allows both reading and writing.
Computer Science: CUET Mock Test - 2 - Question 4

Consider the following python code: def myDiv(x, y): if

y = = 0:

raise ZeroDivisionError

return x/y

What is the output of the following?

n = myDiv(4,0)

print(n)

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

The correct answer is ZeroDivisionError

1. Function Definition:

  • The code defines a function named myDiv(x, y) that attempts to divide x by y.
  • It checks for a potential division by zero:
    • If y is equal to 0, it raises a ZeroDivisionError to prevent an invalid operation.
    • If y is not 0, it proceeds with the division and returns the result (x/y).

2. Function Call:

  • The code calls the myDiv function with arguments 4 and 0: n = myDiv(4, 0).
  • Within the function:
    • The check y == 0 evaluates to True, because y is indeed 0.
    • This triggers the raise ZeroDivisionError statement.
    • The function execution stops immediately, and the ZeroDivisionError is raised.

3. Error Handling:

  • The code doesn't have any explicit error handling mechanisms like try-except blocks.
  • Therefore, the raised ZeroDivisionError propagates up and terminates the program.
  • The print statement print(n) never gets executed.

Output:

  • The output you'll see is the error message:
  • ZeroDivisionError

Key Points

  • Python, like most programming languages, doesn't allow division by zero.
  • It raises a ZeroDivisionError to prevent mathematical errors and potential program crashes.
  • It's essential to handle potential errors gracefully with exception handling blocks to ensure program robustness.
Computer Science: CUET Mock Test - 2 - Question 5
_________ Communication mode allows communication in both directions simultaneously.
Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 5

The correct answer is Full duplex

Key PointsThe Transmission mode is divided into three categories:

  • Simplex mode
    • In Simplex mode, the communication is unidirectional, i.e., the data flow in one direction. The radio station is an example of simplex channel
  • Half-duplex mode
    • In a Half-duplex channel, direction can be reversed, i.e., the station can transmit and receive the data as well but only one direction at a time. A Walkie-talkie is an example of the Half-duplex mode.
  • Full-duplex mode
    • In Full duplex mode, the communication is bi-directional, i.e., the data flow in both the directions. Example of the full-duplex mode is a telephone network.
Computer Science: CUET Mock Test - 2 - Question 6

Choose the advantages of a database over file system from the following statements.

A. Reduces data redundancy and saves storage.

B. Sharing of data is possible.

C. Difficult to access the data in formatted way.

D. Data inconsistency is reduced to larger extent

E. Databases are not portable.

Choose the correct answer from the options given below:

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

The correct answer is A, B and D only

Key Points

  • A. Reduces data redundancy and saves storage:
    • This is an advantage of databases. By storing data in a centralized location and enforcing data integrity, databases eliminate the need for duplicate copies of data across different files.
  • B. Sharing of data is possible:
    • Databases are designed for multi-user access. They provide mechanisms for controlled sharing of data among authorized users.
  • C. Difficult to access the data in formatted way:
    • This is not necessarily true. Databases offer structured query languages (SQL) for easy and efficient access to data in a formatted way.
  • D. Data inconsistency is reduced to a larger extent:
    • Databases enforce data integrity through constraints and data types, minimizing inconsistencies that can arise with file systems.
  • E. Databases are not portable:
    • Modern databases offer portability features, allowing them to be transferred across different platforms with minimal configuration changes.

Therefore, options A, B, and D represent the key advantages of databases over file systems.

Computer Science: CUET Mock Test - 2 - Question 7

What is mean by stable sorting algorithm?

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

Concept

The stability of a sorting algorithm is concerned with how the algorithm treats equal (or repeated) elements.

A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.

Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.

Computer Science: CUET Mock Test - 2 - Question 8
What is the return type of readline() function?
Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 8

The correct option is String.

CONCEPT:

In Python we use readline() and readlines() method to read the content of a file.

readline() method reads a line from the file and return it in the form of the string. It can take a parameter that specifies the maximum number of bytes that can be read from the file. But it cannot read more than one line from the file.

Syntax: file.readline()

Return Value: Returns the next line of the file including the newline character.

readlines() method will append all the lines of a file in the format of a list where each element of the list is a line of the file.

Syntax: file.readlines()

Return Value: A list containing the lines.

To check the type of a return value we can use type() function in python.

Example: Let us open a file named "data.txt" using open function as follows

file = open("data.txt", "r")

lines = file.readlines()

// using readlines() method to read lines of the data.txt file and store it in lines

print(type(lines))

// this will print the type of data stored in lines

Computer Science: CUET Mock Test - 2 - Question 9
In Python code, on encountering a syntax error, the _____________ does not execute the program.
Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 9

The correct answer is option 3.

Concept:

Python is a programming language that is commonly used to create websites and applications, automate operations, and do data analysis. Python is a general-purpose programming language, which means it can be used to develop a wide range of applications and isn't tailored to any particular issue.

  • The interpreter parses our Python code before converting it to Python byte code, which it then executes.
  • During this initial step of program execution, also known as parsing, the interpreter will look for any incorrect syntax in Python.
  • If the interpreter fails to parse our Python code, we have used improper syntax somewhere. The interpreter will try to show us where we made the mistake.
  • In Python code, on encountering a syntax error, the Interpreter does not execute the program.

Hence the correct answer is Interpreter.

Computer Science: CUET Mock Test - 2 - Question 10
Which mode will write data to a file even if the file does not exist?
Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 10

The correct option is Both w+ and a+

CONCEPT:

To read or write a file, we first need to open it using the open() function, which returns a file object.

Syntax:

open(file, mode)

The "mode" attribute is passed to specify the mode in which we require the file to be opened.

There are several access modes available for the open() function:

w+ Opens the file in writing and reading mode or creates the file if it doesn't exist and opens it in write mode

r+ Opens the file in reading and writing mode but does not create the file if it does not exist.

a+ Opens the file in append and reading mode or creates the file if it doesn't exist and opens it in append mode.

Therefore "Both w+ and a+" mode can be used to write data to a file even if the file does not exist.

Computer Science: CUET Mock Test - 2 - Question 11

Assertion (A): When a file is opened in read mode (< r >), the file offset position is set to the end of the file.

Reason (R): The primary purpose of read mode is to start reading from the existing end of the file content.

Choose the most appropriate option:

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

The correct answer is (A) is false, (R) is false.

Key Points

  • Assertion (A) is INCORRECT. When a file is opened in read mode (< r >), the file offset position is set to the beginning of the file, not the end.
  • Reason (R) is INCORRECT. The main purpose of read mode is to access and read existing content from the start of the file, not necessarily to begin reading from the end.
Computer Science: CUET Mock Test - 2 - Question 12

Which of the following statements is/are correct for variable names in python language?

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

A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).

Computer Science: CUET Mock Test - 2 - Question 13

Match List I and List II.

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

(A) MQTT is a lightweight, publish-subscribe protocol that is ideal for low-bandwidth, high-latency networks, making it well-suited for IoT devices that operate in remote areas with limited connectivity.
(B) CoAP is a lightweight protocol designed for constrained devices and low-power networks, making it well-suited for IoT devices that operate on battery power or have limited processing capabilities.
(C) HTTP is a popular protocol used for web-based communication, but it is not as well-suited for IoT devices due to its high overhead and lack of support for low-power networks.
(D) LoRaWAN is a long-range, low-power protocol designed for IoT devices that need to communicate over long distances, making it well-suited for applications like smart agriculture or asset tracking.

Computer Science: CUET Mock Test - 2 - Question 14

Which of the following provides a command for defining relation schema?

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

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

Computer Science: CUET Mock Test - 2 - Question 15

In RDBMS, data is presented as a collection of ______.

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

In relational model, data is stored in relations (tables) and is represented in form of tuples (rows). RDBMS is used to manage relational database. Relational database is a collection of organized set of tables related to each other, and from which data can be accessed easily.

Computer Science: CUET Mock Test - 2 - Question 16

Structured Query Language (SQL) is used to

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 16
  • In a DBMS, the SQL database language is used to:
  • Create the database and table structures
  • Perform basic data management chores (add, delete and modify)
  • Perform complex queries to transform raw data into useful information
Computer Science: CUET Mock Test - 2 - Question 17

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

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 17
  • A subquery is a query that is nested inside another query and is used to retrieve data to be used in the main query.
  • A 'Common Table Expression' (CTE) is a named temporary result set that can be used within a query. It is similar to a subquery but is declared separately and can be referenced multiple times within the same query.
  • A window function is a function that performs a calculation across a set of rows that are related to the current row. It is used to calculate values such as running totals or moving averages.
  • A materialized view is a physical copy of a query result that can be stored and queried later. It is used to improve performance by precomputing expensive queries.
Computer Science: CUET Mock Test - 2 - Question 18

Two statements are given below:
Statement I: Bubble Sort has a worst-case time complexity of O(n2), making it inefficient for large collections.
Statement II: Merge Sort has a worst-case time complexity of O(n log n), making it efficient for large collections.

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

Bubble sort is a simple sorting algorithm that compares adjacent elements and swaps them if they are in the wrong order. It has a worst-case time complexity of O(n2) for both comparisons and swaps, making it inefficient for large collections. Merge sort is a divide-and-conquer sorting algorithm that works by dividing the collection into smaller subcollections, sorting them recursively, and then merging the sorted subcollections to produce the final sorted collection. It has a worst-case time complexity of O(n log n) for both comparisons and swaps, making it efficient for large collections.

Computer Science: CUET Mock Test - 2 - Question 19

How many times can a loop in while(0) run?

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

while(0) - It is opposite of while(1). It means condition will always be false and ,thus, the code in 'while' will never get executed.

Computer Science: CUET Mock Test - 2 - Question 20

Python strings are also called the collection of:

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

Each character is encoded in the ASCII or Unicode character. So, we can say that Python strings are also called the collection of Unicode characters. In Python, strings can be created by enclosing the character or the sequence of characters in the quotes.

Computer Science: CUET Mock Test - 2 - Question 21

What is term used for when one tries to pop/delete an item from an empty stack?

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

Underflow occurs when the user performs a pop operation on an empty stack.

Computer Science: CUET Mock Test - 2 - Question 22

What is/are instance(s) of database?

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

Instance or extension or database state which is a collection of information stored in a database at a particular moment is called an instance of the database. Thus, it is a dynamic value which keeps on changing.

Computer Science: CUET Mock Test - 2 - Question 23

Match List I and List II.

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

(A) World Wide Web (WWW) - It is a system of interlinked hypertext documents that are accessed via the Internet. Documents and downloadable media are made available to the network through web servers and can be accessed by programs such as web browsers.
(B) Internet - The Internet, sometimes called simply "the Net," is a worldwide system of computer networks. It is a network of networks in which users at any one computer can, if they have permission, get information from any other computer. Hence, it is a global network of interconnected computers and other devices that use standardized communication protocols.
(C) Cloud Computing - It is a model for delivering on-demand access to shared computing resources over the Internet. It is the delivery of computing services—including servers, storage, databases, networking, software, analytics, and intelligence—over the internet to offer faster innovation and flexible resources.
(D) Machine-to-Machine (M2M) - It is technology that enables direct communication between IoT devices, without the need for human intervention. The main purpose of M2M technology is to tap into sensor data and transmit it to a network.

Computer Science: CUET Mock Test - 2 - Question 24

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

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 24
  • Linear Search has a worst-case time complexity of O(n), where n is the size of the input data.
  • Binary Search has a worst-case time complexity of O(log n), where n is the size of the input data.
  • Interpolation Search has a worst-case time complexity of O(n log n), which is less efficient than O(log n) algorithms like Binary Search.
  • The worst-case running time of Depth-First Search (DFS) depends on the graph being traversed. In a graph with n nodes and m edges, the time complexity of DFS is O(n+m), which means that the running time increases linearly with the number of nodes and edges in the graph.
Computer Science: CUET Mock Test - 2 - Question 25

What is the output of following code:
T = (100)
print(T*2)

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

We can use * operator to repeat the tuple values n number of times.
For example:
("abc",)*3 will return ('abc', 'abc', 'abc').

Computer Science: CUET Mock Test - 2 - Question 26

Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.

CSV File
1, AKSHAY,XII,A
2, ABHISHEK,XII,A
3, ARVIND,XII,A
4, RAVI,XII,A
5, ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ") rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data)
#Statement-5

fh.close()

Q. Identify the suitable code for blank space in line marked as Statement-1.

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

csv is the correct code to fill up the blank in Statement 1, which is to be imported.

Computer Science: CUET Mock Test - 2 - Question 27

Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.

CSV File
1, AKSHAY,XII,A
2, ABHISHEK,XII,A
3, ARVIND,XII,A
4, RAVI,XII,A
5, ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ") rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data)
#Statement-5

fh.close()

Q. Choose the function name (with argument) that should be used in the blank space of line marked as Statement-3

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

writer(fh) should be used in blank space in Statement 3. csv. writer is used to insert data to the CSV file.

Computer Science: CUET Mock Test - 2 - Question 28

Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.

CSV File
1, AKSHAY,XII,A
2, ABHISHEK,XII,A
3, ARVIND,XII,A
4, RAVI,XII,A
5, ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ") rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data)
#Statement-5

fh.close()

Q. Choose the function name that should be used in the blank space of line marked as Statement-5 to create the desired CSV File?

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

writerows() should be used in blank space in Statement 5.
writerows() function writes each sequence in a list as a comma separated line of items in the file.

Computer Science: CUET Mock Test - 2 - Question 29

Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.

CSV File
1, AKSHAY,XII,A
2, ABHISHEK,XII,A
3, ARVIND,XII,A
4, RAVI,XII,A
5, ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ") rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data)
#Statement-5

fh.close()

Q. Identify the missing code for blank space in line marked as Statement-2?

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

This code opens a file student.csv in write mode becasue append( ) method is using.
So, correct misssing code is "Student.csv", "w"

Computer Science: CUET Mock Test - 2 - Question 30

Rohit, a student of class 12th, is learning CSV File Module in Python. During examination, he has been assigned an incomplete python code (shown below) to create a CSV File 'Student.csv' (content shown below). Help him in completing the code which creates the desired CSV File.

CSV File
1, AKSHAY,XII,A
2, ABHISHEK,XII,A
3, ARVIND,XII,A
4, RAVI,XII,A
5, ASHISH,XII,A

Incomplete Code
import_____ #Statement-1
fh = open(_____, _____, newline='') #Statement-2
stuwriter = csv._____ #Statement-3
data = []
header = ['ROLL_NO', 'NAME', 'CLASS', 'SECTION']
data.append(header)
for i in range(5):
roll_no = int(input("Enter Roll Number : "))
name = input("Enter Name : ")
Class = input("Enter Class : ")
section = input("Enter Section : ") rec = [_____] #Statement-4
data.append(rec)
stuwriter. _____ (data)
#Statement-5

fh.close()

Q. Identify the suitable code for blank space in line marked as Statement-4.

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

Suitable code for blank space in Statement 4 is roll_no, name, class, section.

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