Back to Library

Python String Manipulation and Character Encoding

Computer Science

This content explores various functions and operators for manipulating strings in Python, including length calculation, substring extraction, case conversion, and checking for numeric values. It also delves into character encoding with ASCII and Unicode, and their corresponding Python functions (ord() and chr()).

Python Strings ASCII
41 Questions Medium Ages 14+ Feb 21, 2026

Choose a Study Format

About this Study Set

This study set covers Computer Science through 41 practice questions. This content explores various functions and operators for manipulating strings in Python, including length calculation, substring extraction, case conversion, and checking for numeric values. It also delves into character encoding with ASCII and Unicode, and their corresponding Python functions (ord() and chr()). Every question includes the correct answer so you can learn as you go — pick any format above to get started.

Questions & Answers

Browse all 41 questions from the Python String Manipulation and Character Encoding study set below. Each question shows the correct answer — select a study format above to practice interactively.

1 Which function returns the number of characters in a string 'ch'?
  • A Pos(ch1, ch2)
  • B Convch(x)
  • C Valeur (ch)
  • D Long(ch)
2 What does the Pos(ch1, ch2) function return if ch1 is not found in ch2?
  • A The position of ch1
  • B 0
  • C -1
  • D An error message
3 The Convch(x) function converts what type of input to what type of output?
  • A String to integer
  • B Integer to string
  • C Float to string
  • D String to float
4 Which function checks if a string 'ch' can be converted to a numeric value?
  • A Estnum(ch)
  • B Sous_chaine(ch, d, f)
  • C Effacer(ch, d, f)
  • D Majus(ch)
5 What does the Sous_chaî ne(ch, d, f) function return?
  • A The string 'ch' with characters from d to f removed
  • B A part of the string 'ch' from position d up to position f
  • C The entire string 'ch'
  • D The length of the string 'ch'
6 The Effacer(ch, d, f) function removes characters from position d to position f, inclusive.
  • A True
  • B False
7 Which function converts a string to uppercase?
  • A Majus(ch)
  • B len(ch)
  • C ch2.find(ch1)
  • D str(X)
8 In Python, what is the equivalent of the algorithmic function Long(ch)?
  • A len(ch)
  • B ch.length()
  • C ch.size()
  • D ch.count()
9 How do you find the first position of ch1 within ch2 in Python?
  • A ch2.find(ch1)
  • B ch1.find(ch2)
  • C ch2.index(ch1)
  • D ch1.index(ch2)
10 The int() function in Python converts a value to what data type?
  • A String
  • B Float
  • C Integer
  • D Boolean
11 The float() function in Python converts a value to what data type?
  • A String
  • B Float
  • C Integer
  • D Boolean
12 What does the isdecimal() method of a string return?
  • A True if the string contains only decimal characters, False otherwise
  • B True if the string contains only alphabetic characters, False otherwise
  • C True if the string contains only alphanumeric characters, False otherwise
  • D The decimal representation of the string
13 What is the result of Sous_chaî ne("bonjour", 3, 6) in algorithmic terms?
  • A bon
  • B jour
  • C ouj
  • D our
14 What is the result of Effacer("bonjour", 3, 7) in algorithmic terms?
  • A bon
  • B jour
  • C ouj
  • D our
15 What is the result of Majus("Ecole-PRIM2")?
  • A ECOLE-PRIM2
  • B ecole-prim2
  • C Ecole-Prim2
  • D EcoLe-PriM2
16 A string with zero characters is called a:
  • A Empty string
  • B Null string
  • C Void string
  • D Character array
17 What is the output of print("1a2B?".upper())?
  • A 1A2B?
  • B 1a2b?
  • C 1A2B
  • D 1a2B
18 What is the output of print(chr(65))?
  • A A
  • B a
  • C 65
  • D (A)
19 What is the output of print(chr(97))?
  • A A
  • B a
  • C 97
  • D (a)
20 What is the output of print(ord("A"))?
  • A 65
  • B 97
  • C A
  • D (65)
21 What is the output of print(ord("a"))?
  • A 65
  • B 97
  • C a
  • D (97)
22 What is the result of "a" + "b" in Python?
  • A ab
  • B a b
  • C a
  • D b
23 What is the result of "a" * 3 in Python?
  • A aaa
  • B a a a
  • C a
  • D 3a
24 Which operator checks for membership in Python?
  • A in
  • B +
  • C *
  • D <
25 What is the output of print(len("Hello world"))?
  • A 11
  • B 10
  • C 12
  • D Hello world
26 What is the output of ch="m&m's".upper() followed by print(ch)?
  • A M&M'S
  • B m&m's
  • C M&MS
  • D m&ms
27 What is the result of ch1.isdecimal() if ch1="56.23"?
  • A True
  • B False
  • C Error
  • D None
28 What is the result of ch2.isdecimal() if ch2="5623"?
  • A True
  • B False
  • C Error
  • D None
29 What is the output of N=int("256")?
  • A 256 (integer)
  • B 256.0 (float)
  • C "256" (string)
  • D Error
30 What is the output of X=float("256")?
  • A 256 (integer)
  • B 256.0 (float)
  • C "256" (string)
  • D Error
31 What is the result of ch[0:3] if ch="Welcome"?
  • A Wel
  • B Wec
  • C lco
  • D ome
32 What is the result of ch[:2] if ch="Welcome"?
  • A We
  • B Wel
  • C W
  • D e
33 What is the result of ch[3:] if ch="Welcome"?
  • A Wel
  • B Wec
  • C lco
  • D ome
34 What is the result of ch[3:len(ch)] if ch="Welcome"?
  • A Wel
  • B Wec
  • C lco
  • D ome
35 What is the result of ch[3:4] if ch="Welcome"?
  • A l
  • B W
  • C e
  • D c
36 In Python, strings are immutable.
  • A True
  • B False
37 Which function returns the ASCII code of a character 'c'?
  • A Chr(n)
  • B Ord(c)
  • C Asc(c)
  • D Code(c)
38 Which function returns the character whose ASCII code is 'n'?
  • A Chr(n)
  • B Ord(c)
  • C Asc(n)
  • D Char(n)
39 What is the difference in ASCII codes between uppercase and lowercase letters in English?
  • A 32
  • B 1
  • C 26
  • D Depends on the letter
40 What is the output of print("Scolaire".find("s"))?
  • A -1
  • B 0
  • C 1
  • D 2
41 What is the output of print("45, 17".isdecimal())?
  • A True
  • B False
  • C Error
  • D None
📱

Study on the go

Download Quixly and access all study formats on your phone — anywhere, anytime.

Download on App Store Get it on Google Play Get it on Chrome Web Store