Jede Frage dieses Quiz ist zeitlich begrenzt. Drücke auf die Schaltfläche um das Quiz zu starten.
Select the correct output of the following String operations
strOne = str("pynative") strTwo = "pynative" print(strOne == strTwo) print(strOne is strTwo)
false false
true true
true false
false true
Python does not support a character type; a single character is treated as strings of length one.
Choose the correct function to get the ASCII code of a character
char(‘char’)
ord(‘char’)
ascii(‘char’)
str1 = 'Welcome' print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
What is the output of the following string operations ?
str = "My salary is 7000"; print(str.isalnum())
True
False
Choose the correct function to get the character from ASCII number
ascii(‘number)
char(number)
chr(number)
What is the output of the following string comparison ?
print("John" > "Jhon") print("Emma" < "Emm")
True False
False False
myString = "pynative" stringList = ["abc", "pynative", "xyz"]
print(stringList[1] == myString) print(stringList[1] is myString)
Guess the correct output of the following code ?
str1 = "PYnative" print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1])
PYn PYnat ive PYnativ vitanYP
Yna PYnat tive PYnativ vitanYP
Yna PYnat tive PYnativ PYnativ
Strings are immutable in Python, which means a string cannot be modified.
Guess the correct output of the following String operations
str1 = 'Welcome ' print(str1*2)
WelcomeWelcome
TypeError: unsupported operand type(s) for * or pow(): ‘str’ and ‘int’
Welcome Welcome
Welcome2
str = "my name is James bond"; print (str.capitalize())
My Name Is James Bond
My name is james bond
Which method should I use to convert String "welcome to the beautiful world of python" to "Welcome To The Beautiful World Of Python" ?
capitalize()
title()
str1 = "my isname isisis jameis isis bond"; sub = "is"; print(str1.count(sub, 4))
5
6
7
4
What is the output of the following code ?
str1 = "My salary is 7000"; str2 = "7000"
print(str1.isdigit()) print(str2.isdigit())
False True