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

Computer Science: CUET Mock Test - 7 - CUET MCQ


Test Description

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

Computer Science: CUET Mock Test - 7 for CUET 2024 is part of CUET Mock Test Series preparation. The Computer Science: CUET Mock Test - 7 questions and answers have been prepared according to the CUET exam syllabus.The Computer Science: CUET Mock Test - 7 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 - 7 below.
Solutions of Computer Science: CUET Mock Test - 7 questions in English are available as part of our CUET Mock Test Series for CUET & Computer Science: CUET Mock Test - 7 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 - 7 | 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
1 Crore+ students have signed up on EduRev. Have you? Download the App
Computer Science: CUET Mock Test - 7 - Question 1

The Programming language Python is named after:

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

The Programming language Python is named after a popular BBC comedy show "Monty Python's Flying Circus".

Computer Science: CUET Mock Test - 7 - Question 2

A relational database, which is in 3NF, may have undesirable data redundancy because there may exist

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

A relation is in third normal form, if there is no transitive dependency for non-prime attributes as well as it is in Second Normal Form.
A relation is in 3NF if at least one of the following conditions holds in every non-trivial function dependency X –> Y:

  • X is a super key.
  • Y is a prime attribute (each element of Y is a part of some candidate key).

In other words, a relation that is in First and Second Normal Form and in which no non-primary-key attribute is transitively dependent on the primary key, then it is in Third Normal Form (3NF).

Computer Science: CUET Mock Test - 7 - Question 3

____ constraints apply only to individual column.

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

Table constraints allow you to specify more than one column in a PRIMARY KEY, UNIQUE, CHECK, or FOREIGN KEY constraint definition. Column-level constraints (except for check constraints) refer to only one column.

Computer Science: CUET Mock Test - 7 - Question 4

ALTER table can not _______.

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

ALTER table can not change column name. The simplest way to rename a column is to use the ALTER TABLE command with the RENAME COLUMN clause.

Computer Science: CUET Mock Test - 7 - Question 5

We know that RJ-45 is an eight-wire connector that connects a computer to LAN, especially Ethernets. Here, what is the expansion of RJ?

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

The eight-pin RJ45 connector is a standardised interface which often connects a computer to a local area network (LAN). This type of connector was originally developed for telephone communications but is now used in a range of applications. The abbreviation, RJ45, stands for Registered Jack-45.

Computer Science: CUET Mock Test - 7 - Question 6

Which of the following options is not correct?

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

If we try to read a text file that does not exist, the file gets created - this is an incorrect statement.

Computer Science: CUET Mock Test - 7 - Question 7

Study the following program:
x = 1
while true:
if x % 5 = = 0:
break print(x) x + = 1

What will be the output of this code?

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

Syntax error, there should not be a space between + and =.

Computer Science: CUET Mock Test - 7 - Question 8

Which of the following statements is incorrect in the context of binary files?

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

Every line ends with a new line character is incorrect in the context of Binary files.

Computer Science: CUET Mock Test - 7 - Question 9

A perfect hash function maps every input key to a unique index in the hash table. If the hash function is perfect, collisions will______.

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

A perfect hash function maps every input key to a unique index in the hash table. If the hash function is perfect, collisions will never occur.

Computer Science: CUET Mock Test - 7 - Question 10

What is searching?

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

Searching in data structure refers to the process of finding the required information from a collection of items stored as elements in the computer memory. These sets of items are in different forms, such as an array, linked list, graph, or tree.

Computer Science: CUET Mock Test - 7 - Question 11

For which constraints are indexes created when the constraint is added?

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

For primary key and unique constraints, the index is built on the constrained columns as a mechanism to detect duplicates as rows are added or updated. For referential constraints, the index is built on the referencing columns of the constraint.

Computer Science: CUET Mock Test - 7 - Question 12

Where would you look for errors from the database engine?

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

Alert logs contain important information about error messages and exceptions that occur during database operations.

Computer Science: CUET Mock Test - 7 - Question 13

What is the common technique of firewall?

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

Packet filter, application gateway, circuit-level gateway, and proxy server are the techniques of firewall.

Computer Science: CUET Mock Test - 7 - Question 14

What is spam?

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

Email spam, also known as unsolicited bulk email (UBE), or junk mail is the practice of sending unwanted email messages frequently with commercial content in large quantities.

Computer Science: CUET Mock Test - 7 - Question 15

Which protocol is the foundation of data communication for the World Wide Web?

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

The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web.

Computer Science: CUET Mock Test - 7 - Question 16

The return type of the input() function is:

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

The return type of the input() function is string.

Computer Science: CUET Mock Test - 7 - Question 17

What will be the output of the following Python code?

def f1(a,b=[]):
b.append(a)
return b
print (f1(2,[3,4]))

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

In the code shown above, the integer 2 is appended to the list [3,4]. Hence, the output of the code is [3,4,2]. Both variables a and b are local variables.

Computer Science: CUET Mock Test - 7 - Question 18

Syntax of seek function in Python is myfile.seek(offset, reference_point) where myfile is the file object. What is the default value of reference_point?

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

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

Computer Science: CUET Mock Test - 7 - Question 19

A company ABC Enterprises has four blocks of buildings as shown in the figure:

Center to center distance between various blocks:

Number of computers in each block:

Computers in each block are networked but blocks are not networked. The company has now decided to connect the blocks also.

Q. Suggest the most appropriate topology for the connections between the blocks.

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

In a star network, every host is connected to a central hub. In its simplest form, one central hub acts as a medium to transmit messages. The star topology reduces the impact of a transmission line failure by independently connecting each host to the hub.

Computer Science: CUET Mock Test - 7 - Question 20

A company ABC Enterprises has four blocks of buildings as shown in the figure:

Center to center distance between various blocks:

Number of computers in each block:

Computers in each block are networked but blocks are not networked. The company has now decided to connect the blocks also.

Q. Which one of the following devices will you suggest for connecting all the computers with in each of their blocks?

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

Switch increases the available bandwith of the network. It increases the performance of the network by reducing workload on individual host PCs. Hub is the central point of networking device that connects multiple hosting devices to one network.

Computer Science: CUET Mock Test - 7 - Question 21

A company ABC Enterprises has four blocks of buildings as shown in the figure:

Center to center distance between various blocks:

Number of computers in each block:

Computers in each block are networked but blocks are not networked. The company has now decided to connect the blocks also.

Q. Suggest the most appropriate location of the server, to get the best connectivity for maximum number of computers.

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

The number of computers in Block B1 are greater than any other building and the distance of Block B1 to Blocks B2, B3, and B4 is comparatively less than the distance between any other buildings.

Computer Science: CUET Mock Test - 7 - Question 22

A company ABC Enterprises has four blocks of buildings as shown in the figure:

Center to center distance between various blocks:

Number of computers in each block:

Computers in each block are networked but blocks are not networked. The company has now decided to connect the blocks also.

Q. The company wants internet accessibility in all the blocks. The suitable and cost-effective technology for that would be:

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

Broadband provides high speed internet access via multiple types of technologies including fiber opitcs, wireless, cable, DSL, and satellite.

Computer Science: CUET Mock Test - 7 - Question 23

A company ABC Enterprises has four blocks of buildings as shown in the figure:

Center to center distance between various blocks:

Number of computers in each block:

Computers in each block are networked but blocks are not networked. The company has now decided to connect the blocks also.

Q. The company is planning to link its head office situated in New Delhi with the offices in hilly areas. Suggest a way to connect it economically:

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

Radio waves or radio transmission is used for wide area networks and mobile cellular phones. It can cover larger areas and can penetrate through walls, plants, furniture etc. It is the primary mode of communication and is cheapest of all other modes.

Computer Science: CUET Mock Test - 7 - Question 24

What error does the following code produce?

num = 6

print(math.factorial(num))

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 24
  • The factorial() function is defined within the math module. The math module needs to be explicitly imported for using in a Python program. Since it has not been imported in the given code, a NameError is raised because the name ‘math’ is undefined.
  • The TypeError occurs when an incorrect data type value is provided to a function or an operator.
  • A ValueError occurs when the correct data type is passed to a function, but the value of the variable is unacceptable or incorrect.
  • The ImportError occurs when such a module is imported to a Python program that does not exist.
Computer Science: CUET Mock Test - 7 - Question 25

Python executes the else part of try-except-else:

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 25
  • The try-except-finally block is used to handle code which might raise an exception.
  • The code which might raise exceptions is placed within the try block.
  • All the probable exceptions are included distinct except blocks. The name of the expected exception is mentioned at the start of the except block.
  • In case the code within the try block leads to exceptions that are not defined or unexpected, we can include an except block which does not specify any particular exception. This block can catch unexpected or undefined errors encountered in the try block.
  • The else block comes after all the except blocks. This block contains code that is executed when the control enters neither of the except blocks. Thus, the else part is executed when no exception occurs.
Computer Science: CUET Mock Test - 7 - Question 26

Example 1:
Consider array has 4 elements and a searching element 16.
A[4]= {10, 16, 22, 25} 
The number of iterations are required to search an element by using a binary search= T1

Example 2:
Consider array has 4 elements and a searching element 22.
A[4]= {10, 16, 22, 25} 
The number of iterations are required to search an element by using a binary search= T2

Note: Searching is successful.

Which of the following statement are true?

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

Concept:
Binary Search:

A Binary Search is a sorting method used to find a specific member in a sorted array. Because binary search works only on sorted arrays, an array must be sorted before using binary search on it. As the number of iterations in the binary search reduces, it is a superior searching approach to the liner search technique.

Algorithm:
int binarySearch(int a[], int beg, int end, int K)    
{    
    int mid;    
    if(end >= beg)     
    {   mid = (beg + end)/2;    
        if(a[mid] == K)                 
            return mid+1;    
        else if(a[mid] < K) 
            return binarySearch(a, mid+1, end, K);      
        else   
            return binarySearch(a, beg, mid-1, K);            
    }    
    return -1;     
}   

Example 1:
The given data,
A[4]= {10, 16, 22, 25} 
Searching element= K= 16
beg= 0
end = 3
mid = 3/2 = 1
 if K with A[mid] and search is successful. 
Hence the number iterations are =1.

Example 2:
The given data,
A[4]= {10, 16, 22, 25} 
Searching element= K= 22
beg= 0
end = 3
mid = 3/2 = 1.
Compare 22 with A[1] is not found and K is greater than A[mid]. So  call binarySearch(a, 1+1, 3, 2); 
beg= 2
end = 3
mid = 5/2 = 2.
Compare 22 with A[2] is found.
Hence the number of iterations is = 2
Hence the correct answer is T1 < T2.

Computer Science: CUET Mock Test - 7 - Question 27

Consider the following student relation.

Student relation has Name, Subject1_Marks, and Subject2_Marks attributes.

What is the output for the given SQL query?
Query:
Select sum(subject1_Marks)+sum(Subject2_Marks)
From student;

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

The correct answer is option A.

Concept:
Sum():

It takes one set of values and gives one output. The SUM() function returns the total sum of a numeric column.
SUM() Syntax:
SELECT SUM(column_name)
FROM table_name
WHERE condition;
Explanation:
The given table is,
Consider the following student relation.
Student relation has Name, Subject1, and Subject2 attributes.

Query:
Select sum(subject1_Marks)+sum(Subject2_Marks)
From student;
Here calculates the sum of subject1 marks and subject2 individually. And finds the total sum of two subjects.
Note:
Here Sum() function ignores the null values whichever addition or subtraction or multiplication is required.
Subject1_Marks calculates the 10+20+30=60.
Subject2_marks calculates the 5+10+15+20+25=75
sum(subject1_Marks)+sum(Subject2_Marks)= 60+75= 135
Hence the correct answer is 135.

Computer Science: CUET Mock Test - 7 - Question 28

Is the following Python code valid?
try:
    # Do something
except [exception-name]:
    # Do something
except:
    # Do something

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 28
  • A try block must be followed by one or more except blocks. The except blocks may or may not specify exceptions.
  • After the except blocks, an else block may be added for the scenario when no exception is raised in the try block. This block is optional.
  • Following the else block, a finally block may be declared which will be executed whether or not an exception arises. This block is optional.
  • Thus, the given code snippet is correct.
Computer Science: CUET Mock Test - 7 - Question 29

The range of the following data 95, 115, 25, 20, 35, 55 is 

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

Given:
The given numbers are 95, 115, 25, 20, 35, 55

Calculation:
The largest value = xm = 115
And the smallest value = x0 = 20
⇒ Range = Largest value - Smallest value
⇒ Range = 115 - 20 = 95
∴ The range is 95

Computer Science: CUET Mock Test - 7 - Question 30

Which of the following sorting algorithm required the least swap to sort the following list?
L1: [52,18,16,12,36,26,22]

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

Selection sort is a sorting algorithm in which the smallest element always move to the extreme left corner of the list, 

Point to remember - If the array is sorted in ascending order, even though the selection sort takes the same number of comparisons, as of unsorted array. The maximum number of swaps and comparisons are required when the array is sorted in descending order. 

Now, applying selection sort on L1- [52,18,16,12,36,26,22]
Minimum element in the list is 12 , So, swap 52 with 12. 
After 1st pass - [12,18,16,52,36,26,22]    (1 swap) 

The minimum element is 16 now, swap 18 with 16. 
After 2nd pass - [12,16,18,52,36,26,22]  (1 swap) 

In the 3rd pass, no change as 18 is in the correct position. 
After 3rd pass - [12,16,18,52,36,26,22] 

Now, 22 is the minimum element, swap 52 with 22.
After 4th pass - [12,16,18,22,36,26,52]  (1 swap) 

Minimum element is now 26 , swap 36 , with 26 
After 5th pass - [12,16,18,22,26,36,52] (1 swap) 

Now, the list is already sorted after the 5th pass, so, a total of 4 swaps are required for the selection sort.
So, option 2 will be the answer. 

Computer Science: CUET Mock Test - 7 - Question 31

A Rony is a student of class 10th, he went to a book shop to purchase books. The MRP of the purchased books is like 45, 67, 55, 98, 50, and 44. Now he wants to sort the books according to their MRP.  In which sorting algorithm the minimum number of comparisons are required to sort these books in ascending order?

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

Here, we are given the prices of books in a list, and we have to sort them based on a minimum number of the comparison-based algorithm. 

POINT TO REMEMBER - For a random array, the Selection sort always gives a less number of comparison swaps than a sorted array in descending order. 

Applying selection sort to L= [ 45,67,55,98,50,44] 

45 will be compared with all 5 elements, 44 here is the minimum. 
After 1st pass - {44}  { 45,67,55,98,50} ( 5 comparison ) 

Now, check minimum from the unsorted part - 45 will be compared with 67,55,98,50 , so, 45 is the minimum . 
After 2nd pass - {44,45}   {67,55,98,50}   ( 4 comparison ) 

in the unsorted list, 50 is the minimum 
After 3rd pass - { 44,45,50}  {67,55,98}    ( 3 comparison ) 

55 is the next minimum, 
After 4th pass - { 44,45,50,55} {67,98}   ( 1 comparison ) 

Now, 67 will be compared with 98, as they are in the correct position, no need to compare again, the list is already sorted after the 4th pass. 

So, in total, we need 13 comparisons to sort the list using selection sort. 

Computer Science: CUET Mock Test - 7 - Question 32

You are given the text file, file1.txt whose contents are:
hello everyone
today is a monday
all the best for your exams

What will be the output of the following code?
myfile = open("file1.txt", "r")
str = myfile.readlines(20)
print(str)
myfile.close()

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 32
  • The readlines() function always reads complete lines. If the specified number of characters ends in the middle of a line, the function still reads that complete line up to the \n character.
  • The readlines() function returns a list of strings, where each string is each line. The strings also contain the \n character.
  • In the given code, the ‘str’ variable holds the list of strings that are returned by the readlines() function.
  • When printed, the list is printed within square brackets.
  • Even though 20 bytes from the beginning of the file ends after the word ‘today’, the readlines() function reads and returns the complete second line.
Computer Science: CUET Mock Test - 7 - Question 33

Which of the following searching technique is to search in which each element is to be visited until we reach the same match?

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

Concept:
The most fundamental search method is linear search, sometimes referred to as sequential search. In this type of search, we go through the entire list and try to fetch a match for a single element.
If we find a match, then the address of the matching target element is returned.
On the other hand, if the element is not found, then it returns a NULL value.
Algorithm:
linear_search(int a[], int n, int X)

  for (int i = 0; i < n; i++)  
    {  
        if (a[i] == X)  
        return i+1;  
    } 
}

Worst-case:
In the Linear Search Algorithm, the worst-case scenario happens when the item to be found is at the end of the Array or the element is not present in the array. Hence the linear search compares each element till the end. So it takes maximum time behavior in linear search.

Best case:
The best case in the Linear Search Algorithm happens when the item to be found is at the beginning of the Array.

Average case:
In the Linear Search Algorithm, the average scenario happens when the item to be found is somewhere in the center of the Array.

Hence the correct answer is Linear search.

Computer Science: CUET Mock Test - 7 - Question 34

What happens when the following statement is executed and file1.txt is not present in the current directory?

file_obj = open("file1.txt", "r")

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 34
  • The code raises a FileNotFoundError because the file ‘file1.txt’ is not present in the current directory.
  • Since the file is being opened in read mode, the file must be available to be opened. If the file would be opened in write mode, then Python would have created a new file with the given name. But that does not happen for the read mode.
  • The IOError occurs when a file exists but it cannot be opened due to some reason.
Computer Science: CUET Mock Test - 7 - Question 35

What will be the output of the following code?
try:
    print(5)
except:
    print("Error encountered")
else:
    print("No error encountered")
finally:
    print("Over")

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 35
  • The code in the try block is executed first and it prints the value 5.
  • The statement in the try block does not raise any exception, so the except block is not executed.
  • Since the except block is not executed, the else block is executed. This block prints No error encountered on a new line.
  • Lastly, the control moves over to the finally block and prints Over on a new line.
Computer Science: CUET Mock Test - 7 - Question 36

How many swaps are required using bubble sort to sort the list L1?

L1: [127,119,223,136,233,134]

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

In bubble sort, the maximum element will move to the extreme right side of the list.

Applying Bubble sort in L1- [127,119,223,136,233,134] Take 127 to be the bubble element and compare that with the next element, if the next element is greater than the current element then shift the bubble element, if not then swap two elements.

Pass-1:
127 is greater than 119, So, swapping is required. Swap 127 and 119.
Total swap-1 
L1- [119,127,223,136,233,134]
Now, compare 127 with 223, No swapping required.
Compare 223 with 136, and swap them.
Total swap - 2 
L1- [119,127,136,223,233,134]
Compare 223 with 233, no swapping is required. 
Compare 233 and 134,1 Swapping required as 134 is smaller than 233. Pass 1 ends here.
Total swap -3 
L1- [119,127,136,223,134,233]

Pass-2:
Compare 119 with 127, no swap is required.
Compare 127 with 136 no swap is required.
Compare 136 with 223, no swap is required.
Compare 223 with 134 - 1 swap required as 134 is smaller than 223. 
Total swap-4
L1- [119,127,136,134,223,233]

Pass-3:
Now, compare 119 with 127, no swap is required.
Compare 127 with 136, no swap is required.
Compare 136 with 134  and 1 swap is required as 134 is smaller than 136.
Total swap - 5 
L1- [119,127,134,136,223,233]

Pass-4:
Now compare 119 with 127, no swap is required.
Compare 127 with 134, no swap is required.
So, the list is already sorted.
In total 5 swaps are required to sort the list using bubble sort.
Option 4 will be the answer.

Computer Science: CUET Mock Test - 7 - Question 37

When will the finally part of try-except-finally be executed?

Detailed Solution for Computer Science: CUET Mock Test - 7 - Question 37
  • The try-except-finally block is used to handle code which might raise an exception.
  • The code which might raise exceptions is placed within the try block.
  • All the probable exceptions are included distinct except blocks. The name of the expected exception is mentioned at the start of the except block.
  • In case the code within the try block leads to exceptions that are not defined or unexpected, we can include an except block which does not specify any particular exception. This block can catch unexpected or undefined errors encountered in the try block.
  • The finally block comes after the try and all the except blocks. This block contains code that should be executed irrespective of whether an exception occurs or not. So, the finally part is always executed.
Computer Science: CUET Mock Test - 7 - Question 38

Consider the following example.

Example:

A University name BITS has maintained the two relations to store the information about the faculty table and Teaches table. The faculty table stores the faculty_id (faculty_id has the unique id of faculty in the whole university) and faculty_name. The Teaches table stores the Course_id, Course_Name, and faculty_id. So the university admin department prints the faculty_name and Course_Name.

How many primary keys are there at the BITS University?

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

Concept:
Attribute:

  • An attribute is a characteristic. In a database management system (DBMS), an attribute refers to a database component, such as a table.
  • It also may refer to a database field. Attributes describe the instances in the column of a database.

Candidate Key:

 A relation can have one or more attributes that take distinct values. Any of these attributes can be used to uniquely identify the tuples in the relation. Such attributes are called candidate keys as each of them are candidates for the primary key.

Primary Key:

Out of one or more candidate keys, the attribute chosen by the database designer to uniquely identify the tuples in a relation is called the primary key of that relation.

Explanation:
From the given data we had two tables which are faculty and Teach.
faculty (faculty_id, faculty_name )
Here faculty_id and faculty_name are attributes.
Here faculty_id is the unique id of faculty in the whole university So it is the primary key in the faculty table.

Example:

Teaches (Course_id, Course_Name, faculty_id )

  • Course_id, Course_Name, and faculty_id are attributes.
  • Here Course_id is the unique id of the course in the whole university So it is the primary key in the teaches table.
  • Here faculty_id is not unique so not be the primary key, candidate key, and super key because a faculty member may teach more than one subject.

Unique attributes are maintaining the BITS University has  faculty_id, faculty_name, Course_id, and Course_Name. Hence it has four unique attributes. 

Example:

Hence there are two primary keys which are faculty_id and Course_id.

Hence the correct answer is B.

Computer Science: CUET Mock Test - 7 - Question 39

Which sorting algorithm the sorted list is traversed from the backward direction to find the position where the unsorted element could be inserted?

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

Insertion Sort is one of the most efficient data sorting methods for small data values. 

In insertion sort, the array will break into 2 parts. The first half is sorted one and the second half is unsorted one. One by one element we have to compare the list of sorted elements with the list of unsorted elements, and if they were found in the wrong order, swap them. 

The name is given to it because We have to insert the unsorted list with the sorted one and do a required number of swapping to get the result. 
Each element in the unsorted list is to be considered one by one and is inserted into the sorted list at its appropriate position, So, The sorted list is traversed from the backward direction to find the position where we can add that unsorted element. 

So, it happens with the insertion sort only, Option 2 turns out to be the correct answer. 

Why options 1, and 3 got eliminated- 
In bubble sort, we take the max element to the end of the list, so the position of an unsorted element doesn't matter. And in selection sort, the array is broken into two parts, the sorted part is empty and the unsorted part is the whole array. So, their list cannot traverse in the backward direction. 

Computer Science: CUET Mock Test - 7 - Question 40

Consider an array has 10 elements and the searching element is at array index 6. A starting element is present at index zero. How many comparisons are required to search an element using linear search?

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

Concept:
Linear search:

A linear search, often known as a sequential search, is a technique for locating an element in a list. It systematically verifies each element of the list until a match is discovered or the entire list has been searched.

Algorithm:
linear_search(int a[], int n, int X)


  for (int i = 0; i < n; i++)  
    {  
        if (a[i] == X)  
        return i+1;  
    } 

}

Explanation:
Worst-case:

In the Linear Search Algorithm, the worst-case scenario happens when the item to be found is at the end of the Array or the element is not present in the array. Hence the linear search compares each element till the end. So it takes maximum time behavior in linear search.

Best case:
The best case in the Linear Search Algorithm happens when the item to be found is at the beginning of the Array.

Average case:
In the Linear Search Algorithm, the average scenario happens when the item to be found is somewhere in the center of the Array.

Explanation:
The given data,
Consider an array has 10 elements and the searching element is at array index 6. A starting element is present at index zero.

Example

A[10]= {12, 5, 8, 56, 12, 7, 10, 15, 85, 105}

Searching element = 10
First searching element 10 compares with index 0 so not found and compares with the next index element. After It continues till index 6 and searching success.
Hence the total number of comparisons are= 7
Hence the correct answer is 7.

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

Up next

Download as PDF

Up next

Download the FREE EduRev App
Track your progress, build streaks, highlight & save important lessons and more!