Font size
WorksheetsPYTHON-QUIZ-2023
Total questions: 17
Worksheet time: 8mins
USN
NAME
To open a file c:\scores.txt for reading, we use _____________
infile = open(“c:\scores.txt”, “r”)
infile = open(“c:\\scores.txt”, “r”)
infile = open(file = “c:\scores.txt”, “r”)
infile = open(file = “c:\\scores.txt”, “r”)
1. To read the entire remaining contents of the file as a string from a file object infile, we use ____________
infile.read(2)
infile.readline()i
infile.read()
infile.readlines()
The readlines() method returns (a)
The character * is used in ________.
Insert Query
Delete query
Select Query
All of the above
Python DB-API is
Is a Python module
connectivity modules
is used to access
Specification for database SQLite database
None of these
What is a cursor in the context of database programming?
It is an indicator showing the current position for user interaction on a computer monitor.
It acts as a handle for a given SQL query using which records are traversed.
It stores the list of rows in a table.
None of these
The ________ function returns its argument with a modified shape, whereas the ________ method modifies the array itself.
reshape, resize
resize, reshape
resize, resize
all of the mentioned.
To create sequences of numbers, NumPy provides a function __________ analogous to range that returns arrays instead of lists.
arange
aspace
aline
all of the mentioned
Which of the following function stacks 1D arrays as columns into a 2D array?
row_stack
column_stack
com_stack
all of the mentioned
ndarray.dataitemSize is the buffer containing the actual elements of the array.
True
False
What will be printed?
import numpy as np
a = np.array([1,2,3,5,8])
b = np.array([0,3,4,2,1])
c = a + b
c = c*a
print (c[2])
7
12
10
21
What will be output for the following code?
0
1
2
3
What will be output for the following code?
10
3
5
45
Which of the following statement is false?
ndarray is also known as the axis array.
ndarray.dataitemSize is the buffer containing
the actual elements of the array.
NumPy main object is the homogeneous
multidimensional array
In Numpy, dimensions are called axes
What will be output for the following code?
1
2
3
4
