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

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

Computer Science: CUET Mock Test - 2 for CUET 2024 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 2024 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 | 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 - 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

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

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

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 3

Match List I and List II.

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

(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 4

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

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

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 5

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

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

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 6

Structured Query Language (SQL) is used to

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

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

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

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 8

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 9

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

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

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 10

Python strings are also called the collection of:

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

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 11

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 11

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

Computer Science: CUET Mock Test - 2 - Question 12

What is/are instance(s) of database?

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

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 13

Match List I and List II.

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

(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 14

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

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 14
  • 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 15

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

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

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 16

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 16

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 17

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 17

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 18

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 18

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 19

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 19

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 20

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 20

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

Computer Science: CUET Mock Test - 2 - Question 21

Consider the following relation.
Table: Customers(C_id, C_name, C_age, C_Country)
What is the output for the given SQL Query?
Query:
ALTER TABLE Customers
ADD income INT;
What is the degree of the customer relationship?

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

The correct answer is option B.

Concept:
Add an attribute to an existing table:

Sometimes, we may need to add an additional attribute to a table. It can be done using the syntax given below:

Syntax:
ALTER TABLE table_name ADD attribute_name DATATYPE;

DEGREE:
The number of attributes in a relation is called the Degree of the relation.

Explanation:
The customer relation adds a new attribute to the customer relationship. Now the Customers relation becomes the Customers(C_id, C_name, C_age, C_Country, income)

Query:
ALTER TABLE Customers
ADD income INT;
Hence the degree of the relation becomes 5.
Hence the correct answer is 5.

Computer Science: CUET Mock Test - 2 - Question 22

What is ISP in computer networks?

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

The correct answer is option A.
Concept:
ISP:

An ISP (internet service provider) is a company that provides individuals and organizations access to the internet and other related services.

  • An ISP is also sometimes referred to as an internet access provider.
  • An ISP has the equipment and the telecommunication line access required to have a point of presence on the internet for the geographic area served.
  • ISPs may also provide different internet connection types, such as cable and fiber.
  • Customers may access the internet through ISPs, who also offer other services like email, domain registration, and web hosting.

Hence the correct answer is an Internet service provider.

Computer Science: CUET Mock Test - 2 - Question 23

Which kind of data has been that is not arranged according to a pre-set data model or schema?

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

The correct answer is option B.

Concept:
Data come from different sources, they can be in different formats.

Unstructured Data:
Unstructured data is information that is not arranged according to a pre-set data model or schema, and therefore cannot be stored in a traditional relational database or RDBMS. Text and multimedia are two common types of unstructured content.

Example:
A newspaper contains a variety of news pieces, often known as data. However, a newspaper's placement of news pieces follows no set pattern. On any given day, a page may have three photos of various sizes, five news articles, and one or more adverts. On another day, one large image with three written news pieces may be displayed.

Structured Data:
Data that is organized and can be recorded in a well-defined format is called structured data. Structured data is often kept in a tabular (rows and columns) format on a computer, with each column representing distinct data for a specific parameter called an attribute, characteristic, or variable, and each row representing data from observation for several attributes.

Example:
Data related to an inventory of kitchen items maintained by a shop.

Hence the correct answer is Unstructured Data.

Computer Science: CUET Mock Test - 2 - Question 24

Statement 1: A program cannot be executed until all errors are rectified.
Statement 2: A program cannot be executed until all exceptions are handled.

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

Explanation:

  • In Python, mistakes in the syntax are known as errors. Unless and until the errors are rectified, the program cannot be compiled and executed.
  • Exceptions are those errors which terminate the program abnormally. However, exceptions can only be encountered at runtime. So, a program with exceptions can be executed.

Important Point:

  • Even though a syntax error is a type of exception, but it is different from other exceptions because a program with syntax error cannot be executed.
Computer Science: CUET Mock Test - 2 - Question 25

Consider a list where we have to search for 2 different values using hashing. One of the numbers, ‘a’ is present at index = 3, and the other one, ‘b’ is present at index = 7. How many comparisons will have to be made to search for ‘a’ and ‘b’?

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 25
  • Searching a value at any position in the list, using hashing method, takes exactly one comparison.
  • In hashing method, a hash function is used to arrange the elements of the list according to the index value. A modulus by 10 function is used to determine which element should be placed at which location.
  • The hash function is applied on the target element to find out it’s possible index location. By simply checking the index position, we can conclude whether is element is present or not in the list.
Computer Science: CUET Mock Test - 2 - Question 26

Which of the following is not a digital storage device?

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

The correct answer is option D.
Concept:
Data Storage:

Data storage is the process of storing data on storage devices so that data can be retrieved later. Large amounts of data are being created at an alarming rate these days. As a result, storing data has become a difficult undertaking. However, as the cost of digital storage devices has decreased, this work has become easier.
There are numerous digital storage devices available in the market like,

  • Hard Disk Drive (HDD),
  • Solid State Drive (SSD),
  • CD/DVD,
  • Tape Drive,
  • Pen Drive,
  • Memory Card, etc.

Hence the correct answer is None of the above.

Computer Science: CUET Mock Test - 2 - Question 27

In which case is the NameError exception raised in Python?

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 27
  • When a requested module definition is not found, the ImportError exception is raised.
  • When a keyword or a reserved word is used as a variable name, it leads to a syntax error.
  • When a statement accessed a variable that is not found in the local or global scope, then the program raises a NameError.
  • When a specified file cannot be opened by a program, it causes an exception of IOError type.
Computer Science: CUET Mock Test - 2 - Question 28

Consider the list of data [56, 80, 39, 41, 29, 61] and the hash function h[i] = i % 7 where i is each element of the list. What will be the index value of the element 39?

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 28
  • The hash function is modulo 7. This means, that each element is divided by 7 and the number is positioned at the index equal to the remainder.
  • 39 % 7 = 4 and so the element is located at index position 4.
Computer Science: CUET Mock Test - 2 - Question 29

What will be the output of the following code?

myobject=open("myfile.txt",'r')
myobject.readline(10)
myobject.close()

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 29
  • The readline() function reads the first line until a newline character is found.
  • If an argument is passed to the function, it reads that many characters, but stops when a newline character is encountered.
  • The function can only read the first line.

Important Point:

Even if the value passed to the function exceeds the number of characters till the newline character, the control does not move on to the next line.

Computer Science: CUET Mock Test - 2 - Question 30

Consider a list of 10 elements:
Array = [7, 11, 3, 10, 17, 23, 1, 4, 21, 5]
Determine the partially sorted list after three complete passes of insertion sort, in descending order.

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 30
  • In insertion sort, the first element is considered as the sorted list, and the remaining list is the unsorted part.
  • At each iteration, the first element of the unsorted list is placed into the appropriate position in the sorted list. The checking is done backwards in the sorted list.
  • In the first pass over this list, the element 11 is greater than 7 so it is moved to the left of 7 as the sorting is being done in descending order.
  • The second passes places the value 3 into the sorted list. It remains where it is because 3 is already to the right of 7.
  • In the third pass, 10 is placed between 11 and 7.
Computer Science: CUET Mock Test - 2 - Question 31

The module _________ is used for serializing and de-serializing any Python object structure.

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 31
  • The Pickle module is used for storing any Python object as a byte stream. When required, the byte stream is reconstructed into an object.
  • The dump() and load() are methods of the Pickle module for serializing and de-serializing objects.
Computer Science: CUET Mock Test - 2 - Question 32

Which of the following is not a network device?

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

Concept:
NETWORK DEVICES:

Network devices are to communicate data through different transmission media and to configure networks with different functionality, we require different devices like Modem, Hub, Switch, Repeater, Ethernet Card, Router, Gateway, etc. 

  • Modem stands for ‘MOdulator DEModulator’. It refers to a device used for conversion between analog signals and digital bits. 
  • An Ethernet card, also known as Network Interface Card (NIC card in short) is a network adapter used to set up a wired network. 
  • Repeater data are carried in the form of signals over the cable. These signals can travel a specified distance/

Explanation:

  • Bluetooth is a Personal Area Network formed by connecting a few personal devices like computers, laptops, mobile phones, smartphones, printers, etc., All these devices lie within an approximate range of 10 meters. A personal area network may be wired or wireless.

Hence the correct answer is Bluetooth.

Computer Science: CUET Mock Test - 2 - Question 33

Ethernet and Token ring are types of _______

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

The correct answer is LAN.

  • Ethernet and token rings are types of LAN (Local Area Network). 
  • Token Ring is a computer networking technology used to build LAN. It was introduced by IBM in 1984.
  • Ethernet is a family of wired computer networking technologies commonly used in LAN.
  • It is also used in metropolitan area networks (MAN) and wide area networks (WAN).
  • Ethernet generally uses Bus Topology. 
Computer Science: CUET Mock Test - 2 - Question 34

For a list with n elements, how many passes does the bubble sort make to arrange the list in descending order?

Detailed Solution for Computer Science: CUET Mock Test - 2 - Question 34
  • The algorithm sorts by comparing each element to the element immediately following it.
  • The list needs to be traversed completely for sorting it.
  • The control goes up to the (n-1)th element and checks it with the n-th element.
  • So, the bubble sort makes a total of n-1 passes.
Computer Science: CUET Mock Test - 2 - Question 35

Consider the weight (in kg) of students in a class are as follows [70, 60, 80, 75, 55, 62, 92, 75, 55, 80]. 

What is the Mean or average weight of the class?

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

The correct answer is option C.

Concept:
Mean:

Mean is simply the average of numeric values of an attribute. Mean is also called average.
Definition:
Given n values x1, x2, x3,...xn, mean is compute

Explanation:

The given 10 values are,70, 60, 80, 75, 55, 62, 92, 75, 55, 80 and all students weight are kg.
Mean= (70, 60, 80, 75, 55, 62, 92, 75, 55, 80)/10
Mean= 70.4 kg
Hence the correct answer is 70.4 kg.

Computer Science: CUET Mock Test - 2 - Question 36

Consider a list [-4, 0, 2, 7, 8, 17, 19]. Apply binary search to find element -4. Determine the number of key comparisons required.

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

Explanation:

  • 3 comparisons are required to find the given element.
  • Binary search checks the middle element of a sorted list. Depending on whether the target element is lesser or greater than the middle element, the search continues in the left or right half, respectively.

Important Point:
The dry run for binary search on the given list is as follows:

Computer Science: CUET Mock Test - 2 - Question 37

Consider the following relation.
Table: Customers


Query:
Select *
from Customers
where C_Country =' India';

The number of tuples returned by the above query?

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

The correct answer is option A.

Concept:

WHERE Clause:
The WHERE clause is used to retrieve data that meet some specified conditions. 
Consider the following relation.
Table: Customers


The IN operator is used with the WHERE clause to match values in a C_country like India or USA.
SQL Query:
Select *
from Customers
where C_Country ='Inida';

Output:
The select query prints the complete row of the relationship when the condition is true. So when the C_country is 'India' then Customer relation prints the entire row of the database.

Hence the correct answer is B.

Computer Science: CUET Mock Test - 2 - Question 38

Consider a relation student has Student_id, Student_name, Student_age, Student_Income, Student_address. 

which of the following query is used to display all rows and columns of the relation student?

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

The correct answer is option C.

Concept:

The SELECT statement is used to retrieve data from one or more database tables. SELECT * FROM table_name displays data from all the attributes of that table.

Hence the SQL query  Select * from student; prints all the rows and columns of relation student;

Option A, Option B, and Option D print the only one attribute of the relation student which means it prints the only one column of the relation not all columns.

Hence the correct answer is Select * from student;

Computer Science: CUET Mock Test - 2 - Question 39

Consider a relation student has Student_id, Student_name, Student_age, Student_Income, Student_address. 

Query:
SELECT Student_name AS Name FROM student;

Q. Which of the following option true for a given SQL query?

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

The correct answer is option B.

Concept:
Renaming of columns:

In case we want to rename any column while displaying the output, we can do so by using the alias 'AS' in the query as:

Example:
Display Employee name as Name in the output for all the employees.
mysql> SELECT EName AS Name FROM EMPLOYEE;

Explanation:
The given SQL query is,

Query:
SELECT Student_name AS Name FROM student;
The above is renamed the specific attribute as Student_name. Hence the student relation attribute student_name changes to name.
The database becomes like below,


Hence the correct answer is the Renaming of columns.

Computer Science: CUET Mock Test - 2 - Question 40

Consider a relation student has Student_id, Student_name, Student_age, Student_Income, Student_address. 

Query:
SELECT * FROM Student WHERE NOT Student_name = 'Anne';

Which of the following statement is true for the given query?

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

The correct answer is option A.

Concept:
WHERE Clause:

The WHERE clause is used to retrieve data that meet some specified conditions. 
The logical operators AND, OR, and NOT are used with the WHERE clause to combine multiple conditions.

Query:
SELECT * FROM Student WHERE NOT Student_name = 'Anne';

Explanation:
The given relation student, NOT attribute name and where condition checks the whole relation student and prints the except the student name is 'Anne'. And it prints the output like below.


Hence the correct answer is Displays records of all the Student except Student_name is Anne.

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

Up next

Download as PDF

Up next

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