Ôn tập B24. Xâu kí tự
Quiz
•
Computers
•
10th Grade
•
Medium
Trần Hiếu
Used 9+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Phát biểu nào sau đây là sai?
Có thể truy cập từng kí tự của xâu thông qua chỉ số.
Chỉ số bắt đầu từ 0.
Có thể thay đổi từng kí tự của một xâu.
Python không có kiểu dữ liệu kí tự.
Answer explanation
Khác với danh sách, không thể thay đổi từng kí tự trong xâu.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Trong Python, câu lệnh nào dùng để tính độ dài của xâu s?
len(s)
length(s)
s.len()
s.length()
Answer explanation
Lệnh len() tính độ dài của xâu kí tự với cấu trúc len(list).
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Xâu “1234%^^%TFRESDRG” có độ dài bằng bao nhiêu?
16
17
18
15
Answer explanation
Đếm số kí tự trong cặp dấu nháy kép.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Biểu thức nào sau cho kết quả đúng hay sai?
S1 = “12345”
S2 = “3e4r45”
S3 = “45”
S3 in S1
S3 in S2
True, False.
True, True.
False, False.
False, True.
Answer explanation
Cả hai chuỗi S1, S2 đều chứa S3 nên hai biểu thức đúng.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
s = input("Nhập xâu kí tự bất kì:")
kq = False
for i in range(len(s)-1):
if s[i] == "2" and s[i+1] == "1":
kq = True
break
print(kq)
True
False
Chương trình bị lỗi
Vòng lặp vô hạn
Answer explanation
Chuỗi s chứa “21” nên kq = True.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Trong Python, xâu nào chương trình sẽ báo lỗi?
'This is a string in Python'
message = "This is also a string".
'"Beautiful is better than ugly.". Said Tim Peters'
Xâu không bị lỗi.
'It\'s also a valid string'
Answer explanation
Cả ba xâu đều đúng, có thể sử dụng “” trong ‘’ hoặc sử dụng kí hiệu “\” trong xâu.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Chương trình trên giải quyết bài toán gì?
s = ""
for i in range(10):
s = s + str(i)
print(s)
In một chuỗi kí tự từ 0 tới 10
In một chuỗi kí tự từ 0 tới 9.
In một chuỗi kí tự từ 1 tới 10.
In một chuỗi kí tự từ 1 tới 9.
Answer explanation
Biến i chạy từ 0 đến 9 trong range(10).
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple

Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
15 questions
ICT - Computer Software
Quiz
•
8th - 10th Grade
10 questions
Հարցաշար
Quiz
•
10th Grade
11 questions
Internet, Intranet and Extranet
Quiz
•
10th Grade
15 questions
Chapter : 9 Working with tables
Quiz
•
5th Grade - University
15 questions
Ôn tập KTGK. Bài 17. Biến và lệnh gán
Quiz
•
10th Grade
12 questions
H7.P1&P2.Nova2.Geluid.mhv
Quiz
•
4th - 10th Grade
15 questions
Defining diagram
Quiz
•
10th Grade
10 questions
Hệ Điều Hành Của Máy Tính
Quiz
•
10th Grade - University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade