Python/Python Mcq Set 6 Sample Test,Sample questions

Question:
 What will be the output of the following Python code?

print("abcdef".center(10, '12'))

1. 12abcdef12

2. abcdef1212

3.1212abcdef

4.error


Question:
 What will be the output of the following Python code?

print("Hello {1} and {0}".format('bin', 'foo'))

1.Hello foo and bin

2.Hello bin and foo

3. Error

4.none of the mentioned


Question:
 What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('xyy', -10, -1))

1.2

2. 0

3. 1

4.error


Question:
hat will be the output of the following Python code snippet?

print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12))

1.The sum of 2 and 10 is 12

2. The sum of 10 and a is 14

3.The sum of 10 and a is c

4.Error


Question:
What is the default value of encoding in encode()?

1.ascii

2.qwerty

3.utf-8

4.utf-16


Question:
What will be the output of the following Python code snippet?

print('	'.isspace())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print(''''''.isspace())

1.True

2. False

3.None

4. Error


Question:
What will be the output of the following Python code snippet?

print(''.isdigit())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('0xa'.isdigit())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('1.1'.isnumeric())

1. True

2.False

3. None

4.Error


Question:
What will be the output of the following Python code snippet?

print('11'.isnumeric())

1. True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('1@ a'.isprintable())

1. True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('a@ 1,'.islower())

1.True

2.False

3.None

4. error


Question:
What will be the output of the following Python code snippet?

print('abc'.islower())

1. True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('for'.isidentifier())

1.True

2.False

3.None

4. Error


Question:
What will be the output of the following Python code snippet?

print('HelloWorld'.istitle())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('my_string'.isidentifier())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('The sum of {0} and {1} is {2}'.format(2, 10, 12))

1.The sum of 2 and 10 is 12

2.Error

3.The sum of 0 and 1 is 2

4.none of the mentioned


Question:
What will be the output of the following Python code snippet?

print('__foo__'.isidentifier())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code snippet?

print('{:#}'.format(1112223334))

1.1,112,223,334

2.111,222,333,4

3. 1112223334

4. 1112223334


Question:
What will be the output of the following Python code snippet?

print('{:$}'.format(1112223334))

1. 1,112,223,334

2. 111,222,333,4

3.1112223334

4.error


Question:
What will be the output of the following Python code snippet?

print('{:,}'.format('1112223334'))

1.1,112,223,334

2. 111,222,333,4

3.1112223334

4. error


Question:
What will be the output of the following Python code snippet?

print('{:,}'.format(1112223334))

1. 1,112,223,334

2. 111,222,333,4

3.1112223334

4.error


Question:
What will be the output of the following Python code?

print('a B'.isalpha())

1.True

2.False

3. None

4.Error


Question:
What will be the output of the following Python code?

print('ab'.isalpha())

1.True

2.False

3.None

4.Error


Question:
What will be the output of the following Python code?

print('ab,12'.isalnum())

1. True

2.False

3.None

4.error


Question:
What will be the output of the following Python code?

print('ab12'.isalnum())

1.True

2. False

3.None

4.error


Question:
What will be the output of the following Python code?

print('abc'.encode())

1.abc

2. ‘abc’

3.b’abc’

4.h’abc’


Question:
What will be the output of the following Python code?

print('{0:.2}'.format(1/3))

1. 0.333333

2.0.33

3.0.333333:.2

4.Error


Question:
What will be the output of the following Python code?

print("ab	cd	ef".expandtabs('+'))

1. ab+cd+ef

2. ab++++++++cd++++++++ef

3.ab cd ef

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("ab	cd	ef".expandtabs())

1. ab  cd  ef

2.abcdef

3.ab cd ef

4.ab cd ef


Question:
What will be the output of the following Python code?

print("ab	cd	ef".expandtabs(4))

1.ab  cd  ef

2.abcdef

3.ab cd ef

4.ab cd ef


Question:
What will be the output of the following Python code?

print("abcdef".center(7, '1'))

1.1abcdef

2. abcdef1

3. abcdef

4. error


Question:
What will be the output of the following Python code?

print("abcdef".center(7, 1))

1.1abcdef

2.abcdef1

3. abcdef

4.error


Question:
What will be the output of the following Python code?

print("abcdef".find("cd") == "cd" in "abcdef")

1.True

2. False

3.Error

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("abcdef".find("cd"))

1.True

2.2

3. 3

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("ccdcddcd".find("c"))

1.4

2. 0

3.Error

4.True


Question:
What will be the output of the following Python code?

print("Hello {0!r} and {0!s}".format('foo', 'bin'))

1.Hello foo and foo

2.Hello ‘foo’ and foo

3.Hello foo and ‘bin’

4.Error


Question:
What will be the output of the following Python code?

print("Hello {0} and {1}".format('foo', 'bin'))

1.Hello foo and bin

2. Hello {0} and {1} foo bin

3. Error

4.Hello 0 and 1


Question:
What will be the output of the following Python code?

print("Hello {0} and {1}".format(('foo', 'bin')))

1. Hello foo and bin

2. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)

3. Error

4.None of the mentioned


Question:
What will be the output of the following Python code?

print("Hello {name1} and {name2}".format('foo', 'bin'))

1. Hello foo and bin

2. Hello {name1} and {name2}

3. Error

4.Hello and


Question:
What will be the output of the following Python code?

print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))

1.Hello foo and bin

2.Hello {name1} and {name2}

3.Error

4. Hello and


Question:
What will be the output of the following Python code?

print("Hello {} and {}".format('foo', 'bin'))

1. Hello foo and bin

2.Hello {} and {}

3.Error

4. Hello and


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('xyy', 0, 100))

1.2

2.0

3.1

4. error


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('xyy', 2, 11))

1. 2

2.0

3.1

4.error


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('yy'))

1. 2

2. 0

3.error

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('yy', 1))

1. 2

2. 0

3. 1

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".count('yy', 2))

1. 2

2.0

3.1

4.none of the mentioned


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".endswith("xyy"))

1. 1

2.True

3.3

4. 2


Question:
What will be the output of the following Python code?

print("xyyzxyzxzxyy".endswith("xyy", 0, 2))

1. 0

2. 1

3.True

4.False


More MCQS

  1. Python MCQS - Function
  2. Python MCQS - GUI in python
  3. Python MCQS - Operators
  4. Python MCQS - Data type in python
  5. Python MCQS - loops in python
  6. Python MCQS - Numpy
  7. Python MCQS - sqlite3
  8. Python MCQS - Library
  9. Python MCQS - Pandas
  10. Python MCQs
  11. Dictionary Python MCQ set 1
  12. Dictionary Python MCQ set 2
  13. MCQ For Python Fundamentals
  14. MCQ Introduction to Python Section 1
  15. MCQ Introduction to Python Section 2
  16. MCQ Introduction to Python Section 3
  17. MCQ on Flow of Control in Python Set 1
  18. MCQ on Flow of Control in Python Set 2
  19. MCQ on Python String Set 1
  20. File Handling in Python section 1
  21. File Handling in Python section 2
  22. Python Functions MCQS Set 1
  23. Python Functions MCQS Set 2
  24. MCQ on List in Python
  25. Pandas MCQ Questions Set 1
  26. Pandas MCQ Questions Set 2
  27. Tuple MCQ in Python
  28. Python dataframe MCQ
  29. Python Mcq Set 1
  30. Python Mcq Set 2
  31. Python Mcq Set 3
  32. Python Mcq Set 4
  33. Python Mcq Set 5
  34. Python Mcq Set 6
  35. Python Mcq Set 7
  36. Python Mcq Set 8
  37. Python Mcq Set 9
  38. Python Mcq Set 10
  39. Python Mcq Set 11
  40. Python Mcq Set 12
  41. Python Mcq Set 13
  42. Python Mcq Set 14
  43. Python Mcq Set 15
  44. Python Mcq Set 16
  45. Python Mcq Set 17
  46. Python Mcq Set 18
  47. Python Mcq Set 19
  48. Python Mcq Set 20
  49. Python Mcq Set 21
  50. Python MCQ
  51. Python MCQ Questions with Answer
  52. Python Practice Papers
  53. python mcq question and answer
  54. Test
Learn Python Mcq Set 6,Learn Python Objetive choice questions and answers,Python Multiple choice questions and answers,Python objective, Python questions , Python answers,Python MCQs questions and answer
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!