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

What will be the output of the following Python statement?


Options are :

  • a
  • bc
  • bca
  • abc

Answer :abc

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

What will be the output of the following Python statement?


Options are :

  • a
  • ab
  • cd
  • dc

Answer :cd

The output of executing string.ascii_letters can also be achieved by:


Options are :

  • string.ascii_lowercase_string.digits
  • string.ascii_lowercase+string.ascii_upercase
  • string.letters
  • string.lowercase_string.upercase

Answer :string.ascii_lowercase+string.ascii_upercase

What will be the output of the following Python code?


Options are :

  • olleh
  • hello
  • h
  • 0

Answer :0

Python Certification Exam Preparation Set 24

What arithmetic operators cannot be used with strings?


Options are :

  • +
  • *
  • all of the mentioned

Answer :

What will be the output of the following Python code?


Options are :

  • a new line and hello
  • \nhello
  • the letter r and then hello
  • error

Answer :\nhello

What will be the output of the following Python statement?


Options are :

  • Error
  • Output equivalent to print 'new\nline'
  • newline
  • new line

Answer :newline

Python Certification Exam Preparation Set 44

What will be the output of the following Python statement?


Options are :

  • Error
  • 97 98
  • x\97
  • \x97\x98

Answer :x\97

What will be the output of the following Python code?


Options are :

  • dlrowolleh
  • hello
  • world
  • hello worled

Answer :dlrowolleh

print(0xA + 0xB + 0xC):


Options are :

  • 0xA0xB0xC
  • Error
  • 0x22
  • 33

Answer :33

Python Certification Exam Preparation Set 55

What will be the output of the following Python code?


Options are :

  • None None
  • None 22
  • 22 None
  • Error is generated

Answer :Error is generated

What will be the output of the following Python code?


Options are :

  • 224
  • Error
  • 12
  • None

Answer :12

What will be the output of the following Python code?


Options are :

  • wo
  • world
  • sn
  • rl

Answer :wo

Python Certification Exam Preparation Set 29

What will be the output of the following Python code?


Options are :

  • snow
  • snow world
  • Error
  • snos world

Answer :Error

What will be the output of the following Python code?


Options are :

  • error
  • u
  • t
  • y

Answer :y

Given a string example="hello" what is the output of example.count('l')?


Options are :

  • 2
  • 1
  • None
  • 0

Answer :2

Python Certification Exam Preparation Set 23

What will be the output of the following Python code?


Options are :

  • Error
  • -1
  • 1
  • 0

Answer :1

What will be the output of the following Python code?


Options are :

  • -1
  • 4
  • 3
  • 1

Answer :4

What will be the output of the following Python code?


Options are :

  • dlrowolleh
  • True
  • -1
  • None

Answer :True

Python Certification Exam Preparation Set 6

To concatenate two strings to a third what statements are applicable?


Options are :

  • s3 = s1 . s2
  • s3 = s1.add(s2)
  • s3 = s1.__add__(s2)
  • s3 = s1 * s2

Answer :s3 = s1.__add__(s2)

What will be the output of the following Python statement?


Options are :

  • A
  • B
  • a
  • Error

Answer :A

What will be the output of the following Python statement?


Options are :

  • a
  • b
  • c
  • A

Answer :c

Python Certification Exam Preparation Set 48

Which of the following statement prints hello\example\test.txt?


Options are :

  • print("hello\example\test.txt")
  • print("hello\\example\\test.txt")
  • print("hello\"example\"test.txt")
  • print("hello"\example"\test.txt"

Answer :print("hello\\example\\test.txt")

Suppose s is "\t\tWorld\n", what is s.strip()?


Options are :

  • \t\tWorld\n
  • \t\tWorld\n
  • \t\tWORLD\n
  • World

Answer :World

The format function, when applied on a string returns ___________


Options are :

  • Error
  • int
  • bool
  • str

Answer :str

", $fileContentFew); $title = explode("

Python Certification Exam Preparation Set 54

What will be the output of the "hello" +1+2+3?


Options are :

  • hello123
  • hello
  • Error
  • hello6

Answer :Error

What will be the output of the following Python code?


Options are :

  • DCBA
  • A, B, C, D
  • D C B A
  • D, C, B, A will be displayed on four lines

Answer :D C B A

What will be the output of the following Python statement?(python 3.xx)


Options are :

  • Welcome# 111#924.66
  • Welcome#111#924.66
  • Welcome#111#.66
  • Welcome # 111#924.66

Answer :Welcome # 111#924.66

Python Certification Exam Preparation Set 9

What will be displayed by print(ord('b') ord('a'))?


Options are :

  • 0
  • 1
  • -1
  • 2

Answer :1

Say s="hello" what will be the return value of type(s)?


Options are :

  • int
  • bool
  • str
  • string

Answer :str

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions