Which of the following best explains why strings are used in programming?
Think about what kind of data needs letters, words, or sentences.
Strings are used to hold text such as words, sentences, or any characters. They let programs work with human-readable information.
What is the output of this Python code?
greeting = "Hello, " name = "Alice" message = greeting + name print(message)
Look at how the strings are joined with the + operator.
The + operator joins two strings exactly as they are. Since greeting ends with a comma and space, the output includes it.
What is the output of this Python code?
text = "Programming" print(text[3:7])
Remember that slicing includes the start index but excludes the end index.
text[3:7] takes characters from index 3 up to but not including 7, which is 'g','r','a','m'.
What error does this code produce?
text = 'Hello\nWorld\nprint(text)Check if all quotes are properly closed.
The string starts with a single quote but does not have a matching closing quote before the print statement, causing a SyntaxError.
Which option correctly counts the number of vowels in the string text?
text = "Education is important"Think about checking each character individually and counting vowels regardless of case.
Option B converts text to lowercase and counts each character if it is a vowel, correctly counting all vowels.