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

Computer Science: CUET Mock Test - 5 - CUET MCQ


Test Description

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

Computer Science: CUET Mock Test - 5 for CUET 2024 is part of CUET Mock Test Series preparation. The Computer Science: CUET Mock Test - 5 questions and answers have been prepared according to the CUET exam syllabus.The Computer Science: CUET Mock Test - 5 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 - 5 below.
Solutions of Computer Science: CUET Mock Test - 5 questions in English are available as part of our CUET Mock Test Series for CUET & Computer Science: CUET Mock Test - 5 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 - 5 | 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 - 5 - Question 1

Which character is used in Python to make a single line comment?

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

In Python, we use the hash symbol # to write a single-line comment.

Computer Science: CUET Mock Test - 5 - Question 2

Which of the following is the correct extension of the Python file?

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

" .py " is the correct extension of the Python file.
.PY file is a program or script written in Python, which is an interpreted object-oriented programming language. It may be written in a text editor and may be edited, but it must be run using a Python interpreter. .PY files are often used to program web servers and other administrative computer systems.

Computer Science: CUET Mock Test - 5 - Question 3

Two statements are given below, one is Assertion (A) and the other is Reason (R). Read the statements carefully and choose the correct answer.

Assertion (A): Linear search is an efficient searching algorithm for large arrays.
Reason (R): Linear search has a time complexity of O(n).

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

Linear search has a time complexity of O(n), which means that it takes linear time to search an array. This makes it inefficient for large arrays, as the time taken to search the array grows linearly with the size of the array. Therefore, whether linear search is a simple and easy-to-implement algorithm, it is not efficient for large arrays.

Computer Science: CUET Mock Test - 5 - Question 4

Which language is used to access and manipulate databases?

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

SQL stands for Structured Query Language. It lets you access and manipulate databases and became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987.

Computer Science: CUET Mock Test - 5 - Question 5

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

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

Primary key is a key that uniquely identifies each record in a table.
Foreign key is used to establish a relationship between two tables.
Candidate key can be used as a primary key and is unique for each record.
Composite key is composed of two or more columns and is used to uniquely identify each record in a table.

Computer Science: CUET Mock Test - 5 - Question 6

A node that forwards data packets from one network to their destination in another network is called:

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

A router is a networking device that forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet. Data sent through the internet, such as a web page or email, is in the form of data packets.

Computer Science: CUET Mock Test - 5 - Question 7

Which of the following options can be used to read the first line of a text file Myfile.txt?

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

The 'readline()' function can be used to read the first line of a text file Myfile. txt. Hence, the correct answer is option 3.

Computer Science: CUET Mock Test - 5 - Question 8

If we want to add more contents in an existing file, file must be opened in............mode.

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

The "a" mode allows you to open a file to append some content to it. If we want to add a new line to it, we can open it using the "a" mode (append) and then, call the write() method, passing the content that we want to append as argument.

Computer Science: CUET Mock Test - 5 - Question 9

Two statements are given below:

Statement I: ALTER TABLE statement is used to add a new column to an existing table in SQL.
Statement II: INSERT Row statement is used to insert the Row to an existing table in SQL.

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

ALTER TABLE statement is used to add a new column to an existing table in SQL. INSERT ROW statement is not used to insert the Row to an existing table in SQL. INSERT INTO is used to insert the Row.

Computer Science: CUET Mock Test - 5 - Question 10

It is possible to create a loop using goto statement in python?

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

No, Python does not support labels and goto. It's a (highly) structured programming language.

Computer Science: CUET Mock Test - 5 - Question 11

What will be the output of following Python code?

str1="Information"
print(str1[2:8])

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

Concept of slicing is used in this question. In string slicing, the output is the substring starting from the first given index position i.e. 2 to one less than the second given index position i.e. (8 - 1 = 7) of the given string str1. Hence, the output will be "format".

Computer Science: CUET Mock Test - 5 - Question 12

The process of identifying a slot for the second and further items in the hash table in the event of collision, is called _______.

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

The process of identifying a slot for the second and further items in the hash table in the event of collision, is called collision resolution.

Computer Science: CUET Mock Test - 5 - Question 13

Which of the following is/are the advantage(s) of a database management system?

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

Yes, All (1), (2) and (3) are the advantages of a database management system.

Computer Science: CUET Mock Test - 5 - Question 14

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

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

The binary heap data structure takes O(n) time to build, and the repeated extraction and placement operations take O(log n) time. Hence, the total worst-case time complexity of Heap Sort is O(n log n).

  • Selection Sort: O(n2) - This occurs when the array is in reverse sorted order or any other order, as the algorithm has to traverse the entire array to find the minimum element repeatedly.
  • Radix Sort: O(nk), where n is the size of the array and k is the number of digits in the largest number.
  • Count Sort: O(n+k), where n is the number of elements to be sorted, and k is the range of input values.
Computer Science: CUET Mock Test - 5 - Question 15

What is the output of the following if statement

a, b = 12, 5
if a + b:
print('True')
else:
print('False')

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

In Python, any non-zero value is considered True. So, it will evaluate to true.

Computer Science: CUET Mock Test - 5 - Question 16

Your teacher has given you a method/function FilterWords() in python which read lines from a text file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks so that the code would run to find desired result. Do the needful with the following python code:

def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5

FilterWords()

Q. Write the mode of opening the file in Statement-1.

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

r mode is used to open the file.
'NewsLetter.TXT'. It opens a file in reading mode.

Computer Science: CUET Mock Test - 5 - Question 17

Your teacher has given you a method/function FilterWords() in python which read lines from a text file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks so that the code would run to find desired result. Do the needful with the following python code:

def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5

FilterWords()

Q. Fill in the blank in Statement-3 to read data word by word.

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

line.split( ) method fits the blank in Statement-3 to read data word by word.

Computer Science: CUET Mock Test - 5 - Question 18

Your teacher has given you a method/function FilterWords() in python which read lines from a text file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks so that the code would run to find desired result. Do the needful with the following python code:

def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5

FilterWords()

Q. Fill in the blank in Statement-5 to close the file.

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

file.close( ) is used to close the file. It is important to close the file as soon as you have finished your work with the file.

Computer Science: CUET Mock Test - 5 - Question 19

Your teacher has given you a method/function FilterWords() in python which read lines from a text file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks so that the code would run to find desired result. Do the needful with the following python code:

def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5

FilterWords()

Q. Fill in the blank in Statement-2 to read the data from the file.

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

file.read( ) is fits the blank in Statement-2 as this method returns a string containing all characters in a file.

Computer Science: CUET Mock Test - 5 - Question 20

Your teacher has given you a method/function FilterWords() in python which read lines from a text file NewsLetter.TXT, and display those words, which are lesser than 4 characters. Your teachers intentionally kept few blanks in between the code and asked you to fill the blanks so that the code would run to find desired result. Do the needful with the following python code:

def FilterWords():
c=0
file=open('NewsLetter.TXT', '_____') #Statement-1
line = file._____ #Statement-2
word = _____ #Statement-3
for c in word:
if _____: #Statement-4
print(c)
_________ #Statement-5

FilterWords()

Q. Fill in the blank in Statement-4, which displays the word having lesser than 4 characters.

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

len(c)<4 is used fits the blank in Statement-4, which displays the word having lesser than 4 characters.

Computer Science: CUET Mock Test - 5 - Question 21

Bandwidth of a channel can be described as:

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

Concept:
The range of frequencies available for data transmission is known as Bandwidth. It is also the amount of data that can be transmitted in a fixed amount of time.

  • The bandwidth of digital equipment is commonly measured in bits per second or bytes per second. The bandwidth of analog devices is measured in cycles per second, or HZ.
  • Digital bandwidth, or simply bandwidth, is the quantity of data that can be transported from one point to another in a given length of time in computer networks and computer science.
  • The range of frequencies filled by a modulated radio-frequency signal is known as bandwidth in electronics, and it is commonly expressed in hertz or as a percentage of the radio frequency.
  • The effective bandwidth multiplied by the frequency reuse factor equals the channel bandwidth, where the effective bandwidth is the operating bandwidth correctly scaled by the uplink/downlink ratio.
  • The main distinction between the two is that frequency refers to the rate at which a radio signal sends and receives communication signals, whereas bandwidth refers to the difference between the signal's highest and lowest frequencies.
Computer Science: CUET Mock Test - 5 - Question 22

Which of the following is not an SQL command?

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

SQL commands are just that: commands. It's used to send and receive data from the database. It can also be used to carry out specific activities, functions, and data queries.

Here are some commands that come under DDL:

  • CREATE
  • ALTER
  • DROP
  • TRUNCATE
Computer Science: CUET Mock Test - 5 - Question 23

Which technique is used to restore a database up to the last consistent state after a system failure?
A. Backup
B. Recovery

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

In the event of a failure, database recovery is the process of restoring the database to a correct (consistent) state.

Three states of database recovery:

  • Pre-condition: At any given point in time the database is in a consistent state.
  • Condition: Occurs the same kind of system failure.
  • Post-condition: Restore the database to the consistent state that existed before the failure.
Computer Science: CUET Mock Test - 5 - Question 24

What will be the output for the following python code statements, respectively?

print("Hello world")
print('Hello world')
print('\"Hello world')

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

The correct answer is option 3.

Concept:
print() method:

The print() method outputs the message supplied to the screen or another standard output device. The message can be a string or any other object, which will be transformed into a string before being displayed on the screen.

Syntax:
print(object(s), sep=separator, end=end, file=file, flush=flush)

Explanation:
The given python code is,
print("Hello world"):
The print function prints the data which are there in double-quotes and give the output is Hello world.
print('Hello world'):
The print function prints the data which are there in single quotes and gives the output is Hello world. And python accepts either double quotes or single quotes.
print('\"Hello world'):
The print function prints the data which are there in single quotes and gives the output as "Hello world. \ back ward slash emits after the single or double quotes in the print function.
Hence the correct answer is 
Hello world
Hello world
"Hello world

Computer Science: CUET Mock Test - 5 - Question 25

Consider the following python program with the given list a=[5,2,9,8,16,3,1] as input. What does the following program do?

#consider stack is already implemented for you and has predefined pop and push method.

s=stack()  

for item in a:

        if item%2 != 0:

                s.push(item)

max=0

while( len(s)>0 ):

        temp=s.pop()

        if max<temp:

                max=temp

print(max)

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

The correct option is ​Prints the largest odd number in the stack = 9

CONCEPT:
Stack is a data structure that follows last in first out order for insertion and deletion of items.
The insertion and deletion of items take place from one end only using the top pointer.

EXPLANATION:
In the above program, items of the list "a" are pushed into stack "s" if they satisfied the if condition i.e. item%2 !=0. 
Which will push only odd items of the list onto stack "s".
The content in the stack will be as follows:


Stack "s"
Now items of the stack are popped one by one in the while loop (till the stack has some item in it) and compared with the max variable 
#iteration 1 : temp = s.pop() = 1
                     here max < temp, Thus new max = 1.
#iteration 2 : temp = s.pop() = 3
                     here max < temp, Thus new max = 3.
#iteration 3 : temp = s.pop() = 9
                     here max < temp, Thus new max = 9.
#iteration 4 : temp = s.pop() = 5
                     here max > temp, Thus if block does not executes 
Hence max = 9.
The final value of max = 9 will be printed in the end which is the largest odd number in the stack = 9.

Computer Science: CUET Mock Test - 5 - Question 26

Which chart element is utilized to identify data series by its color patterns?

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

The correct answer is option D.

Concept: 
Legend chart element is utilized to identify data series by their color patterns. Legend depicts the colors, patterns, or symbols assigned to the data series. It helps to differentiate the data.
A legend is a portion that describes the graph's components. There is a method in the matplotlib package called legend() that is used to place a legend on the axes. The property Loc in legend() is used to indicate the legend's placement. loc="best" is the default value (upper left).

Syntax:
matplotlib.pyplot.legend([“blue”, “green”], bbox_to_anchor=(0.75, 1.15), ncol=2)
Hence the correct answer is Legend.

Computer Science: CUET Mock Test - 5 - Question 27

Which of the following is the correct syntax to define Series?

Detailed Solution for Computer Science: CUET Mock Test - 5 - Question 27
  • Series() is a function of the Pandas library that can be used for creating a series.
  • A function is always used with the dot(.) operator. We cannot use hyphen(-) to use a function of a library.
  • Pandas is a library, and not a function by itself. Hence it cannot be followed by a set of round brackets.
  • Pandas does not contain any sub-library and the Series() function is directly included in the Pandas library.
Computer Science: CUET Mock Test - 5 - Question 28

 The given array is a = {7,8,9,6,5}. The number of iterations in selection sort and bubble sort respectively are __________.

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

The selection sort algorithm sorts an array by repeatedly finding the minimum element from the unsorted part and putting it at the beginning.So, Every pass 1 swap minimum is required.
The selection sort is good for swapping purposes.

According to the question , the array is {7,8,9,6,5}
Applying selection sort :
1st pass - 5 {7,8,9,6} 
2nd pass - 5, 6 {7,8,9} 

3rd pass - 5, 6, 7 {8,9}

4th pass - 5,6,7,8 {9} ( array sorted)
So, we need 4 passes/iterations to sort the array using selection sort.


Bubble sort work by the principle of finding the max element from the array and pushing it to the end.
Applying bubble sort on {7,8,9,6,5}
1st pass- {7,8,6,5} 9 
2nd pass - {7,6,5}  8, 9
3rd pass- {6,5} 7, 8, 9
4th pass - {5} 6, 7, 8, 9 ( array sorted )
So, we need 4 passes to sort the array using bubble sort.
Both selection and bubble sort takes (n-1) passes / iteration to sort the array. 

Computer Science: CUET Mock Test - 5 - Question 29

How many passes are required for sorting 8 elements list using bubble sort?

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

Bubble Sort is one of the simplest sorting algorithms which works by repeatedly swapping the adjacent elements if they are in the wrong order.
The logic of working- Greatest element of the list will be at the end after the 1st pass.
Compare with the neighbors, if greater then swap it.
Let's take a simple example to understand it better.
Example:
No. of element = 8(70,25,10,75,80,85,90,15)
1st pass - {70,25,10,75,80,85,15} 90 = 7 comparison
2nd pass - {70,25,10,75,80,15} 85,90 = 6 comparison 
3rd pass - {70,25,10,75,15} 80,85,90 = 5 comparison
4th pass- {70,25,10,15}75,80,85,90= 4 comparison
5th pass- {25,10,15}70,75,80,85,90 = 3 comparison
6th pass- {10,15}25,70,75,80,85,90= 2 comparison
7th pass- {10}15,25,70,75,80,85,90 = 1 comparison  (Element list sorted)

So, we need 7 pass to sort 8 element list by bubble sort.(option 4)
FORMULA-  if the number of an element is n, then we need (n-1) passes to sort the element list. 

Computer Science: CUET Mock Test - 5 - Question 30

Which of the following is the correct function to delete a file in python?

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

The correct answer is option C.

Concept:
remove() method:

remove() method in Python can be used to remove files and the os. rmdir() method can be used to delete an empty folder. The shutil.rmtree() method can be used to delete a folder along with all of its files.
This function accepts a single input, which should be a string with the path to the file to be deleted.
If the specified file doesn’t exist a FileNotFoundError error is thrown. If the given path points to a directory, it will throw an IsADirectoryError error.
Example:
Remove the file "testbook.txt":
import os
os.remove("testbook.txt")

Example:
Remove a file from some specific folder is "c:\temp\testboo\python\myfolder":
import os
os.rmdir("c:\temp\testboo\python\myfolder")
Hence the correct answer is remove('file_path').

Computer Science: CUET Mock Test - 5 - Question 31

What is an exception?

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

Concept:
A Python object that describes an error is called an exception. When a Python script throws an exception, it must address it quickly, or else it will terminate and quit.

  • An exception is an error that occurs during program execution. When an error occurs, Python throws an exception that can be handled. It essentially stops the software from crashing.
  • An exception is defined as an unexpected circumstance in a programme that causes the program's flow to be interrupted.
  • There are mainly three kinds of distinguishable errors in Python: syntax errors, exceptions, and logical errors.

Hence the correct answer is an object.

Computer Science: CUET Mock Test - 5 - Question 32

Which of the following is used to create web pages?

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

Web Page:

  • It is a document created for the World Wide Web which can be accessed through a web browser.
  • It can contain information including text, graphics, audio, video and hyperlinks.
  • A collection of linked web pages is known as a website.
  • A Uniform Resource Locator (URL) is associated with each web page.
  • A web page can be accessed either by clicking a hyperlink or entering a URL in the browser.
  • Static web pages are written using markup languages like the HyperText Markup Language.
  • The HyperText Markup Language or HTML is the standard markup language for documents designed to be displayed in a web browser. 

​Hence, it can be concluded from the given points that HTML is used to create web pages.

Computer Science: CUET Mock Test - 5 - Question 33

Which of the following option is correct ?

import pandas as pd
ds1 = pd.Series([2, 4, 6, 8, 10])
ds2 = pd.Series([1, 3, 5, 7, 9])
ds = ds1 + ds2
print(ds)
ds = ds1 - ds2
print(ds)
ds = ds1 * ds2
print(ds)
ds = ds1 / ds2
print(ds)

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

The correct answer is option B.

Concept:
Step 1:

The given two Series are,
ds1 = pd.Series([2, 4, 6, 8, 10])
ds2 = pd.Series([1, 3, 5, 7, 9])
The two series like,
0 2  1
1 4  3
2 6   5
3 8  7 
4 10 9
Here ds1 and ds2 are  series that perform the arithmetic operations like, 

Step 2:
Addition, subtract, multiple, and divide two Pandas Series.
The output like,
Add two Series:
0     3
1     7 
2    11
3    15
4    19 
Subtract two Series:
0    1
1    1
2    1
3    1
4    1                                                   
Multiply two Series:                                                   
0     2
1    12
2    30
3    56
4    90
Divide Series1 by Series2:                                             
0    2.000000                                                          
1    1.333333                                                          
2    1.200000                                                          
3    1.142857                                                          
4    1.111111  
Hence the correct answer is the Pandas program to add, subtract, multiple, and divide two Pandas Series.

Computer Science: CUET Mock Test - 5 - Question 34

Any algorithm that has a loop (usually 1 to n) will have the time complexity as ______.

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

Time Complexity is the amount of time taken to run a program. 
So, when it comes to programs, generally, loops contribute more to the time complexity, the rest of the operation takes constant time to execute.
In the Algorithm, we have to ignore small time complexity always compared to bigger time complexity, 
Let's take an example to understand it 
Program - 
main()
{   i=1 
     while (i<=n)
            {   
                  i = i+20 
             }
}

in this loop every time i increment by a constant 20, so, we need to ignore the constant 20 here, actually, the time complexity of this code is n/20, but it can be expressed as 1/20 * n, as 1/20 is a constant number, then we have to take only n in this case. 
So, any algorithm which has a loop of 1 to n ( above case example ) will have time complexity as n. ( option 2)


Why option 1 got eliminated - n^2 is exponential time complexity, it will not come with a single loop from 1 to n, if we have 2 inner loop in which the outer loop runs for n time and the inner loop also run n time along with the outer loop, then time complexity will be n^2. 

Why options 3 and 4 got eliminated - option 3 cannot be the time complexity, n/2 can be expressed as 1/2*n, as 1/2 is a constant, so, it's the same as n.
option 4 will come in the case of multiplying or dividing n every time by 2. 

Computer Science: CUET Mock Test - 5 - Question 35

If the arithmetic mean of 7, 5, 13, x and 9 be 10, then the value of x is

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

Given
7, 5, 13, x,  and 9
Formula used
Average = Sum of all observation /Number of observation
Calculation
Average = (7 + 5 + 13 + x + 9)/5
⇒ 10 = (34 + x)/5
⇒ 50 - 34 = x
⇒ 16 = x
∴ Value of x is 16.

Computer Science: CUET Mock Test - 5 - Question 36

A ___________ is a request to a database to obtain information in the desired way.

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

Concept:
A query is a request to a database to obtain information in the desired way. The query can be made to get data from one table or from a combination of tables. For example, " finds names of all those students present on attendance date 20001-01-02" is a query to the database.

  • The SQL statement SELECT is used to retrieve data from the tables in a database and is also called a query statement.
  • This data may be generated as results returned by Structured Query Language (SQL) or as pictorials, graphs or complex results, and trend analyses from data-mining tools.
  • One of several different query languages may be used to perform a range of simple to complex database queries.
  • The query database feature is equal to the necessity of data storage capability.
Computer Science: CUET Mock Test - 5 - Question 37

Which of the following is the correct syntax to remove a primary key from the table?

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

The correct answer is option D
ALTER TABLE table_name DROP PRIMARY KEY;
Concept:
In SQL, we can drop a primary key using the ALTER TABLE statement.
Syntax:
ALTER TABLE table_name DROP PRIMARY KEY;
Example,
ALTER TABLE suppliers DROP PRIMARY KEY;
In this example, we have dropped the primary key on the supplier's table. We do not need to specify the name of the primary key as there can only be one primary key on a table.

Computer Science: CUET Mock Test - 5 - Question 38

What is the output of the following code?

def date(x):
    if x<1 or x>31:
        raise ValueError("Invalid Value")
    print(x)
date(0)

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

The correct answer is option C.

Concept:
The given python code is,
def date(x):
    if x<1 or x>31:
        raise ValueError("Invalid Value")
    print(x)
date(0)
Explanation:
When a function has some formal parameters Python allows the different types:

  • sending an integer string representation into an int
  • float is passed a string representation of a float.
  • converting a string representation of an integer to a float
  • converting a float to an int
  • converting an integer to a float

However, if we send a string representation of a float into an int or a string representation of anything other than an integer, we receive a ValueError (including an empty string). If we wish to send a float string representation to an int.
The given program has the same issue so the python compiler raises the issue ValueError: Invalid Value.

Hence the correct answer is ValueError: Invalid Value.

Computer Science: CUET Mock Test - 5 - Question 39

Which function is for saving a DataFrame to a text or CSV file?

Detailed Solution for Computer Science: CUET Mock Test - 5 - Question 39
  • The to_csv() is the only function that can be used for converting a DataFrame to a CSV file.
  • The convert_csv(), from_DataFrame() and csv() are not valid functions in Python DataFrames.
Computer Science: CUET Mock Test - 5 - Question 40

The general format of plotting a DataFrame is ________________.

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

The correct answer is option C.
Concept:
Plotting can be performed in pandas by using the “.plot()” function. This function directly creates the plot for the dataset. Pandas generate diagrams with the plot() function.
To show the diagram on the screen, we may use Pyplot, a submodule of the Matplotlib package.

Syntax:
plot(kind='scatter',x= 'some_column',y='some_colum',color='somecolor' )
Hence the general format of plotting a DataFrame is df.plot(kind = ' ')

Example: Here data.csv has some rows and columns with data.
df.plot(kind = 'scatter' x = 'math_marks', y = 'physics_marks', color = 'red')
plt.title('ScatterPlot')
plt.show()

Hence the correct answer is df.plot(kind = ' ')

8 docs|148 tests
Information about Computer Science: CUET Mock Test - 5 Page
In this test you can find the Exam questions for Computer Science: CUET Mock Test - 5 solved & explained in the simplest way possible. Besides giving Questions and answers for Computer Science: CUET Mock Test - 5, 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!