Python Practice Test MCQ Certified Go from 0 to Expert hero Set 13

What will be the output of the following Python code?


Options are :

  • 40
  • 45
  • "john"
  • "peter"

Answer :40

What will be the output of the following Python code?


Options are :

  • (1, 2, 1, 2)
  • [1, 2, 1, 2]
  • (1, 1, 2, 2)
  • [1, 1, 2, 2]

Answer :(1, 2, 1, 2)

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 21

What will be the output of the following Python code?


Options are :

  • True
  • False
  • Error
  • None

Answer :False

What will be the output of the following Python code?


Options are :

  • 1
  • 2
  • 5
  • Error

Answer :Error

What will be the output of the following Python code?


Options are :

  • 30
  • 24
  • 33
  • 12

Answer :33

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 17

What is the data type of (1)?


Options are :

  • Tuple
  • Integer
  • List
  • Both tuple and integer

Answer :Integer

If a=(1,2,3,4), a[1:-1] is _________


Options are :

  • Error, tuple slicing doesn't exist
  • [2,3]
  • (2,3,4)
  • (2,3)

Answer :(2,3)

What will be the output of the following Python code?


Options are :

  • True
  • False
  • Error, < operator is not valid for tuples
  • Error, < operator is valid for tuples but not if there are sub-tuples

Answer :False

Python Certification Exam Preparation Set 45

What will be the output of the following Python code?


Options are :

  • ('Check','Check','Check')
  • * Operator not valid for tuples
  • ('CheckCheckCheck')
  • Syntax error

Answer :('CheckCheckCheck')

What will be the output of the following Python code?


Options are :

  • Now, a=(1,2,4)
  • Now, a=(1,3,4)
  • Now a=(3,4)
  • Error as tuple is immutable

Answer :Error as tuple is immutable

What will be the output of the following Python code?


Options are :

  • Too many arguments for sum() method
  • The method sum() doesn't exist for tuples
  • 12
  • 9

Answer :12

Python Certification Exam Preparation Set 42

Is the following Python code valid?


Options are :

  • No because tuple is immutable
  • Yes, first element in the tuple is deleted
  • Yes, the entire tuple is deleted
  • No, invalid syntax for del method

Answer :Yes, the entire tuple is deleted

What type of data is: a=[(1,1),(2,4),(3,9)]?


Options are :

  • Array of tuples
  • List of tuples
  • Tuples of lists
  • Invalid type

Answer :List of tuples

What will be the output of the following Python code?


Options are :

  • Invalid syntax for slicing
  • [0,2]
  • (0,1)
  • (0,2)

Answer :(0,1)

Python Certification Exam Preparation Set 15

. Is the following Python code valid?


Options are :

  • Yes, c will be ((1,2,3),('A','B','C'))
  • Yes, c will be ((1,2,3),('A','B','C'))
  • No because tuples are immutable
  • No because the syntax for zip function isn't valid

Answer :Yes, c will be ((1,2,3),('A','B','C'))

Is the following Python code valid?


Options are :

  • Yes, [1,2,3] is printed
  • No, invalid syntax
  • Yes, (1,2,3) is printed
  • 1 is printed

Answer :Yes, (1,2,3) is printed

What will be the output of the following Python code?


Options are :

  • Error, tuples are immutable
  • (('check',),) ((('check',),),)
  • (('check',)'check',)
  • (('check',)'check',) ((('check',)'check',)'check',)

Answer :(('check',),) ((('check',),),)

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 11

Is the following Python code valid?


Options are :

  • Yes, this is an example of tuple unpacking. a=1 and b=2
  • Yes, this is an example of tuple unpacking. a=(1,2) and b=3
  • No, too many values to unpack
  • Yes, this is an example of tuple unpacking. a=1 and b=(2,3)

Answer :No, too many values to unpack

What will be the output of the following Python code?


Options are :

  • (4,6)
  • (1,2,3,4)
  • Error as tuples are immutable
  • None

Answer :(1,2,3,4)

What will be the output of the following Python code?


Options are :

  • (6,7)
  • Invalid syntax
  • (7,6)
  • Nothing is printed

Answer :(7,6)

Python Certification Exam Preparation Set 38

What will be the output of the following Python code?


Options are :

  • a(i=4, j=7)
  • obj(i=4, j=7)
  • (4,7)
  • An exception is thrown

Answer :a(i=4, j=7)

Tuples can't be made keys of a dictionary.


Options are :

  • True
  • False

Answer :False

Is the following Python code valid?


Options are :

  • Yes, 2 is printed
  • Yes, [2,3,4,5] is printed
  • No, too many values to unpack
  • Yes, (2,3,4,5) is printed

Answer :Yes, (2,3,4,5) is printed

Python Certification Exam Preparation Set 59

What will be the output of the following Python code?


Options are :

  • (1,2,3,5)
  • (2,3,1,5)
  • None
  • Error, tuple has no attribute sort

Answer :Error, tuple has no attribute sort

Is the following Python code valid?


Options are :

  • Yes, a=(1,2,3,4) and b=(1,2,3,4)
  • Yes, a=(1,2,3) and b=(1,2,3,4)
  • No because tuples are immutable
  • No because wrong syntax for update() method

Answer :No because tuples are immutable

What will be the output of the following Python code?


Options are :

  • [(1, 2), (2, 4), (3, 9)]
  • [(2,4),(1,2),(3,9)]
  • Error because tuples are immutable
  • Error, tuple has no sort attribute

Answer :[(1, 2), (2, 4), (3, 9)]

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 17

Which of these about a set is not true?


Options are :

  • Mutable data type
  • Allows duplicate values
  • Data type with unordered values
  • Immutable data type

Answer :Immutable data type

Which of the following is not the correct syntax for creating a set?


Options are :

  • set([[1,2],[3,4]])
  • set([1,2,2,3,4])
  • set((1,2,3,4))
  • {1,2,3,4}

Answer :set([[1,2],[3,4]])

What will be the output of the following Python code?


Options are :

  • 7
  • Error, invalid syntax for formation of set
  • 4
  • 8

Answer :4

Python Certification Exam Preparation Set 18

What will be the output of the following Python code?


Options are :

  • 5 5 6
  • 5 6 7
  • 5 5 6 7 7 7
  • 5 6 7 7 7

Answer :5 5 6 7 7 7

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions