Aptitude Reasoning English GK Computer Knowledge Programming Skill Banking Software Testing



Question - 1

The process of pickling in Python includes ____________.

  • conversion of a Python object hierarchy into byte stream
  • conversion of a byte stream into Python object hierarchy
  • conversion of a list into a datatable
  • conversion of a datatable into a list
Solutions
Question - 2

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”)
Solutions
Question - 3

Which function overloads the + operator?

  • __add__()
  • __plus__()
  • __sum__()
  • None of these
Solutions
Question - 4

Which operator is overloaded by __invert__()?

  • !
  • ~
  • ^
  • -
Solutions
Question - 5

_____ represents an entity in the real world with its identity and behavior.

  • A method
  • An object
  • A class
  • An operator
Solutions
Question - 6

_____ is used to create an object.

  • class
  • constructor
  • User-defined functions
  • In-built functions
Solutions
Question - 7

What is setattr() used for?

  • To access the attribute of the object
  • To check if an attribute exists or not
  • To delete an attribute
  • To set an attribute
Solutions
Question - 8

class test:
     def __init__(self,a):
         self.a=a
 
     def display(self):
         print(self.a)
obj=test()
obj.display()



What will be the output of the following Python code?

  • Runs normally, doesn’t display anything
  • Displays 0, which is the automatic default value
  • Error as one argument is required while creating the object
  • Error as display function requires additional argument
Solutions
Question - 9

What is Instantiation in terms of OOP terminology?

  • Deleting an instance of class
  • Creating an instance of class
  • Modifying an instance of class
  • Copying an instance of class
Solutions
Question - 10

The assignment of more than one function to a particular operator is _______.

  • Operator over-assignment
  • Operator overriding
  • Operator instance
  • Operator overloading
Solutions
Question - 11

What error will occur when you execute the following code?

MANGO = APPLE

  • NameError
  • SyntaxError
  • TypeError
  • ValueError
Solutions
Question - 12

What will be the output of this program?

print(6 + 5 - 4 * 3 / 2 % 1)

  • 7
  • 7.0
  • 15
  • 11.0
Solutions
Question - 13

Which of the following arithmetic operators cannot be used with strings in python?

  • +
  • *
  • -
  • All of the above
Solutions
Question - 14

Which of the following statements is valid for the "if statement"?

  • if f >= 12:
  • if (f >= 122)
  • if (f => 1222)
  • if f >= 12222
Solutions
Question - 15

Which of the following blocks allows you to test the code blocks for errors?

  • try block
  • except block
  • finally block
  • None of the above
Solutions
Question - 16

Which of the following functions returns a list containing all matches?

  • find
  • findall
  • search
  • None of the above
Solutions
Question - 17

In the Python Programming Language, syntax error is detected by ______ at _________.

  • Interpreter / Compile time
  • Run time / Interpreter
  • Interpreter / Run time
  • Compile time / Run time
Solutions
Question - 18

Which of the following blocks allows you to handle the errors?

  • except block
  • try block
  • finally block
  • None of these
Solutions
Question - 19

word="javatpoint"

print(*word)

What will be the output of this program?

  • javatpoint
  • j a v a t p o i n t
  • *word
  • SyntaxError: invalid syntax
Solutions
Question - 20

What is hasattr(obj,name) used for?

  • To access the attribute of the object
  • To delete an attribute
  • To set an attribute
  • To check if an attribute exists or not
Solutions
Tags:
Python MCQ (Multiple Choice Questions), Advanced Python MCQ, Python MCQ Online test,Python MCQ Questions and answers PDF, Python Interview Questions With Answers, Python Technical Questions with full explanation