Objective Questions
All objective questions for COS 102
Questions (15)
| # | Question | Topic | Actions |
|---|---|---|---|
| 1 |
According to the document, what is the primary difference between indexing…
|
Advanced Text Processing | View |
| 2 |
Given the Python code snippet:
word = "Python"W… |
Advanced Text Processing | View |
| 3 |
What is the result of the following Python string slice: word = "Python"
|
Advanced Text Processing | View |
| 4 |
Which Python slicing shortcut starts from index 0 and extracts characters up to…
|
Advanced Text Processing | View |
| 5 |
If you use the slicing shortcut `[start:]` with the string 'Python', such as `"…
|
Advanced Text Processing | View |
| 6 |
What is the primary purpose of using negative slicing limits in Python?
|
Advanced Text Processing | View |
| 7 |
Given `filename = "report.txt"`, what will `filename[-4:]` produce as output?
|
Advanced Text Processing | View |
| 8 |
What is the recommended modern Python feature for dynamically injecting values …
|
Advanced Text Processing | View |
| 9 |
Given `name = "Tolani"` and `score = 85`, what will be the output of `print(f"H…
|
Advanced Text Processing | View |
| 10 |
Which of the following string methods converts all characters in a string to up…
|
Advanced Text Processing | View |
| 11 |
What does the `.strip()` string method primarily do?
|
Advanced Text Processing | View |
| 12 |
If you have the string `text = "a,b"` and you apply the method `text.split(",")…
|
Advanced Text Processing | View |
| 13 |
What does it mean for strings to be immutable in Python?
|
Advanced Text Processing | View |
| 14 |
Why does `name[0] = "J"` result in a `TypeError` when `name = "Python"`?
|
Advanced Text Processing | View |
| 15 |
When a Python string method like `.upper()` is called on a string, what is the …
|
Advanced Text Processing | View |