1) Define a string in Python. a) A sequence of numbers b) A sequence of characters c) A list of integers d) A collection of objects 2) Which of the following represents a string in Python? a) 123 b) hello world c) "Hello, World!" d) [1, 2, 3] 3) Which of the following data types is NOT a string in Python? a) 'Python' b) """Welcome""" c) [1, 2, 3] d) "String Example" 4) How would you create an empty string in Python? a) "" b) '' c) str() d) All of the above 5) Which method is used to create a string with a single character? a) str() b) chr() c) character() d) new_string() 6) How can you concatenate two strings in Python? a) Using the + operator b) Using the * operator c) Using append() d) Using join() 7) How do you access the first character of the string "Python"? a) Python[0] b) Python[1] c) Python[1:3] d) Python('0') 8) What will str = "Hello"[2] return? a) "Hello" b) "He" c) "l" d) "e" 9) Which index will give you the last character of a string in Python? a) len(str) b) len(str) - 1 c) -1 d) Both b and c 10) Which loop is commonly used to traverse over a string? a) while b) for c) do-while d) for-in 11) What will be the output of the following code? What will str = "Hello World!"; str[::2] return? a) "Hello World!" b) "Hoo ol!" c) "Hello" d) "Hello W" 12) Which of the following operations will return True? a) "Python" == "python" b) "Python".lower() == "python" 13) "hello world".upper() . predict the output? a) "hello world" b) "HELLO WORLD" 14) Which statement is true about strings in Python? a) Strings can be changed after creation. b) Strings are immutable objects 15) How can you modify the string "Hello" in Python? a) By reassigning it to a new string value b) By using str.replace() c) By using string[0] = "H" d) Strings cannot be modified in Python 16) Which built-in function can be used to find the length of a string? a) length() b) len() c) size() d) count() 17) What will str = "Hello"; str.count("l") return? a) 1 b) 2 c) 3 d) none 18) What will str = "Python"; str.find("o") return? a) 1 b) 2 c) 4 d) -1 19) Which method would you use to replace all occurrences of "old" with "new" in a string? a) replace() b) swap() c) change() d) modify() 20) Which function can be used to check if a string contains only alphabetic characters? a) isalpha() b) isdigit() c) isalnum() d) isalphaor()
0%
strings quiz
공유
공유
공유
만든이
Mohd015162
콘텐츠 편집
인쇄
퍼가기
더보기
할당
순위표
더 보기
접기
이 순위표는 현재 비공개입니다.
공유
를 클릭하여 공개할 수 있습니다.
자료 소유자가 이 순위표를 비활성화했습니다.
옵션이 자료 소유자와 다르기 때문에 이 순위표가 비활성화됩니다.
옵션 되돌리기
퀴즈
(은)는 개방형 템플릿입니다. 순위표에 올라가는 점수를 산출하지 않습니다.
로그인이 필요합니다
비주얼 스타일
글꼴
구독 필요
옵션
템플릿 전환하기
모두 표시
액티비티를 플레이할 때 더 많은 포맷이 나타납니다.
결과 열기
링크 복사
QR 코드
삭제
자동 저장된
게임을 복구할까요?