Python Certification Exam Preparation Set 23

13. Which among the following store the machine code into a file.


Options are :

  • Interpreter
  • Compiler (Correct)

Answer :Compiler

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

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


Options are :

  • 100
  • 110
  • Error (Correct)
  • None of the above

Answer :Error

15. Which among the following code will print I'm learning Python .


Options are :

  • print("I'm learning Python") (Correct)
  • print('''I'm learning Python''') (Correct)
  • print('I\'m learning Python') (Correct)
  • print('I'm learning Python')

Answer :print("I'm learning Python") print('''I'm learning Python''') print('I\'m learning Python')

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


Options are :

  • Even Odd Odd Even Odd Odd Even Odd Odd (Correct)
  • Even Odd Even Odd Even Odd
  • Even Even Even
  • Error

Answer :Even Odd Odd Even Odd Odd Even Odd Odd

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

17. Which among the following code will raise an error?


Options are :

  • speed = 200 def get_speed(): return speed print(get_speed())
  • def get_speed(): return speed speed = 200 print(get_speed())
  • def get_speed(): return speed print(get_speed()) speed = 200 (Correct)
  • Both options B and C will raise an error.

Answer :def get_speed(): return speed print(get_speed()) speed = 200

18. Choose the correct statements from the following.


Options are :

  • A module is nothing but a normal python file with a .py extension. (Correct)
  • A folder containing an empty __init__.py file and the files with .py extension is called a package. (Correct)
  • A folder containing files with the .py extension is called a package.
  • A folder containing files with the .py extension is called a module.

Answer :A module is nothing but a normal python file with a .py extension. A folder containing an empty __init__.py file and the files with .py extension is called a package.

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


Options are :

  • 100
  • Error (Correct)
  • None

Answer :Error

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

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


Options are :

  • 5.4
  • 5.36 (Correct)
  • Error
  • 5

Answer :5.36

22.If sys.txt file contains the 3 lines, 1st line (Welcome), 2nd line (To Python), 3rd line(Programming) what will be the output of following code:-


Options are :

  • Welcome Welcome Welcome
  • Welcome To Python Programming
  • Welcome To Python Programming (Correct)
  • WelcomeTo PythonProgramming

Answer :Welcome To Python Programming

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


Options are :

  • Create a word file.
  • Create a word file but corrupt. (Correct)
  • Error while running code.
  • Create a txt file

Answer :Create a word file but corrupt.

Python Certification Exam Preparation Set 20

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


Options are :

  • Number: 4.24 Number: 4.2457 (Correct)
  • Number: 4.25 Number: 4.2457
  • Number: 4.24 Number: 4.2456
  • Number: 4.2 Number: 4.24

Answer :Number: 4.24 Number: 4.2457

25. Which among the following code will print PCAP Certification:-


Options are :

  • x = '123' d = {x:'PCAP Certification'} print(d[x]) (Correct)
  • x = (1,2,3) d = {x:'PCAP Certification'} print(d[x]) (Correct)
  • x = [1,2,3] d = {x:'PCAP Certification'} print(d[x])
  • x = {1,2,3} d = {x:'PCAP Certification'} print(d[x])
  • x = {1:1,2:2,3:3} d = {x:'PCAP Certification'} print(d[x])
  • x = (1,2,{3}) d = {x:'PCAP Certification'} print(d[x])

Answer :x = '123' d = {x:'PCAP Certification'} print(d[x]) x = (1,2,3) d = {x:'PCAP Certification'} print(d[x])

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


Options are :

  • Checking Start AssertionError AssertionError AssertionError AssertionError Checking End
  • Checking Start AssertionError AssertionError AssertionError Checking End
  • Checking Start Checking End (Correct)
  • Syntax Error

Answer :Checking Start Checking End

Python Certification Exam Preparation Set 23

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


Options are :

  • 1/0
  • Default except
  • ZeroDivisionError except
  • ZeroDivisionError except Code End
  • Error (Correct)

Answer :Error

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


Options are :

  • SyntaxError (Correct)
  • 5Java
  • Java5
  • JavaJavaJavaJavaJava

Answer :SyntaxError

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


Options are :

  • 54560
  • 43562 (Correct)
  • Emma
  • Reference of the Employee class will be printed

Answer :43562

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

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


Options are :

  • Amount left is: 60 Enter amount less than or equal to 60 (Correct)
  • Enter amount less than or equal to 100
  • SyntaxError
  • TypeError

Answer :Amount left is: 60 Enter amount less than or equal to 60

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


Options are :

  • a: 5 b: 7 a: 3 b: 1 Reduce 1: 16 Reduce 2: 5
  • a: 5 b: 7 a: 12 b: 3 a: 15 b: 1 Reduce 1: 16 Reduce 2: 5 (Correct)
  • An error will be raised at the line lambda x,y : Add(x,y)
  • An error will be raised at the line print ("Reduce 2: ",functools.reduce(lambda x,y : Add(x,y),lis))

Answer :a: 5 b: 7 a: 12 b: 3 a: 15 b: 1 Reduce 1: 16 Reduce 2: 5

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


Options are :

  • Type is :
  • Type is :
  • Type is : (Correct)
  • Type is :

Answer :Type is :

Python Certification Exam Preparation Set 9

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


Options are :

  • ['AUDI', 'BMW', 'TESLA']
  • Error
  • ['Audi', 'Bmw', 'Tesla']
  • ['audi', 'bmw', 'tesla'] (Correct)

Answer :['audi', 'bmw', 'tesla']

36. Which among the following code will print Python .


Options are :

  • lang = ['Java','Python','Php','JavaScript'] print(lang[1]) (Correct)
  • lang = ['Java','Python','Php','JavaScript'] print(lang[0:1])
  • lang = ['Java','Python','Php','JavaScript'] print(lang[1:2])
  • lang = ['Java','Python','Php','JavaScript'] print(lang[-4:-3])
  • lang = ['Java','Python','Php','JavaScript'] print(lang[-3:-2])
  • All of the above

Answer :lang = ['Java','Python','Php','JavaScript'] print(lang[1])

37. Fill in the blank, So that the below code will print 7 6 5 4 3.


Options are :

  • reverse(i=2,l=[1,2,3,4,5,6,7]) (Correct)
  • reverse(2,l=[1,2,3,4,5,6,7])
  • reverse(i=2,[1,2,3,4,5,6,7])
  • reverse(l=[1,2,3,4,5,6,7],i=2) (Correct)
  • reverse([1,2,3,4,5,6,7],2) (Correct)
  • reverse(l=[1,2,3,4,5,6,7],2)

Answer :reverse(i=2,l=[1,2,3,4,5,6,7]) reverse(l=[1,2,3,4,5,6,7],i=2) reverse([1,2,3,4,5,6,7],2)

Python Certification Exam Preparation Set 67

38. Which among the following will raise a Syntax error?


Options are :

  • def show(*a,**b): pass
  • def show(**b,*a): pass (Correct)
  • def show(**b,a): pass (Correct)
  • def show(a*,c,**b): pass (Correct)

Answer :def show(**b,*a): pass def show(**b,a): pass def show(a*,c,**b): pass

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


Options are :

  • (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) () () (Correct)
  • (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
  • (9, 8, 7, 6, 5, 4, 3, 2, 1, 0) ( 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) ( 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) ( 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
  • An error will be raised due to num [-15:15]
  • An error will be raised due to range(0,10,-1)

Answer :(10, 9, 8, 7, 6, 5, 4, 3, 2, 1) (10, 9, 8, 7, 6, 5, 4, 3, 2, 1) () ()

40.At which among the following line in the code the error will be raised.


Options are :

  • line 1
  • line 2
  • line 3
  • line 4
  • line 5 (Correct)

Answer :line 5

Python Certification Exam Preparation Set 23

Python's built-in function named open () tries to open a file and returns:


Options are :

  • A. an integer value identifying an opened file (Correct)
  • B. an error code (0 means success)
  • C. a stream object
  • D. always None

Answer :A. an integer value identifying an opened file

Python Certification Exam Preparation Set 59

What can you deduce from the following statement0

(Select two answers)

str = open('file.txt', "rt")


Options are :

  • A. str is a string read in from the file named file. txt (Correct)
  • B. a newlina character translation will be performed during the reads
  • C. if file. txt does not exist, it will be created
  • D. the opened file cannot be written with the use of the str variable (Correct)

Answer :A. str is a string read in from the file named file. txt D. the opened file cannot be written with the use of the str variable

You are going to read just one character from a stream called s. Which statement would you use?


Options are :

  • A. ch = read(s, 1)
  • B. ch = s. input(1)
  • C. ch = input(s, 1)
  • D. ch = s. read(l) (Correct)

Answer :D. ch = s. read(l)

There is a stream named s open for writing. What option will vou select to write a line to the stream"


Options are :

  • A. s.write("Hello\n") (Correct)
  • B. write(s, "Hello")
  • C. s.writeln("Hello")
  • D. s.writeline("Hello")

Answer :A. s.write("Hello\n")

Python Certification Exam Preparation Set 17

A variable stored separately in every object is called:


Options are :

  • A. there are no such variables, all variables are shared among objects (Correct)
  • B. a class variable
  • C. an object variable
  • D. an instance variable

Answer :A. there are no such variables, all variables are shared among objects

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions