Python Certification Exam Preparation Set 14

4. Choose the correct output of the following code:-


Options are :

  • [2.7, 'PythonJava', False]
  • Error as a string value can not be concatenated with a boolean value (Correct)
  • [2.7, 'PythonJava', True]
  • Error as tuples are immutable

Answer :Error as a string value can not be concatenated with a boolean value

Python Certification Exam Preparation Set 55

5. Which among the following are the wrong ways to create a variable in python?


Options are :

  • True = 3 (Correct)
  • import math math = 3
  • and = 3 (Correct)
  • None = 3 (Correct)

Answer :True = 3 and = 3 None = 3

6. Choose the correct output of the following code:-

print(None + None)


Options are :

  • None
  • Error (Correct)
  • Code will work fine but does not print anything

Answer :Error

7. Choose the correct number of static, local or instance variables in the below code:-


Options are :

  • static: 1, local : 2, instance : 2
  • static: 3, local : 0, instance : 2
  • static: 1, local : 0, instance : 4
  • static: 1, local : 4, instance : 0
  • static: 1, local : 2, instance : 2
  • static: 1, local : 4, instance : 2 (Correct)

Answer :static: 1, local : 4, instance : 2

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

8. What will be printed on the console after executing the below code:-


Options are :

  • 25.65 25
  • 25 25
  • 25.65 Error (Correct)
  • Error as both int() and float() can not take string value

Answer :25.65 Error

9.The output of the following code:-


Options are :

  • An error arises due to list2[3][1] = 0000 and list2[1] = 0000
  • [10, 0, 30, ['A', 0, 'C']] [10, 20, 30, ['A', 0, 'C']] [10, 0, 30, ['A', 'B', 'C']]
  • [10, 0, 30, ['A', 0, 'C']] [10, 20, 30, ['A', 0, 'C']] [10, 20, 30, ['A', 'B', 'C']] (Correct)
  • [10, 0, 30, ['A', 0, 'C']] [10, 0, 30, ['A', 0, 'C']] [10, 0, 30, ['A', 0, 'C']]

Answer :[10, 0, 30, ['A', 0, 'C']] [10, 20, 30, ['A', 0, 'C']] [10, 20, 30, ['A', 'B', 'C']]

10. Choose the correct output of the following code:-


Options are :

  • 0 1 2 3 Python (Correct)
  • 0 1 2 3
  • 0 2 Python
  • Python

Answer :0 1 2 3 Python

Python Certification Exam Preparation Set 62

11. Fill in the blank in the below code, So that the brand: ford will be printed successfully.


Options are :

  • __init__(brand) (Correct)
  • __init__()
  • __init__(self) (Correct)
  • init(self)

Answer :__init__(brand) __init__(self)

12. Fill in the blank, So that the below code will print Bella .


Options are :

  • obj.call_me() (Correct)
  • obj.call_me("Bella")
  • Pet.call_me("Bella") (Correct)
  • Pet.call_me()

Answer :obj.call_me() Pet.call_me("Bella")

13. Choose the correct output of the following code:-


Options are :

  • Everything went wrong End of Code
  • Something went wrong End of Code (Correct)
  • The code raises a Syntax error due to the use of except NameError: twice.
  • Something went wrong

Answer :Something went wrong End of Code

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

14. Choose the correct output of the following code:-


Options are :

  • {1,2,3,4,2,3,4,4}
  • {1,2,3,4}
  • Error (Correct)

Answer :Error

15. The output of the following code:-


Options are :

  • 8 10 5
  • 10 11 5
  • The error will be raised due to missing argument
  • at 0x0000014719AF4840> # acctual address may differ at 0x0000014719F257B8> at 0x0000014719F25730> (Correct)

Answer : at 0x0000014719AF4840> # acctual address may differ at 0x0000014719F257B8> at 0x0000014719F25730>

16. Choose the correct output of the following code:-


Options are :

  • {1, 2, 3, 4} Error (Correct)
  • {1, 2, 3, 4} {1, 2, 3, 4, 6, 8}
  • {1, 2, 3, 4} {1, 2, 3, 4}
  • {1, 2, 3, 4} {1, 2, 3, 4 ,1 , 2 ,3 ,4 ,6 , 8 }

Answer :{1, 2, 3, 4} Error

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

17. Which among the following code is used for writing into a file in binary format?


Options are :

  • file = open("sys.txt",'rb+') file.write(b'Welcome to python programming') file.close() (Correct)
  • file = open("sys.txt",'wb+') file.write(b'Welcome to python programming') file.close() (Correct)
  • file = open("sys.txt",'wb') file.write(b'Welcome to python programming') file.close() (Correct)
  • file = open("sys.txt",'b') file.write(b'Welcome to python programming') file.close()
  • file = open("sys.txt",'w') file.write(b'Welcome to python programming') file.close()

Answer :file = open("sys.txt",'rb+') file.write(b'Welcome to python programming') file.close() file = open("sys.txt",'wb+') file.write(b'Welcome to python programming') file.close() file = open("sys.txt",'wb') file.write(b'Welcome to python programming') file.close()

18. Which among the following print statement will print a boolean value true or false?


Options are :

  • print(None == None) (Correct)
  • print(None != None) (Correct)
  • print(None >= None)
  • print(None > None)

Answer :print(None == None) print(None != None)

19. Choose the correct output of the following code:-


Options are :

  • 39
  • 87 (Correct)
  • 102
  • Error as a tuple can not be used as a key in a dictionary.

Answer :87

Python Certification Exam Preparation Set 31

20. Choose the correct output of the following code:-


Options are :

  • True (Correct)
  • Error
  • False

Answer :True

21. Choose the correct output of the following code:-


Options are :

  • ['f', 'e', 'd', 'a', 'b', 'c']
  • ['a', 'b', 'c', 'd', 'e', 'f']
  • Error
  • ['f', 'e', 'd', 'c', 'b', 'a'] (Correct)

Answer :['f', 'e', 'd', 'c', 'b', 'a']

22. Choose the correct output of the following:-


Options are :

  • p : 48 q : 42 r : 5 s : 28
  • p : 48 q : (45, 39) r : 5 s : 30 (Correct)
  • p : 48 q : 42 r : 5 s : 30
  • Error

Answer :p : 48 q : (45, 39) r : 5 s : 30

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

23. Which among the following is the first line in the output:-


Options are :

  • 0
  • 5
  • 1 (Correct)
  • 4

Answer :1

24.The output of the following code:-


Options are :

  • {1.0, 3.0}
  • {1, 3}
  • {1.0, 3} (Correct)
  • {1, 3.0}
  • {1.0,1,3,3.0}

Answer :{1.0, 3}

25. Choose the correct output of the following code:-


Options are :

  • if
  • elif (Correct)
  • else
  • Error

Answer :elif

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

26.Fill in the blank, for the output of the below code to be 97 98 99 100 .


Options are :

  • chr(T[i])
  • int(T[i])
  • ord(T[i]) (Correct)
  • char(T[i])

Answer :ord(T[i])

27. Choose the correct output of the following code:-


Options are :

  • 234567
  • Error (Correct)
  • 1245
  • 2345

Answer :Error

28. Choose the correct output of the following code:-


Options are :

  • pYhToNpYtOhN
  • PyhtonPYTOHN
  • Pyhtonpytohn
  • pyhtonPYTOHN (Correct)

Answer :pyhtonPYTOHN

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

29. Choose the correct statement regarding python default Overriding and Overloading.


Options are :

  • Overriding is possible in python (Correct)
  • Overloading is possible in python
  • Both the options are correct

Answer :Overriding is possible in python

30. Fill in the blank, So that the below code will print In A.


Options are :

  • x(self)
  • x()
  • __x(self,a) (Correct)
  • _x(self,a) (Correct)

Answer :__x(self,a) _x(self,a)

31. Choose the correct output of the following code:-


Options are :

  • Name: Audi Price: 4000
  • Name: BMW Price: 4000 (Correct)
  • Name: Audi Price: 2000
  • Name: BMW Price: 2000

Answer :Name: BMW Price: 4000

Python Certification Exam Preparation Set 60

32.Choose the correct statement regarding the below code:-


Options are :

  • ['Audi', 'BMW'] can not be used as a key in a dictionary. (Correct)
  • {'Audi', 'BMW'} can not be used as a key in a dictionary. (Correct)
  • {'Audi':1, 'BMW':2} can not be used as a key in a dictionary. (Correct)
  • ['Price : 2000' , 'Year : 1958'] can not be used as a value in a dictionary.
  • {'Price : 2000' , 'Year : 1958'} can not be used as a value in a dictionary.
  • {'Price' : 2000 , 'Year' : 1958} can not be used as a value in a dictionary.

Answer :['Audi', 'BMW'] can not be used as a key in a dictionary. {'Audi', 'BMW'} can not be used as a key in a dictionary. {'Audi':1, 'BMW':2} can not be used as a key in a dictionary.

33. Choose the correct output of the following code:-


Options are :

  • [24, 27 , 34, 'list_1', 48] [24, 'LIST_2', 34, 89 , 48]
  • [24, 'LIST_2', 34, 'list_1', 48] [24, 'LIST_2', 34, 'list_1', 48] (Correct)
  • [24, 'LIST_2', 34, 89, 48] [24, 27, 34, 'list_1', 48]
  • [24, 'list_1', 34, 'LIST_2', 48] [24, 'list_1', 34, 'LIST_2', 48]

Answer :[24, 'LIST_2', 34, 'list_1', 48] [24, 'LIST_2', 34, 'list_1', 48]

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions