PYCHARM QUIZ DESCRIPTION

Which of the following is a feature of Python DocString in PyCharm?

  • In Python all functions should have a docstring
     

  •  Docstrings can be accessed by the __doc__ attribute on objects
     

  •  It provides a convenient way of associating documentation with Python modules, functions, classes, and methods
     

  • All of the mentioned

Which of the following is not a core data type in Python programming in PyCharm?

  • Tuples
     

  •  Lists
     

  • Class
     

  • Dictionary

 What will be the output of the following Python expression in PyCharm?
round(4.576)

  •  4
     

  •  4.6
     

  •  5
     

  • 4.5

In PyCharm, the process of pickling in Python includes ____________

  • conversion of a Python object hierarchy into byte stream
     

  • conversion of a datatable into a list
     

  • conversion of a byte stream into Python object hierarchy
     

  •  conversion of a list into a datatable

 

What will be the output of the following Python code snippet in PyCharm?

X=”hi”
print(“05d”%X)

  • 00000hi
     

  •  000hi
     

  •  hi000
     

  •  error

What will be the output of the following Python code snippet in PyCharm?
z=set('abc$de')
'a' in z

  • Error
     

  • True
     

  • False
     

  • No output

 

What will be the output of the following Python statement in PyCharm?

"a"+"bc"

  • bc
     

  • abc
     

  •  a
     

  •  bca

What will be the output of the following Python code in Pycharm?
class tester:
   def __init__(self, id):
       self.id = str(id)
       id="224"
 temp = tester(12)
print(temp.id)

  • 12
     

  •  224
     

  • None
     

  •  Error

Which of the following functions is a built-in function in PyCharm?

  • factorial()
     

  •  print()
     

  •  seed()
     

  •  sqrt()

What will be the output of the following Python code snippet in PyCharm?
X=”watch-ing”
print(“%56s”,X)

  • 56 blank spaces before watch-ing
     

  •  56 blank spaces before watch and ing
     

  •  56 blank spaces after watch-ing
     

  •  no change

What will be the output of the following Python function if the random module has already been imported in PyCharm?
random.randint(3.5,7)

  • Error
     

  • Any integer between 3.5 and 7, including 7
     

  •  Any integer between 3.5 and 7, excluding 7
     

  •  The integer closest to the mean of 3.5 and 7

What will be the output of the following Python expression if the value of x is 34 in PyCharm?
print(“%f”%x)

  • 34.00
     

  •  34.0000
     

  •  34.000000
     

  •  34.00000000

In PyCharm, which of the following Python statements will result in the output: 6?
A = [[1, 2, 3],
     [4, 5, 6],
     [7, 8, 9]]

  • A[2][1]
     

  • A[1][2]
     

  •  A[3][2]
     

  •  A[2][3]

What arithmetic operators cannot be used with strings in PyCharm?

  • *
     

  •  –
     

  • +
     

  • All of the mentioned

What does pip stand for in PyCharm?

  • unlimited length
     

  •  all private members must have leading and trailing underscores
     

  •  Preferred Installer Program
     

  • none of the mentioned

Which of the following is true for variable names in PyCharm?

  • underscore and ampersand are the only two special characters allowed
     

  • unlimited length
     

  •  all private members must have leading and trailing underscores
     

  • none of the mentioned

What will be the output of the following PyCharm function?
len(["hello",2, 4, 6])

  • Error

  • 6

  • 4

  • 3

Which of the following formatting options can be used in order to add ‘n’ blank spaces after a given string ‘S’ in PyCharm?

  • print(“-ns”%S)
     

  •  print(“-ns”%S)
     

  •  print(“%ns”%S)
     

  •  print(“%-ns”%S)

What will be the output of the following PyCharm code snippet?
for i in [1, 2, 3, 4][::-1]:
print (i)

  • 4 3 2 1
     

  •  error
     

  •  1 2 3 4
     

  •  none of the mentioned

In PyCharm,which one of the following is not a keyword in Python language?

  • pass
     

  • eval
     

  •  assert
     

  •  nonlocal

To add a new element to a list we use which Python command in PyCharm?

  • list1.addEnd(5)
     

  •  list1.addLast(5)
     

  •  list1.append(5)
     

  •  list1.add(5)

In PyCharm, what will be the output of the following Python expression if x=456?
print("%-06d"%x)

  • 000456
     

  • 456000
     

  •  456
     

  •  error

What will be the output of the following Python code snippet if x=1 in PyCharm?
x<<2

  • 4

  • 2

  • 1

  • 8

What will be the output of the following Python code in PyCharm?
random.seed(3)
random.randint(1,5)
2
random.seed(3)
random.randint(1,5)

  • 3
     

  • 2
     

  •  Any integer between 1 and 5, including 1 and 5
     

  •  Any integer between 1 and 5, excluding 1 and 5

In PyCharm, what will be the output of the following Python code?
print('*', "abcde".center(6), '*', sep='')

  •  * abcde *
     

  •  *abcde *
     

  •  * abcde*
     

  •  * abcde *

In PyCharm, which one of the following is the use of function in python?

  • Functions don’t provide better modularity for your application
     

  • you can’t also create your own functions
     

  •  Functions are reusable pieces of programs
     

  •  All of the mentioned

Which of the following is the use of id() function in PyCharm?

  • Every object in Python doesn’t have a unique id
     

  •  In Python Id function returns the identity of the object
     

  •  None of the mentioned
     

  •  All of the mentioned

PyCharm supports the creation of anonymous functions at runtime, using a construct called __________

  • pi
     

  •  anonymous
     

  • lambda
     

  •  none of the mentioned

In PyCharm, what will be the output of the following Python expression if x=22.19?
print("%5.2f"%x)

  •  22.1900
     

  •  22.00000
     

  •  22.19
     

  • 22.20

 In PyCharm, which of the following statements is used to create an empty set in Python?

  • ( )
     

  • [ ]
     

  •  { }
     

  •  set()