Fill This Form To Receive Instant Help
Homework answers / question archive / 1 What is the output of the following code : L = ['a','b','c','d'] print ""
1
What is the output of the following code : L = ['a','b','c','d'] print "".join(L)
SELECT THE CORRECT ANSWER
Top of Form
Error
None
abcd
['a','b','c','d']
Bottom of Form
2
To start Python from the command prompt, use the command ________.
SELECT THE CORRECT ANSWER
Top of Form
execute python
python3
run python
Go python
Bottom of Form
3
Which of the following code is correct?
SELECT THE CORRECT ANSWER
Top of Form
print(""Programming is fun"")print(""Python is fun"");
print(""Programming is fun"")print(""Python is fun"")
print(""Programming is fun)print(""Python is fun"")
print"(""Programming is fun)print(""Python is fun"")"
Bottom of Form
4
In Python, a syntax error is detected by the ________ at _________.
SELECT THE CORRECT ANSWER
Top of Form
compiler/at compile time
interpreter/at runtime
compiler/at runtime
interpreter/at compile time
Bottom of Form
5
Which of the following statement prints smith\exam1\test.txt?
SELECT THE CORRECT ANSWER
Top of Form
print("smith\exam1\test.txt")
print("smith\"exam1\""test.txt"")"
print("smith"\exam1"\test.txt")
print("smith\\exam1\\test.txt")
Bottom of Form
6
If a function does not return a value, by default, it returns ___________.
SELECT THE CORRECT ANSWER
Top of Form
None
Int
Double
null
Bottom of Form
7
Consider the following incomplete code: def f(number): # Missing function body print(f(5)) The missing function body should be ________.
SELECT THE CORRECT ANSWER
Top of Form
return "number"
print(number)
print("number")
return number
Bottom of Form
8
What will be displayed by the following code?
x = 1
def f1():
y = x + 2
print(y)
f1()
print(x)
SELECT THE CORRECT ANSWER
Top of Form
1 3
The program has a runtime error because x is not defined.
1 1
3 1
Bottom of Form
9
Which of the following function headers is correct?
SELECT THE CORRECT ANSWER
Top of Form
def f(a = 1, b):
def f(a = 1, b, c = 2):
def f(a = 1, b = 1, c = 2):
def f(a = 1, b = 1, c = 2, d):
Bottom of Form
10
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.pop(1)?
SELECT THE CORRECT ANSWER
Top of Form
[3, 4, 5, 20, 5, 25, 1, 3]
[1, 3, 3, 4, 5, 5, 20, 25]
[3, 5, 20, 5, 25, 1, 3]
[1, 3, 4, 5, 20, 5, 25]
Bottom of Form
11
What is the output of the following program: y = 8 z = lambda x : x * y print (z(6))
SELECT THE CORRECT ANSWER
Top of Form
48
14
64
y is not defined
Bottom of Form
12
What is the output of the following code? a=""hello"" =list((x.upper(),len(x)) for x in a) print(b)
SELECT THE CORRECT ANSWER
Top of Form
[('H', 1), ('E', 1), ('L', 1), ('L', 1), ('O', 1)].
[('HELLO', 5)]
[('H', 5), ('E', 5), ('L', 5), ('L', 5), ('O', 5)].
Syntax error
Bottom of Form
13
What is the output of the function shown below? hex(15)
SELECT THE CORRECT ANSWER
Top of Form
F
0xf
0Xf
0xF
Bottom of Form
14
Which piece of code creates an empty class?
SELECT THE CORRECT ANSWER
Top of Form
class A: return
class A: pass
class A:
You cannot create empty class in python
Bottom of Form
15
What are the methods which begin and end with two underscore characters called?
SELECT THE CORRECT ANSWER
Top of Form
Special Methods
In-Built methods
User-defined methods
Additional methods
Bottom of Form
16
What does print(Test.__name__) display (assuming Test is the name of the class) ?
SELECT THE CORRECT ANSWER
Top of Form
()
Exception is thrown
Test
__main__
Bottom of Form
17
Which type of inheritance is illustrated by the following code? class student{ public: int marks; }; class topper: public student { public: char grade; }; class average{ public: int marks_required; }; class section: public average{ public: char Student_name[10]; }; class overall: public average{ public: int students; };
SELECT THE CORRECT ANSWER
Top of Form
Multiple Inheritance
Hierarchical Inheritance
Multilevel Inheritance
Single Inheritance
Bottom of Form
18
What is the output of the following piece of code when executed in the Python shell? class A: pass class B(A): pass obj=B() isinstance(obj,A)
SELECT THE CORRECT ANSWER
Top of Form
TRUE
Syntax error
FALSE
Invalid method for classes.
Bottom of Form
19
What is the output of the below program? x = 50 def func(): global x print('x is', x) x = 2 print('Changed global x to', x) func() print('Value of x is', x)
SELECT THE CORRECT ANSWER
Top of Form
x is 50 Changed global x to 2 Value of x is 50
x is 50 Changed global x to 2 Value of x is 2
x is 50 Changed global x to 50 Value of x is 50
None of the mentione
Bottom of Form
20
Which of the following is a features of DocString?
SELECT THE CORRECT ANSWER
Top of Form
Provide a convenient way of associating documentation with Python modules, functions, classes, and methods
All functions should have a docstring
Docstrings can be accessed by the __doc__ attribute on objects
All of the mentioned
Bottom of Form
21
Mathematical operations can be performed on a string. State whether true or false.
SELECT THE CORRECT ANSWER
Top of Form
TRUE
FALSE
Bottom of Form
22
Following set of commands are executed in shell, what will be the output? >>>str=""hello"" >>>str[:2] >>>
SELECT THE CORRECT ANSWER
Top of Form
he
lo
olleh
hello
Bottom of Form
23
Carefully observe the given code and give the answer. def example(a): a = a + '2' a = a*2 return a >>>example(""hello"")
SELECT THE CORRECT ANSWER
Top of Form
Indentation error
Cannot perform mathematical operations on strings
hello2
hello2hello2
Bottom of Form
24
What is the output of the following : d = {0: 'a', 1: 'b', 2: 'c'} for x in d.values(): print(d[x])
SELECT THE CORRECT ANSWER
Top of Form
0 1 2
a b c
0 a 1 b 2 c
Causes a key error
Bottom of Form
25
What is the output of the following code: for i in ''.join(reversed(list('abcd'))): print (i)
SELECT THE CORRECT ANSWER
Top of Form
a b c d
d c b a
error
none of the mentioned
Bottom of Form
26
Which of the following is a sequence data type in Python?
SELECT THE CORRECT ANSWER
Top of Form
Long
Float
String
Integer
Bottom of Form
27
Which of the following is a valid list in Python?
SELECT THE CORRECT ANSWER
Top of Form
[ 1,2,3.4]
[1,”a”,6]
[1,[2,3],”s”]
All of the above
Bottom of Form
28
Which of the following is true for data type conversions?
SELECT THE CORRECT ANSWER
Top of Form
Numeric data types can be converted to both tuples and lists
String 1234 can be converted to a numeric data type
Numeric data types can be converted to tuples
Numeric data types can be converted to lists
Bottom of Form
29
Which of the following is required to create a new instance of a class?
SELECT THE CORRECT ANSWER
Top of Form
A constructor
An object
A class
A value returning function
Bottom of Form
30
What are the benefits of functions in Python? Select all that apply.
SELECT THE CORRECT ANSWER(S)
Top of Form
Reducing the duplication of a code
Decomposing complex problems into simpler pieces
Reusing a code
Decreasing modularity
Bottom of Form
31
Which of these shows the correct way of creating an object?
SELECT THE CORRECT ANSWER
Top of Form
Student s = new Student()
s = new Student()
s = Student()
s = Student(s)
Bottom of Form
32
Beautiful Soup library is used for _____.
SELECT THE CORRECT ANSWER
Top of Form
Data wrangling
Web scraping
Plotting
Machine learning
Bottom of Form
33
In hypothesis testing, the proposed model is built on:
SELECT THE CORRECT ANSWER
Top of Form
Entire dataset
Test dataset
Small subset
Training dataset
Bottom of Form
34
Which measure of central tendency is used to catch outliers in the data?
SELECT THE CORRECT ANSWER
Top of Form
Mean
Median
Mode
Variance
Bottom of Form
35
Which of the following is true for statistical analysis? Select all that apply.
SELECT THE CORRECT ANSWER(S)
Top of Form
It is nonscientific
It is based on numbers or statistical values
It is useful in providing complete insight of the data
It is based on generic information
Bottom of Form
36
Which of the following is a limitation of lists?
SELECT THE CORRECT ANSWER
Top of Form
Values cannot be updated in a list
List cannot be iterated
Mathematical operations cannot be applied over the entire list
List cannot hold multiple values of multiple data types
Bottom of Form
37
Which of the following is true for NumPy? Select all that apply.
SELECT THE CORRECT ANSWER(S)
Top of Form
It is the foundational package for mathematical computing in Python
It stores and manipulates data efficiently
It doesn't support multidimensional arrays (ndarray)
It doesn't have tools for reading or writing array-based datasets to disk
Bottom of Form
38
Which of the following methods creates a new array object that looks at the same data?
SELECT THE CORRECT ANSWER
Top of Form
View
Copy
Paste
Deep copy
Bottom of Form
39
Which method is used for label-location indexing by label?
SELECT THE CORRECT ANSWER
Top of Form
iat
iloc
loc
std
Bottom of Form
40
While viewing a dataframe, head() method will _____.
SELECT THE CORRECT ANSWER
Top of Form
Return only the first row
Return only headers or column names of the DataFrame
Return the first five rows of the DataFrame
Throw an exception as it expects parameter(number) in parenthesis
Bottom of Form
41
The result of an operation between unaligned series will have the ________ of the indexes involved.
SELECT THE CORRECT ANSWER
Top of Form
Intersection
Union
Total
None of the above
Bottom of Form
42
Which of the following inputs can be accepted by a DataFrame ?
SELECT THE CORRECT ANSWER
Top of Form
Structured ndarray
Series
DataFrame
All of the above
Bottom of Form
43
Which of the following statements limits both x and y axes to the interval [0, 6]?
SELECT THE CORRECT ANSWER
Top of Form
plt.xlim(0, 6)
plt.ylim(0, 6)
plt.xylim(0, 6)
plt.axis([0, 6, 0, 6])
Bottom of Form
44
Which of the following is used to display plots on the Jupyter notebook?
SELECT THE CORRECT ANSWER
Top of Form
%matplot inline
%matplotlib inline
import matplotlib
import matplotlib.pyplot
Bottom of Form
45
Which parameter should you use to change a plot's transparency?
SELECT THE CORRECT ANSWER
Top of Form
style=
linestyle=
color=
alpha=
Bottom of Form
46
How can you change the default plot size?
SELECT THE CORRECT ANSWER
Top of Form
plt.rcParam['figure.figsize'] = (w, h)
Set 'figure.figsize' in .matplotlibrc file
Both A and B
Can't change the default plot size
Bottom of Form
47
Identify a feature of bell curve. Select all that apply.
SELECT THE CORRECT ANSWER(S)
Top of Form
More dense in the tails
Less dense in the tails
Symmetric around the mean
Less dense in the center
Bottom of Form
48
p-value in hypothesis testing is:
SELECT THE CORRECT ANSWER
Top of Form
Negative when there is Type I error
Only depends on the alternative hypothesis
Only depends on the null hypothesis
The probability of observing extreme values
Bottom of Form
49
In the context of statistical distributions, what does mesokurtic mean?
SELECT THE CORRECT ANSWER
Top of Form
Negative kurtosis
Positive kurtosis
Normal distribution
Partial distribution
Bottom of Form
50
Which of the following machine learning algorithms is used for dimensionality reduction ?
SELECT THE CORRECT ANSWER
Top of Form
PCA
Hierarchical clustering
K-means clustering
Logistic regression
Bottom of Form
51
What is specifying the number of clusters required for?
SELECT THE CORRECT ANSWER
Top of Form
Affinity propagation
K-means clustering
Hierarchical clustering
PCA
Bottom of Form
52
Which of the following is an unsupervised learning technique?
SELECT THE CORRECT ANSWER
Top of Form
Linear regression
Logistic regression
PCA
SVM
Bottom of Form
53
In machine learning, an estimator is a(n):
SELECT THE CORRECT ANSWER
Top of Form
Instance of the model
Predict method
Method for pipeline
Method to fit the data into model
Bottom of Form
54
What is used for dimensionality reduction?
SELECT THE CORRECT ANSWER
Top of Form
Affinity propagation
K-means clustering
PCA
SVM
Bottom of Form
55
In statistics, a Type II error occurs when:
SELECT THE CORRECT ANSWER
Top of Form
A null hypothesis is rejected but should not be rejected
A null hypothesis is not rejected but should be rejected
A test statistic is incorrect
A hypothesis is chosen incorrectly
Bottom of Form
Already member? Sign In