Disclaimer:
Educational Use Only:
The website links provided are to be used strictly for educational and knowledge-gaining purposes only.
No Misuse:
Do not misuse the links or the information contained therein for any commercial, illegal, or unethical activities.
Respect for Websites and Businesses:
Respect the intellectual property and business interests of the websites and their owners. Do not attempt to alter, copy, or redistribute content without proper authorization.
Acknowledge Value of Knowledge:
Recognize and value the knowledge and resources shared by these websites. Use the information responsibly and ethically.
No Endorsement:
The provision of these links does not imply endorsement of the linked sites, their content, or their products and services. Users are responsible for evaluating the suitability and accuracy of the information.
User Responsibility:
By accessing these links, you agree to use the information at your own risk and to comply with all applicable laws and website terms of use.
Overall MCQs for Reference
- Which Python function is used to replace occurrences of a substring with another substring in a string?
a. substitute()
b. replace()
c. change()
d. swap()
Answer: b. replace()sanfoundry+1 - What does the strip() method do to a string in Python?
a. Removes all spaces
b. Removes leading and trailing whitespace
c. Converts to lowercase
d. Splits by whitespace
Answer: b. Removes leading and trailing whitespacetestbook - Which method checks if a string is all uppercase?
a. islower()
b. isalpha()
c. isupper()
d. cap()
Answer: c. isupper()testbook - In Python, which operation joins two strings together?
a. Addition (+)
b. Multiplication (*)
c. Division (/)
d. Subtraction (-)
Answer: a. Addition (+)csiplearninghub - Which method counts occurrences of a substring in a string?
a. count()
b. find()
c. sum()
d. search()
Answer: a. count()testbook - What is the output of “hello world”.capitalize()?
a. Hello World
b. Hello world
c. HELLO WORLD
d. hello World
Answer: b. Hello worldtestbook - What does the lower() method do?
a. Converts string to title case
b. Converts string to lowercase
c. Reverses the string
d. Removes spaces
Answer: b. Converts string to lowercasetestbook - Which method would you use to remove specified characters from the start of a string?
a. strip()
b. lstrip()
c. rstrip()
d. remove()
Answer: b. lstrip()testbook - What is the result of “data”[1:3]?
a. ‘d’
b. ‘at’
c. ‘ta’
d. ‘da’
Answer: b. ‘at’testbook - How would you check if all characters in a string are digits?
a. isalpha()
b. isdigit()
c. isnumber()
d. isinteger()
Answer: b. isdigit()testbook - Which command creates a new string object in Python?
a. str()
b. string()
c. new()
d. create()
Answer: a. str()csiplearninghub - What does the split() method do?
a. Combines strings
b. Divides a string into a list
c. Sorts the string
d. Removes whitespace
Answer: b. Divides a string into a listtestbook - Which of these methods joins elements from a list into a single string?
a. split()
b. merge()
c. join()
d. concat()
Answer: c. join()testbook - What will be the output of “Python”.upper()?
a. python
b. Python
c. PYTHON
d. PyThOn
Answer: c. PYTHONtestbook - In string manipulation, what does “immutable” mean?
a. Cannot be deleted
b. Cannot be changed after creation
c. Can be split
d. Can be joined
Answer: b. Cannot be changed after creationtestbook - What does the find() method return if the substring is not found?
a. -1
b. 0
c. None
d. Error
Answer: a. -1testbook - Which function would you use to check if a string starts with a specific substring?
a. endswith()
b. startswith()
c. isprefix()
d. beginwith()
Answer: b. startswith()testbook - In preprocessing for ML, which string operation is commonly used to normalize case?
a. upper()
b. lower()
c. swapcase()
d. capitalize()
Answer: b. lower()interviewkickstart+1 - Tokenization in NLP refers to:
a. Joining strings
b. Splitting strings into words
c. Encrypting strings
d. Formatting strings
Answer: b. Splitting strings into wordsinterviewkickstart - What does the method replace(‘a’, ‘A’) do to the string ‘banana’?
a. Changes all ‘a’ to ‘A’
b. Changes first ‘a’ to ‘A’
c. Deletes all ‘a’
d. No change
Answer: a. Changes all ‘a’ to ‘A’testbook - Which encoding method converts text categories to binary columns in ML?
a. Label encoding
b. One-hot encoding
c. Base64 encoding
d. Index encoding
Answer: b. One-hot encodingsaidatascience - Which method would you use for removing stop words in NLP?
a. remove_words()
b. delete_stopwords()
c. stopword()
d. stop word removal
Answer: d. stop word removalinterviewkickstart - What is lemmatization in string preprocessing?
a. Expanding abbreviations
b. Reducing words to their root form
c. Removing punctuation
d. Changing case
Answer: b. Reducing words to their root forminterviewkickstart - Which method ensures text is free from extra spaces before feeding it to a ML model?
a. replace()
b. strip()
c. tokenize()
d. split()
Answer: b. strip()testbook - Given str=”machine”, what is str[::-1]?
a. error
b. ‘enihcam’
c. ‘machine’
d. ‘enihca’
Answer: b. ‘enihcam’testbook - What is the result of “abc”.isalpha()?
a. True
b. False
c. Error
d. None
Answer: a. Truetestbook - What does the rstrip() method do?
a. Removes whitespace from both ends
b. Removes whitespace from the right end
c. Removes whitespace from the left end
d. Removes whitespace from middle
Answer: b. Removes whitespace from the right endtestbook - Which of these functions extracts part of a string?
a. part()
b. sub()
c. slice()
d. substring()
Answer: d. substring()sanfoundry - Which Python library is frequently used for advanced string manipulation in ML preprocessing?
a. numpy
b. scikit-learn
c. pandas
d. tensorflow
Answer: c. pandassaidatascience - In Python, which statement will fail due to string immutability?
a. str1 = “data”; str1 = “a”sanfoundry
b. str1 = “data”; str1.upper()
c. str1 = “data”; str1 + ” science”
d. str1 = “data”; str1.replace(“a”, “b”)
Answer: a. str1 = “data”; str1 = “a”sanfoundry+1 - To remove all instances of a character ‘x’ from a string, which method is used?
a. delete(‘x’)
b. remove(‘x’)
c. replace(‘x’,”)
d. clean(‘x’)
Answer: c. replace(‘x’,”)testbook - Which symbol is used for string concatenation in Python?
a. +
b. &
c. .
d. –
Answer: a. +csiplearninghub - What does “data”.islower() return?
a. True
b. False
c. Error
d. None
Answer: a. Truetestbook - Which function splits a string by specific delimiter in Python?
a. split()
b. break()
c. cut()
d. delimiter()
Answer: a. split()testbook - Which of the following selects a substring from index 2 up to but not including index 5 in ‘abcdef’?
a. str[2:5]
b. str[3:5]
c. str[2:6]
d. str[2:4]
Answer: a. str[2:5]testbook - How do you create a multiline string in Python?
a. Using triple quotes
b. Using double quotes
c. Using single quotes
d. Using newline characters
Answer: a. Using triple quotesgeeksforgeeks - Which method is used to check if a string contains only whitespace?
a. isspace()
b. isblank()
c. isempty()
d. iswhitespace()
Answer: a. isspace()testbook - In text preprocessing, removing punctuation is important for:
a. Sentence segmentation
b. Text normalization
c. Data encryption
d. Language translation
Answer: b. Text normalizationinterviewkickstart - What will be the output of len(“Machine Learning”)?
a. 16
b. 17
c. 18
d. 15
Answer: b. 16testbook - Which of the following functions merges strings with a separator?
a. join()
b. concat()
c. add()
d. glue()
Answer: a. join()testbook - The expression “Hello” * 3 will return:
a. Error
b. Hello3
c. HelloHelloHello
d. ‘Hello Hello Hello’
Answer: c. HelloHelloHellotestbook - Which method converts a string into a list of characters?
a. list()
b. split()
c. array()
d. chars()
Answer: a. list()testbook - What does the partition() method return?
a. Number of partitions
b. Tuple with three elements
c. List of partitions
d. String
Answer: b. Tuple with three elementstestbook - What does swapping case mean for string manipulation?
a. Changing uppercase to lowercase and vice versa
b. Removing spaces
c. Reversing string
d. Splitting string
Answer: a. Changing uppercase to lowercase and vice versatestbook - What is stemming in NLP preprocessing?
a. Removing suffixes and prefixes from words
b. Pluralizing words
c. Changing case
d. Formatting text
Answer: a. Removing suffixes and prefixes from wordsinterviewkickstart - In feature engineering, extracting substrings for ML models can be performed using:
a. Slicing
b. Summing
c. Sorting
d. Grouping
Answer: a. Slicingsaidatascience+1 - Which method would you use to pad a string to a specific length?
a. pad()
b. rjust()
c. fill()
d. empty()
Answer: b. rjust()testbook - To check if “ML” exists in “Machine Learning”, what is the valid operation?
a. “ML” in “Machine Learning”
b. find(“ML”)
c. index(“ML”)
d. search(“ML”)
Answer: a. “ML” in “Machine Learning”csiplearninghub - Which function would you use to remove duplicates in sentences while cleaning textual data?
a. unique()
b. drop_duplicates()
c. duplicated()
d. none()
Answer: c. duplicated()saidatascience - Which method converts the first character of the string to uppercase and the rest to lowercase?
a. capitalize()
b. title()
c. upper()
d. format()
Answer: a. capitalize()testbook
- https://www.sanfoundry.com/arduino-questions-answers-string-manipulation/
- https://testbook.com/objective-questions/mcq-on-string-data-type–60014612a1f01e033fa34694
- https://csiplearninghub.com/mcq-on-python-string-class-11/
- https://interviewkickstart.com/blogs/learn/data-preprocessing-techniques-clean-ml-data
- https://saidatascience.com/data-handling-and-preprocessing/
- https://www.geeksforgeeks.org/quizzes/python-string-quiz/
- https://www.scribd.com/document/787082322/MCQ-Strings-Gr-10
- https://www.sanfoundry.com/c-multiple-choice-questions-answers-string-operations/
- https://www.sanfoundry.com/python-multiple-choice-questions-answers/
- https://www.geeksforgeeks.org/quizzes/string-data-structure-quiz-for-beginners/
- https://www.vedantu.com/cbse/important-questions-class-11-computer-science-chapter-8
- https://pynative.com/python-string-quiz/
- https://www.gyansetu.in/blog/machine-learning-mcq-interview-preparation/
- https://diptisurvase.wordpress.com/wp-content/uploads/2022/09/ml-mcqs.pdf
- https://www.scribd.com/document/438379541/Mcq
- https://www.aionlinecourse.com/ai-quiz-questions/natural-language-processing/text-preprocessing
- https://www.examveda.com/java-program/practice-mcq-question-on-strings/
- https://www.sanfoundry.com/data-preprocessing-ml-cleaning-normalization-encoding/
- https://www.interviewbit.com/data-structure-mcq/
- https://www.igmguru.com/blog/machine-learning-mcqs