Advertisements

Most Important 100+ Python MCQ Question Answer | O Level M3-R5 Python 100+ MCQ

Q. What is the maximum possible length of an identifier?

a. 16

b. 32

c. 64

d. None of these above

Answer: (d) None of these above

Explanation: The maximum possible length of an identifier is not defined in the python language. It

can be of any number.


Q. Who developed the Python language?

a. Zim Den

b. Guido van Rossum

c. Niene Stom

d. Wick van Rossum

Answer: (b) Guido van Rossum

Explanation: Python language was developed by Guido van Rossum in the Netherlands.


Q. In which year was the Python language developed?

a. 1995

b. 1972

c. 1981

d. 1989

Answer: (d) 1989

Explanation: Python language was developed by Guido van Rossum in 1989.


Q. In which language is Python written?

a. English

b. PHP

c. C

d. All of the above

Answer: (b) C

Explanation: Python is written in C programming language, and it is also called CPython.


Q. Which one of the following is the correct extension of the Python file?

a. .py

b. .python

c. .p

d. None of these

Answer: (a) .py

Explanation: “.py” is the correct extension of the Python file.


Q. In which year was the Python 3.0 version developed?

a. 2008

b. 2000

c. 2010

d. 2005

Answer: (a) 2008

Explanation: Python 3.0 version was developed on December 3, 2008.


Q. What do we use to define a block of code in Python language?

a. Key

b. Brackets

c. Indentation

d. None of these

Answer: (c) Indentation

Explanation: Python uses indentation to define blocks of code. Indentations are simply spaces or tabs used as an indicator that is part of the indent code child. As used in curly braces C, C++, and Java.


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

a. /

b. //

c. #

d. !

Answer: (c) #

Explanation: “#” character is used in Python to make a single-line comment.


Q. Which of the following statements is correct regarding the object-oriented programming concept in Python?

a. Classes are real-world entities while objects are not real

b. Objects are real-world entities while classes are not real

c. Both objects and classes are real-world entities

d. All of the above

Answer: (b) Objects are real-world entities while classes are not real

Explanation: None


Q. Which of the following statements is correct in this python code?

1. class Name:
2. def __init__(javatpoint):
3. javajavatpoint = java
4. name1=Name(“ABC”)
5. name2=name1

a. It will throw the error as multiple references to the same object is not possible

b. id(name1) and id(name2) will have same value

c. Both name1 and name2 will have reference to two different objects of class Name

d. All of the above

Answer: (b) id(name1) and id(name2) will have same value

Explanation: “name1” and “name2” refer to the same object, so id(name1) and id(name2) will have the same value.


Q. What is the method inside the class in python language?

a. Object

b. Function

c. Attribute

d. Argument

Answer: (b) Function

Explanation: Function is also known as the method.


Q. Which of the following declarations is incorrect?

a. _x = 2

b. __x = 3

c. __xyz__ = 5

d. None of these

Answer: (d) None of these

Explanation: All declarations will execute successfully but at the expense of low readability.


Q. Why does the name of local variables start with an underscore discouraged?

a. To identify the variable

b. It confuses the interpreter

c. It indicates a private variable of a class

d. None of these

Answer: (c) It indicates a private variable of a class

Explanation: Since there is no concept of private variables in Python language, the major underscore is used to denote variables that cannot be accessed from outside the class.


Q. Which of the following is not a keyword in Python language?

a. val

b. raise

c. try

d. with

Answer: (a) val

Explanation: “val” is not a keyword in python language.


Q. Which of the following statements is correct for variable names in Python language?

a. All variable names must begin with an underscore.

b. Unlimited length

c. The variable name length is a maximum of 2.

d. All of the above

Answer: (b) Unlimited length

Explanation: None


Q. Which of the following declarations is incorrect in python language?

a. xyzp = 5,000,000

b. x y z p = 5000 6000 7000 8000

c. x,y,z,p = 5000, 6000, 7000, 8000

d. x_y_z_p = 5,000,000

Answer: (b) x y z p = 5000 6000 7000 8000

Explanation: Spaces are not allowed in variable names.


Q. Which of the following words cannot be a variable in python language?

a. _val

b. val

c. try

d. _try_

Answer: (c) try

Explanation: “try” is a keyword.


Q. Which of the following operators is the correct option for power(ab)?

a. a ^ b

b. a**b

c. a ^ ^ b

d. a ^ * b

Answer: (b) a**b

Explanation: The power operator in python is a**b, i.e., 2**3=8.


Q. Which of the following precedence order is correct in Python?

a. Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

b. Multiplication, Division, Addition, Subtraction, Parentheses, Exponential

c. Division, Multiplication, Addition, Subtraction, Parentheses, Exponential

d. Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

Answer: (a) Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

Explanation: PEMDAS (similar to BODMAS).


Q. Which one of the following has the same precedence level?

a. Division, Power, Multiplication, Addition and Subtraction

b. Division and Multiplication

c. Subtraction and Division

d. Power and Division

Answer: (b) Division and Multiplication

Explanation: None


Q. Which one of the following has the highest precedence in the expression?

a. Division

b. Subtraction

c. Power

d. Parentheses

Answer: (d) Parentheses

Explanation: PEMDAS (similar to BODMAS).


Q. Which of the following functions is a built-in function in python language?

a. val()

b. print()

c. print()

d. None of these

Answer: (b) print()

Explanation: The print() function is a built-in function in python language that prints a value directly to the system.


Q. Study the following function:

round(4.576)

What will be the output of this function?

a. 4

b. 5

c. 576

d. 5

Answer: (d) 5

Explanation: The round function is a built-in function in the Python language that round-off the value (like 3.85 is 4), so the output of this function will be 5.


Q. Which of the following is correctly evaluated for this function?

pow(x,y,z)

a. (x**y) / z

b. (x / y) * z

c. (x**y) % z

d. (x / y) / z

Answer: (c) (x**y) % z

Explanation: None


Q. Study the following function:

all([2,4,0,6])

What will be the output of this function?

a. False

b. True

c. 0

d. Invalid code

Answer: (a) False

Explanation: If any element is zero, it returns a false value, and if all elements are non-zero, it returns a true value. Hence, the output of this “all([2,4,0,6])” function will be false.


Q. 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?

a. error

b. 2 1

c. 0 3 1

d. None of these

Answer: (a) error

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


Q. Which one of the following syntaxes is the correct syntax to read from a simple text file stored in

”d:\java.txt”?

a. Infile = open(”d:\\java.txt”, ”r”)

b. Infile = open(file=”d:\\\java.txt”, ”r”)

c. Infile = open(”d:\java.txt”,”r”)

d. Infile = open.file(”d:\\java.txt”,”r”)

Answer: (a) Infile = open(”c:\\scores.txt”, ”r”)

Explanation: None


Q. Study the following code:

x = [‘XX’, ‘YY’]

for i in a:

i.lower()

print(a)

What will be the output of this program?

a. [‘XX’, ‘YY’]

b. [‘xx’, ‘yy’]

c. [XX, yy]

d. None of these

Answer: (a) [‘XX’, ‘YY’]

Explanation: None


Q. Study the following function:

import math

abs(math.sqrt(36))

What will be the output of this code?

a. Error

b. -6

c. 6

d. 6.0

Answer: (d) 6.0

Explanation: This function prints the square of the value.


Q. Study the following function:

any([5>8, 6>3, 3>1])

What will be the output of this code?

a. False

b. Ture

c. Invalid code

d. None of these

Answer: (b) True

Explanation: None


Q. Study the following statement:

>>>”a”+”bc”

What will be the output of this statement?

a. a+bc

b. abc

c. a bc

d. a

Answer: (b) abc

Explanation: In Python, the “+” operator acts as a concatenation operator between two strings.


Q. Study the following code:

>>>”javatpoint”[5:]

What will be the output of this code?

a. javatpoint

b. java

c. point

d. None of these

Answer: (c) point

Explanation: Slice operation is performed on the string.


Q. The output to execute string.ascii_letters can also be obtained from:?

a. character

b. ascii_lowercase_string.digits

c. lowercase_string.upercase

d. ascii_lowercase+string.ascii_upercase

Answer: (d) string.ascii_lowercase+string.ascii_upercase

Explanation: None


Q. Study the following statements:

1.  >>> str1 = “javat”

2.  >>> str2 = “:”

3.  >>> str3 = “point”

4.  >>> str1[-1:]

What will be the output of this statement?

a. t

b. j

c. point

d. java

Answer: (a) t

Explanation: The correct output of this program is “t” because -1 corresponds to the last index.


Q. Study the following code:

>>> print (r”\njavat\npoint”)

What will be the output of this statement?

a. java

point

b. java point

c. \njavat\npoint

d. Print the letter r and then javat and then point

Answer: (c) \njavat\npoint

Explanation: None


Q. Study the following statements:

>>> print(0xA + 0xB + 0xC)

What will be the output of this statement?

a. 33

b. 63

c. 0xA + 0xB + 0xC

d. None of these

Answer: (a) 33

Explanation: A, B and C are hexadecimal integers with values 10, 11 and 12 respectively, so the sum of A, B and C is 33.


Q. Study the following program:

1.  class book:

2.  def __init__(a, b):

3.  a.o1 = b

4.  class child(book):

5. def __init__(a, b):

6. a.o2 = b

7. obj = page(32)

8. print “%d %d” % (obj.o1, obj.o2)

Which of the following is the correct output of this program?

a. 32

b. 32 32

c. 32 None

d. Error is generated

Answer: (d) Error is generated

Explanation: Error is generated because self.o1 was never created.


Q. Study the following program:

1.  class Std_Name:

2.  def __init__(self, Std_firstName, Std_Phn, Std_lastName):

3.  self.Std_firstName = Std_firstName

4.  self. Std_PhnStd_Phn = Std_Phn

5. self. Std_lastNameStd_lastName = Std_lastName

6.

7. Std_firstName = “Wick”

8. name = Std_Name(Std_firstName, ‘F’, “Bob”)

9. Std_firstName = “Ann”

10. name.lastName = “Nick”

11.  print(name.Std_firstName, name.Std_lastName)

Wha t will be the output of this statement?

a.  Ann Bob

b.  Ann Nick

c. Wick Bob

d. Wick Nick

Answer: (d) Wick Nick

Explanation: None


Q. Study the following statements:

>>> print(ord(‘h’) – ord(‘z’))

What will be the output of this statement?

a. 18

b. -18

c. 17

d. -17

Answer: (b) -18

Explanation: ASCII value of h is less than the z. Hence the output of this code is 104-122, which is equal to -18.


Q. Study the following program:

1.  x = [‘xy’, ‘yz’]

2.  for i in a:

3.  i.upper()

4.  print(a)

Which of the following is correct output of this program?

a. [‘xy’, ‘yz’]

b. [‘XY’, ‘YZ’]

c. [None, None]

d. None of these

Answer: (a) [‘xy’, ‘yz’]

Explanation: None


Q. Study the following program:

1.  i = 1:

2.  while True:

3.  if i%3 == 0:

4.  break

5. print(i)

Which of the following is the correct output of this program?

a. 1 2 3

b. 3 2 1

c. 1 2

d. Invalid syntax

Answer: (d) Invalid syntax

Explanation: Invalid syntax, because this declaration (i = 1:) is wrong.


Q. Study the following program:

1.  a = 1

2.  while True:

3.  if a % 7 = = 0:

4.  break

5. print(a)

6. a += 1

Which of the following is correct output of this program?

a. 1 2 3 4 5

b. 1 2 3 4 5 6

c. 1 2 3 4 5 6 7

d. Invalid syntax

Answer: (b) 1 2 3 4 5 6

Explanation: None


Q. Study the following program:

1.  i = 0

2.  while i < 5:

3.  print(i)

4.  i += 1

5. if i == 3:

6. break

7. else:

8. print(0)

What will be the output of this statement?

a. 1 2 3

b. 0 1 2 3

c. 0 1 2

d. 3 2 1

Answer: (c) 0 1 2

Explanation: None


Q. Study the following program:

1.  i = 0

2.  while i < 3:

3.  print(i)

4.  i += 1

5. else:

6. print(0)

What will be the output of this statement?

a. 0 1

b. 0 1 2

c. 0 1 2 0

d. 0 1 2 3

Answer: (c) 0 1 2 0

Explanation: None


Q. Study the following program:

1.  z = “xyz”

2.  j = “j”

3.  while j in z:

4.  print(j, end=” “)

What will be the output of this statement?

a. xyz

b. No output

c. x y z

d. j j j j j j j..

Answer: (b) No output

Explanation: “j” is not in “xyz”.


Q. Study the following program:

1.  x = ‘pqrs’

2.  for i in range(len(x)):

3.  x[i].upper()

4.  print (x)


Q. Which of the following is the correct output of this program?

a. PQRS

b. pqrs

c. qrs

d. None of these

Answer: (b) pqrs

Explanation: None


Q. Study the following program:

1.  d = {0: ‘a’, 1: ‘b’, 2: ‘c’}

2.  for i in d:

3.  print(i)

Wh at will be the output of this statement?

a. a b c

b. 0 1 2

c. 0 a 1 b 2 c

d. None of these above

Answer: (b) 0 1 2

Explanation: None


Q. Study the following program:

1.  d = {0, 1, 2}

2.  for x in d:

3.  print(x)

Wh at will be the output of this statement?

a. {0, 1, 2} {0, 1, 2} {0, 1, 2}

b. 0 1 2

c. Syntax_Error

d. None of these above

Answer: (b) 0 1 2

Explanation: None


Q. Which of the following option is not a core data type in the python language?

a. Dictionary

b. Lists

c. Class

d. All of the above

Answer: (c) Class

Explanation: Class is not a core data type because it is a user-defined data type.


Q. What error will occur when you execute the following code?

MANGO = APPLE

a. NameError

b. SyntaxError

c. TypeError

d. ValueError

Answer: (a) NamaError

Explanation: Mango is not defined hence the name error.


Q. Study the following program:

1.  def example(a):

2.  aa = a + ‘1’

3.  aa = a*1

4.  return a

5. >>>example(“javatpoint”)

What will be the output of this statement?

a. hello2hello2

b. hello2

c. Cannot perform mathematical operation on strings

d. indentationError

Answer: (d) indentationError

Explanation: None


Q. Which of the following data types is shown below?

L = [2, 54, ‘javatpoint’, 5]

What will be the output of this statement?

a. Dictionary

b. Tuple

c. List

d. Stack

Answer: (c) List

Explanation: Any value can be stored in the list data type.


Q. What happens when ‘2’ == 2 is executed?

a. False

b. Ture

c. ValueError occurs

d. TypeError occurs

Answer: (a) False

Explanation: It only evaluates to false.


Q. Study the following program:

1.  try:

2.  if ‘2’ != 2:

3.  raise “JavaTpoint”

4.  else:

5. print(“JavaTpoint has not exist”)

6. except “JavaTpoint”:

7. print (“JavaTpoint has exist”)

What will be the output of this statement?

a. invalid code

b. JavaTpoint has not exist

c. JavaTpoint has exist

d. none of these above

Answer: (a) invalid code

Explanation: A new exception class must inherit from a BaseException, and there is no such inheritance here.


Q. Study the following statement

z = {“x”:0, “y”:1}

Which of the following is the correct statement?

a. x dictionary z is created

b. x and y are the keys of dictionary z

c. 0 and 1 are the values of dictionary z

d. All of the above

Answer: (d) All of the above

Explanation: All of the above statements is correct regarding Python code.

NUMPY :

Question: Correct syntax of the reshape() function in Numpy array python is –

1. array.reshape(shape)

2. reshape(shape,array)

3. reshape(array,shape)

4. reshape(shape)

Answer:3


Question: How we can change the shape of the Numpy array in python?

1. By Shape()

2. By reshape()

3. By ord()

4. By change()

Answer:2


Question: How we can convert the Numpy array to the list in python?

1. list(array)

2. list.array

3. array.list

4. None of the above

Answer:1


Question: How we can find the type of numpy array in python ?

1. dtype

2. type

3. typei

4. itype

Answer:1


Question: How we install Numpy in the system ?

1. install numpy

2. pip install python numpy

3. pip install numpy

4. pip install numpy python

Answer:3


Question: It is possible to convert the Numpy array to list in python ?

1. Yes

2. No

3. Sometimes

4. None of the above

Answer:1


Question: Minimum number of argument to pass in full() function in Numpy array ?

1. 0

2. 1

3. 2

4. 3

Answer:3


Question: Numpy in the Python provides the

1. Function

2. Lambda function

3. Type casting

4. Array

Answer:4


Question: Numpy.array(list), what it does ?

1. It convert array to list

2. It convert list to array

3. It convert array to array

4. Error

Answer:2


Question: Shape() function in Numpy array is used to

1. Find the shape of the array

2. Change the shape of the array

3. Both of the above

4. None of the above

Answer:1

Question: What is the use of the size attribute in Numpy array in python ?

1. It find the direction

2. It find the number of items

3. It find the shape

4. All of the above

Answer:2


Question: what is the use of the zeros() function in Numpy array in python ?

1. To make a Matrix with all element 0

2. To make a Matrix with all diagonal element 0

3. To make a Matrix with first row 0

4. None of the above

Answer:1


Question: Which of the following argument we need to pass in reshape() function?

1. Array

2. Shape

3. only array

4. Both array and shape

Answer:4


Question: Which of the following counts the number of elements in Numpy array ?

1. count()

2. return()

3. shape()

4. size()

Answer:4


Question: Which of the following find the maximum number in the Numpy array ?

1. max(array)

2. array.max()

3. array(max)

4. None of the above

Answer:2


Question: Which of the following is correct way to import the Numpy module in your program ?

1. import numpy

2. import numpy as np

3. from numpy import *

4. All of the above

Answer:4


Question: Which of the following is not valid to import the numpy module ?

1. import numpy as np

2. import numpy as n

3. import numpy as p

4. None of the above

Answer:4


Question: Which of the following is the essential argument to pass in full() function of Numpy array ?

1. shape

2. value

3. Both of the above

4. None of the above

Answer:3


Question: Which of the following is used to convert the list data type to the Numpy array ?

1. array(list)

2. array.list

3. Numpy.array(list)

4. None of the above

Answer:3


Question: Which of the following keyword is used to access the numpy module in python ?

1. access

2. import

3. fetch

4. from

Answer:2


Q. Python pandas was developed by?

A. Guido van Rossum

B. Travis Oliphant

C. Wes McKinney

D. Brendan Eich

Ans : C

Explanation: Pandas is a high-level data manipulation tool developed by Wes McKinney.


Q. What will be output for the following code?

import pandas as pd

s = pd.Series([1,2,3,4,5],index = [‘a’,’b’,’c’,’d’,’e’])

print s[‘a’]

A. 1

B. 2

C. 3

D. 4

Ans : A

Explanation: Retrieve a single element using index label value.


Q. What will be correct syntax for pandas series?

A. pandas_Series( data, index, dtype, copy)

B. pandas.Series( data, index, dtype)

C. pandas.Series( data, index, dtype, copy)

D. pandas_Series( data, index, dtype)

Ans : C

Explanation: A pandas Series can be created using the following constructor : pandas.Series( data, index, dtype, copy)


Q. What will be syntax for pandas dataframe?

A. pandas.DataFrame( data, index, dtype, copy)

B. pandas.DataFrame( data, index, rows, dtype, copy)

C. pandas_DataFrame( data, index, columns, dtype, copy)

D. pandas.DataFrame( data, index, columns, dtype, copy)

Ans : D

Explanation: A pandas DataFrame can be created using the following constructor : pandas.DataFrame( data, index, columns, dtype, copy)


Q. Axis 1, in panel represent?

A. minor_axis

B. major_axis

C. items

D. None of the above

Ans : B

Explanation: major_axis : axis 1, it is the index (rows) of each of the DataFrames.


Q. Which of the following thing can be data in Pandas?

A. a python dict

B. an ndarray

C. a scalar value

D. All of the above

Ans : D

Explanation: The passed index is a list of axis labels.


Q. The ________ project builds on top of pandas and matplotlib to provide easy plotting of data.

A. yhat

B. Seaborn

C. Vincent

D. Pychart

Ans : B

Explanation: Seaborn has great support for pandas data objects.


Q. Why ndim is used?

A. Returns the number of elements in the underlying data.

B. Returns the Series as ndarray.

C. Returns the number of dimensions of the underlying data, by definition 1. 

D. Returns a list of the axis labels 


Ans :  C

Explanation: ndim : Returns the number of dimensions of the underlying data, by definition 1


Q. What will be output for the following code?

import pandas as pd

import numpy as np

s = pd.Series(np.random.randn(2))

print s.size

A. 0

B. 1

C. 2

D. 3

Ans : C

Explanation: size : Returns the size(length) of the series.


Q. Which of the following is false?

A. The integer format tracks only the locations and sizes of blocks of data.

B. Pandas follow the NumPy convention of raising an error when you try to convert something to a

bool.

C. Two kinds of SparseIndex are implemented

D. The integer format keeps an arrays of all of the locations where the data are not equal to the fill

value

Ans : A

Explanation: The block format tracks only the locations and sizes of blocks of data.


Q. SciPy stands for?

A. science library

B. source library

C. significant library

D. scientific library

Ans : D

Explanation: SciPy, a scientific library for Python is an open source, BSD-licensed library for

mathematics, science and engineering.


Q. Which of the following is not correct sub-packages of SciPy?

A. scipy.cluster

B. scipy.source

C. scipy.interpolate

D. scipy.signal

Ans : B

Explanation: scipy.source is not correct sub-packages of SciPy.


Q. Which of the following is true?

A. By default, all the NumPy functions have been available through the SciPy namespace

B. There is no need to import the NumPy functions explicitly, when SciPy is imported.

C. SciPy is built on top of NumPy arrays

D. All of the above

Ans : D

Explanation: All statement are correct.


Q. What will be output for the following code?

import numpy as np

print np.linspace(1. , 4., 6)

A. array([ 1.  , 2.2 , 2.8, 3.4, 4. ])

B. array([ 1.   , 1.  6, 2.8, 3.4, 4. ])

C. array([ 1.    , 1 .  6, 2.2, 2.8, 3.4, 4. ])

D. array([ 1.     , 1.   6, 2.2, 2.8, 4. ])

Ans : C   

Explana  tion: The above program will generate the following output : array([ 1.  , 1. 6, 2.2, 2.8, 3.4, 4. ])

  

 Q. How to import Constants Package in SciPy?

 A. import scipy.constants

B. from scipy.constants

C. import scipy.constants.package

D. from scipy.constants.package

Ans : B

Explanation: from scipy.constants is used.


Q. what is constant defined for Boltzmann constant in SciPy?

A. G

B. e

C. R

D. k

Ans : D

Explanation: k : Boltzmann constant


Q. What will be output for the following code?

from scipy import linalg

import numpy as np

a = np.array([[3, 2, 0], [1, -1, 0], [0, 5, 1]])

b = np.array([2, 4, -1])

x = linalg.solve(a, b)

print x

A. array([ 2., -2., 9., 6.])

B. array([ 2., -2., 9.])

C. array([ 2., -2.])

D. array([ 2., -2., 9., -9.])

Ans : B

Explanation: The above program will generate the following output : array([ 2., -2., 9.])


Q. In SciPy, determinant is computed using?

A. determinant()

B. SciPy.determinant()

C. det()

D. SciPy.det()

Ans : C

Explanation: In SciPy, this is computed using the det() function.


Q. Which of the following is false?

A. scipy.linalg also has some other advanced functions that are not in numpy.linalg

B. SciPy version might be faster depending on how NumPy was installed.

C. Both A and B

D. None of the above

Ans : D

Explanation: Both statement are true.


Q. What relation is consider between Eigen value (lambda), square matrix (A) and Eign vector(v)?

A. Av = lambda*v

B. Av =Constant * lambda*v

C. Av =10 * lambda*v

D. Av != lambda*v

Ans : A

Explanation: We can find the Eigen values (lambda) and the corresponding Eigen vectors (v) of a

square matrix (A) by considering the following relation.


giff


Q. What is true about Machine Learning?

A. Machine Learning (ML) is that field of computer science

B. ML is a type of artificial intelligence that extract patterns out of raw data by using an algorithm

or method.

C. The main focus of ML is to allow computer systems learn from experience without being

explicitly programmed or human intervention.

D. All of the above

Ans : D

Explanation: All statement are true about Machine Learning.


Q. ML is a field of AI consisting of learning algorithms that?

A. Improve their performance

B. At executing some task

C. Over time with experience

D. All of the above

Ans : D

Explanation: ML is a field of AI consisting of learning algorithms that : Improve their performance

(P), At executing some task (T), Over time with experience (E).


Q. p → 0q is not a?

A. hack clause

B. horn clause

C. structural clause

D. system clause

Ans : B

Explanation: p → 0q is not a horn clause.


Q. The action _______ of a robot arm specify to Place block A on block B.

A. STACK(A,B)

B. LIST(A,B)

C. QUEUE(A,B)

D. ARRAY(A,B)

Ans : A

Explanation: The action ‘STACK(A,B)’ of a robot arm specify to Place block A on block B.


Q. A__________ begins by hypothesizing a sentence (the symbol S) and successively predicting

lower level constituents until individual preterminal symbols are written.

A. bottow-up parser

B. top parser

C. top-down parser

D. bottom parser

Ans : C

Explanation: A top-down parser begins by hypothesizing a sentence (the symbol S) and successively predicting lower level constituents until individual preterminal symbols are written.


Q. A model of language consists of the categories which does not include ________.

A. System Unit

B. structural units.

C. data units

D. empirical units

Ans : B

Explanation: A model of language consists of the categories which does not include structural units.


Q. Different learning methods does not include?

A. Introduction

B. Analogy

C. Deduction

D. Memorization

Ans : A

Explanation: Different learning methods does not include the introduction.


Q. The model will be trained with data in one single batch is known as ?

A. Batch learning

B. Offline learning

C. Both A and B

D. None of the above

Ans : C

Explanation: we have end-to-end Machine Learning systems in which we need to train the model in one go by using whole available training data. Such kind of learning method or algorithm is called Batch or Offline learning.


Q. Which of the following are ML methods?

A. based on human supervision

B. supervised Learning

C. semi-reinforcement Learning

D. All of the above

Ans : A

Explanation: The following are various ML methods based on some broad categories : Based on human supervision, Unsupervised Learning, Semi-supervised Learning and Reinforcement Learning


Q. In Model based learning methods, an iterative process takes place on the ML models that are built

based on various model parameters, called ?

A. mini-batches

B. optimizedparameters

C. hyperparameters

D. superparameters

Ans : C

Explanation: In Model based learning methods, an iterative process takes place on the ML models that are built based on various model parameters, called hyperparameters.


Q. Which of the following is a widely used and effective machine learning algorithm based on the

idea of bagging?

A. Decision Tree

B. Regression

C. Classification

D. Random Forest

Ans : D

Explanation: The Radom Forest algorithm builds an ensemble of Decision Trees, mostly trained with the bagging method.


Q. To find the minimum or the maximum of a function, we set the gradient to zero because:

A. The value of the gradient at extrema of a function is always zero

B. Depends on the type of problem

C. Both A and B

D. None of the above

Ans : A

Explanation: The gradient of a multivariable function at a maximum point will be the zero vector of the function, which is the single greatest value that the function can achieve.


Q. Which of the following is a disadvantage of decision trees?

A. Factor analysis

B. Decision trees are robust to outliers

C. Decision trees are prone to be overfit

D. None of the above

Ans : C

Explanation: Allowing a decision tree to split to a granular degree makes decision trees prone to learning every point extremely well to the point of perfect classification that is overfitting.


Q. How do you handle missing or corrupted data in a dataset?

A. Drop missing rows or columns

B. Replace missing values with mean/median/mode

C. Assign a unique category to missing values

D. All of the above

Ans : D

Explanation: All of the above techniques are different ways of imputing the missing values.


Q. When performing regression or classification, which of the following is the correct way to

preprocess the data?

A. Normalize the data -> PCA -> training

B. PCA -> normalize PCA output -> training

C. Normalize the data -> PCA -> normalize PCA output -> training

D. None of the above

Ans : A

Explanation: You need to always normalize the data first. If not, PCA or other techniques that are used to reduce dimensions will give different results.


Q. Which of the following statements about regularization is not correct?

A. Using too large a value of lambda can cause your hypothesis to underfit the data.

B. Using too large a value of lambda can cause your hypothesis to overfit the data

C. Using a very large value of lambda cannot hurt the performance of your hypothesis.

D. None of the above

Ans : D

Explanation: A large value results in a large regularization penalty and therefore, a strong preference for simpler models, which can underfit the data.


Q. Which of the following techniques can not be used for normalization in text mining?

A. Stemming

B. Lemmatization

C. Stop Word Removal

D. None of the above

Ans : C

Explanation: Lemmatization and stemming are the techniques of keyword normalization.

Most Important 100+ Python MCQ Question Answer | O Level M3-R5 Python 100+ MCQ

Q. In which of the following cases will K-means clustering fail to give good results?

1) Data points with outliers

2) Data points with different densities

3) Data points with nonconvex shapes

A. 1 and 2

B. 2 and 3

C. 1 and 3

D. All of the above

Ans : D

Explanation: K-means clustering algorithm fails to give good results when the data contains outliers, the density spread of data points across the data space is different, and the data points follow nonconvex shapes.


Q. Which of the following is a reasonable way to select the number of principal components “k”?

A. Choose k to be the smallest value so that at least 99% of the varinace is retained.

B. Choose k to be 99% of m (k = 0.99*m, rounded to the nearest integer).

C. Choose k to be the largest value so that 99% of the variance is retained.

D. Use the elbow method.

Ans : A

Explanation: This will maintain the structure of the data and also reduce its dimension.


Q. What is a sentence parser typically used for?

A. It is used to parse sentences to check if they are utf-8 compliant.

B. It is used to parse sentences to derive their most likely syntax tree structures.

C. It is used to parse sentences to assign POS tags to all tokens.

D. It is used to check if sentences can be parsed into meaningful tokens.

Ans : B

Explanation: Sentence parsers analyze a sentence and automatically build a syntax tree.

Post a Comment

Please Do not Comment link and spam Comment.

Previous Post Next Post