T4Tutorials .PK

NSCT – Strings & Text Processing MCQs

1. What is a string in programming?

(A) A Boolean value


(B) A type of number


(C) A sequence of characters


(D) A loop




2. Which data type is used to store text?

(A) int


(B) float


(C) str


(D) bool




3. Which of the following is used to combine two strings?

(A) Subtraction


(B) Division


(C) Concatenation


(D) Multiplication




4. Which operation is used to find the length of a string?

(A) length


(B) size


(C) len


(D) count




5. Strings are usually:

(A) Mutable


(B) Immutable


(C) Numeric


(D) Boolean




6. Which of the following allows extracting a part of a string?

(A) Slicing


(B) Concatenation


(C) Reversal


(D) Addition




7. What is it called when all letters of a string are converted to uppercase?

(A) Uppercasing


(B) Capitalization


(C) Formatting


(D) Reversing




8. What is it called when all letters of a string are converted to lowercase?

(A) Lowercasing


(B) Capitalization


(C) Formatting


(D) Reversing




9. Which operation removes spaces from the beginning and end of a string?

(A) Slice


(B) Split


(C) Join


(D) Strip




10. Which operation splits a string into parts based on a separator?

(A) Join


(B) Slice


(C) Strip


(D) Split




11. Which operation joins multiple strings into one using a separator?

(A) Join


(B) Split


(C) Strip


(D) Slice




12. How are individual characters in a string accessed?

(A) Using variables


(B) Using loops only


(C) Using indexes


(D) Using functions only




13. Which operator is commonly used to combine strings?

(A) +


(B)


(C) *


(D) /




14. Which of the following can search for a specific substring in a string?

(A) Strip


(B) Replace


(C) Find


(D) Join




15. Which operation replaces a part of a string with another string?

(A) Strip


(B) Split


(C) Join


(D) Replace




16. Which method checks if a string starts with a specific substring?

(A) endswith


(B) find


(C) startswith


(D) replace




17. Which method checks if a string ends with a specific substring?

(A) endswith


(B) startswith


(C) find


(D) replace




18. Which of the following counts the occurrences of a character or substring in a string?

(A) replace


(B) length


(C) find


(D) count




19. Strings in most programming languages are:

(A) Sequences of numbers


(B) Sequences of characters


(C) Sequences of Booleans


(D) Sequences of functions




20. Text processing is mainly used to:

(A) Handle and manipulate textual data


(B) Perform calculations


(C) Create loops


(D) Store Boolean values




Exit mobile version