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

Computer Science: CUET Mock Test - 4 - CUET MCQ


Test Description

40 Questions MCQ Test CUET Mock Test Series - Computer Science: CUET Mock Test - 4

Computer Science: CUET Mock Test - 4 for CUET 2024 is part of CUET Mock Test Series 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 2024 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 Mock Test Series for CUET & Computer Science: CUET Mock Test - 4 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 - 4 | 40 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 - 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

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 2

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.

1 Crore+ students have signed up on EduRev. Have you? Download the App
Computer Science: CUET Mock Test - 4 - Question 3

How many types of DML are there?

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

Data manipulation languages are divided into two types, procedural programming and declarative programming.

Computer Science: CUET Mock Test - 4 - Question 4

Identify 'Y', where 'Y' is a computer network comprised by the interconnection of two or more LANs within a limited area.

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

In MAN, different LANs are connected through a local telephone exchange. Some of the widely used protocols for MAN are RS-232, X.25, Frame Relay, Asynchronous Transfer Mode (ATM), ISDN (Integrated Services Digital Network), OC·3 lines (1.55 Mbps), ADSL (Asymmetrical Digital Subscriber Line). These protocols are quite different from those used for LANs.

Computer Science: CUET Mock Test - 4 - Question 5

What is the purpose of the rewind() function?

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

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 6

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

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 6
  • 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 7

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 7

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 8

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

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

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 9

The append() method appends an element

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

The append() method adds an item to the end of the list.

Computer Science: CUET Mock Test - 4 - Question 10

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

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

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 11

Which of the following is an application of stack?

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

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 12

_____ requires user to specify what data is needed without specifying how to get it.

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

Non-Procedural DML or High level DML requires a user to specify what data are needed without specifying how to get those data.

Computer Science: CUET Mock Test - 4 - Question 13

____ command helps to add new data to the database.

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

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 14

Which of the following best describes a white hat hacker?

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

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 15

Communication bandwidth that has the highest capacity and is used by microwave, cable and fibre optic lines is known as

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

Communication bandwidth that has the highest capacity and is used by microwave, cable and fibre optic lines is known as broadband.

Computer Science: CUET Mock Test - 4 - Question 16

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 16

The append() method in Python adds a single item to the existing list.

Computer Science: CUET Mock Test - 4 - Question 17

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 17

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 18

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 18

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 19

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 19

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 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. Fill Statement 4, to delete an element from the stack.

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

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

Computer Science: CUET Mock Test - 4 - Question 21

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 21

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 22

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 22

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 6 swap required to sort the list. ( option 1) 
Formula - For a n element list , Selection Sort needs (n-1) number of swap. , where n is number of element in a list.

Computer Science: CUET Mock Test - 4 - Question 23

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

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

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 24

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 24

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 25

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

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

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 26

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 26

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/2;
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/2;
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

Computer Science: CUET Mock Test - 4 - Question 27

Which of the following File open modes is used for Opens the file in append mode?

Note: If the file doesn’t exist, then a new file will be created.

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

The correct answer is option 4.

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:

  •  <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 <a>.

Computer Science: CUET Mock Test - 4 - Question 28

What is the output for the given python code? (If the file does not exist)

try:    
    fileptr = open("file.txt","r")    
except IOError:    
    print("File not found")    
else:    
    print("The file opened successfully")    
    fileptr.close()    

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

The correct answer is option A.
Concept:
The given python code is,
try:    
    fileptr = open("file.txt","r")    
except IOError:    
    print("File not found")    
else:    
    print("The file opened successfully")    
    fileptr.close()    

Explanation:
It is an error raised when an input/output operation fails, such as the print statement or the open() function when trying to open a file that does not exist. It is also raised for operating system-related errors.
The file pointer fileptr is open the file.txt in reading mode and that file is not found so try clause raise the error. That resolve in except block and prints the statement like File not found as output.
Hence the correct answer is File not found.

Computer Science: CUET Mock Test - 4 - Question 29

Which operation is  used to view elements at the front of the queue, without removing it from the queue?

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

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 . 

Computer Science: CUET Mock Test - 4 - Question 30

If two lists are given such as:

L1: [2, 4, 6, 8, 10]
L2: [10, 4, 6, 8, 10]

If the lists are sorted using Insertion sort then which of the lists List1 or List 2 will make the minimum number of comparisons?

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

Insertion sort works by the algorithm like to compare every element with the element in its left side , if they are smaller , skip , else swap the element. 

Applying insertion sort in list 1 :
L1- {2,4,6,8,10} 
If the list is already sorted , then insertion sort do (n-1) number of comparison . 
So, in total we need 4 comparison for this List . 

L2 - {10.4,6,8,10}
Pass 1 - compare 10 and 4 , swap the position - {4,10,6,8,10}  - 1 comparison 
Pass 2 - compare 10 and 6 , swap them , again compare 6 and 4( no swapping required - {4,6,10,8,10} - 2 comparison 
Pass 3 - Compare 8 and 10 , swap them , again compare 8 with 6 and 4( no swap as they are already sorted ) - {4,6,8,10,10}-3 comparison 
Pass 4 - compare 10 with 10 , as they are same element , so, no swapping required ,and here , list got sorted - {4,6,8,10,10} - 1 comparison 
So, in total we need 7 comparison to sort list 2 . 

Question asks about minimum number of comparison , so, Option A will be the answer. 

Computer Science: CUET Mock Test - 4 - Question 31

What is the output produced by following output code

def fun(a,b):
    try:
        if a*b > 0
        print("Positive")
        else
        print("Negative")
 
    except IndexError:
        print('Index Error')
 
    except SyntaxError:
        print('Syntax Error')

fun(-5 , 5)

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

The correct option is Syntax Error

CONCEPT:
Try and Except statement is used to catch and handle errors within code in Python. 
The code inside the try block will be executed whenever there is no error in the code.
And whenever the program encounters an error in the try block, the except block is executed.
Syntax errors occur when the programmer does not follow the syntax rules of the used programming language.
Example misspelling a keyword, leaving out a symbol, colon, such as a comma, brackets....etc.
In the above question the if statement misses colon after it.
The Syntaxically correct statement could have been as shown
if a*b > 0 :
        print("Positive")

Computer Science: CUET Mock Test - 4 - Question 32

A _________ is an analog device which regenerates weakened signals on the cable.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 32
  • An amplifier increases the intensity of a signal, even if it has not become weaker than original.
  • Ethernet is a network adapter that is used to form a link between the computer and the network.
  • Repeater is used for regeneration of weakened signals. Any analog signal can travel only a particular distance over the network. It needs to be regenerated after that point, and this is done by a repeater.
  • A router is used a point of connection between two or more networks. It simply transmits signals from one network to another.
Computer Science: CUET Mock Test - 4 - Question 33

Suppose for a given database, one attribute in a row is not provided with a value by the user. What value represents this unknown field?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 33
  • For unknown data fields, DBMS uses the NULL value.
  • 0 cannot be used for fields which take non-numeric values. So, 0 cannot be used uniformly in attributes of all data types.
  • Storing garbage data in a DBMS schema will create problems when querying into the DBMS.
  • No field in a DBMS can be left blank.
Computer Science: CUET Mock Test - 4 - Question 34

What is the output for the given python code?

try:
       a=10/0;     
except (ArithmeticError, IOError) as e:
    print(e)
else:      
    print("Successfully Done")

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

The correct answer is option  A.

Concept:
Declaring Multiple Exceptions:

The except clause in Python enables us to define numerous exceptions. When a try block throws many exceptions, declaring more than one exception might be helpful.
Syntax:
try:    
    #block of code     
    
except (<Exception 1>,<Exception 2>,<Exception 3>,...<Exception n>)    
    #block of code     
    
else:    
    #block of code  

Explanation:

The given program has multiple exceptions which are ArithmeticError and IOError

try:
       a=10/0;     
except (ArithmeticError, IOError) as e:
    print(e)
else:      
    print("Successfully Done")

The try block has some error and that raise on try block. That error was caught in the except block as e. The print statement prints that error as division by zero.

Hence the correct answer is division by zero.

Computer Science: CUET Mock Test - 4 - Question 35

A modem acts as a ________ converter at the sender end and as a ________ converter at the receiver end.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 35
  • Modem is short for modulator and demodulator.
  • At the sender end, the modem converts digital data to analog signals, thus working as a modulator.
  • At the receiver end, the modem converts analog signals to digital data, thus working as a demodulator.
  • The reason for this conversion is that when communicate through a network, we can only send analog signals.
Computer Science: CUET Mock Test - 4 - Question 36

Statement I: MAC address of a device can change.
Statement II: IP address of a device cannot change.

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 36
  • 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.
Computer Science: CUET Mock Test - 4 - Question 37

Which is the correct postfix expression for this P+Q*R/S-T+P infix expression?

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

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 ) 

Computer Science: CUET Mock Test - 4 - Question 38

Binary Search algorithm uses which of the following approach

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

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.

Computer Science: CUET Mock Test - 4 - Question 39

How many iterations are done until the key element 5 is found in the given list = [5, 64, 77, 82, 90]  using binary search?

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

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.
Computer Science: CUET Mock Test - 4 - Question 40

Consider the following database schemas:

In which schema, is the Dept_ID attribute a primary key?

Detailed Solution for Computer Science: CUET Mock Test - 4 - Question 40
  • The attribute which holds unique values for every tuple in the relation is called the primary key.
  • The EMPLOYEE relation stores details about the employees in a firm. There may be multiple employees who belong to the same department. As a result, the Dept_ID field in the EMPLOYEE schema will not have unique values for each tuple. So, Dept_ID is not a primary key in the EMPLOYEE relation.
  • The DEPARTMENT relation stores the details of the departments in a firm. Each separate department is identified by a value, Dept_ID. Thus, the value of the attribute will be unique for every tuple of the relation. So, Dept_ID is a primary key in the DEPARTMENT relation.
8 docs|148 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

Up next

Download as PDF

Up next