| | | | MCQ Tutorial - Python->String | | | | 1.) What is the output when following statement is executed?
>>>"a"+"bc" | | Options are: | | A.) bc
| | B.) abc
| | C.) bca
| | D.) a
| | Correct Option: B | | | | | | | 2.) What is the output when following statement is executed?
>>>"abcd"[2:] | | Options are: | | A.) bc
| | B.) cd
| | C.) da
| | D.) ab
| | Correct Option: B | | | | | | | 3.) The output of executing string.ascii_letters can also be achieved by | | Options are: | | A.) string.lowercase_string.upercase
| | B.) string.letters
| | C.) string.ascii_lowercase+string.ascii_upercase
| | D.) string.ascii_lowercase_string.digits
| | Correct Option: C | | | | | | | 4.) What is the output when following code is executed?
>>> str1 = 'hello' >>> str2 = ',' >>> str3 = 'world' >>> str1[-1:] | | Options are: | | A.) elloh
| | B.) ohell
| | C.) ello
| | D.) o
| | Correct Option: D | | | | | | | 5.) What is the output when following code is executed?
>>>print r" hello" | | Options are: | | A.) Error
| | B.) a new line and hello
| | C.) the letter r and then hello
| | D.) hello
| | Correct Option: D | | | | | | | | | | | |