Blog

MCQs

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

  1. Which method is used to convert all characters of a Python string to lowercase?
    a. lower()
    b. upper()
    c. capitalize()
    d. swapcase()
    Answer: a. lower()w3schools+1​
  2. What does the SQL CONCAT function do?
    a. Splits a string
    b. Joins two strings together
    c. Removes whitespace
    d. Reverses a string
    Answer: b. Joins two strings togetheralooba+1​
  3. In Python, which method returns the number of times a substring appears in the string?
    a. find()
    b. count()
    c. index()
    d. replace()
    Answer: b. count()testbook+1​
  4. What does the TRIM function in SQL do?
    a. Adds spaces to a string
    b. Removes spaces from both ends
    c. Splits a string
    d. Finds substrings
    Answer: b. Removes spaces from both endsdatacamp+1​
  5. Which Python method checks whether all characters in a string are digits?
    a. isnumeric()
    b. isalpha()
    c. isdigit()
    d. isdecimal()
    Answer: c. isdigit()w3schools+1​
  6. What is the output of “HELLO”.lower()?
    a. Hello
    b. hello
    c. HELLO
    d. HeLLo
    Answer: b. helloscribd+1​
  7. Which string function extracts a specified number of characters from a string in SQL?
    a. LEN
    b. SUBSTRING
    c. CONCAT
    d. REPLACE
    Answer: b. SUBSTRINGalooba+1​
  8. Which Python method returns True if all characters are uppercase?
    a. islower()
    b. isupper()
    c. upper()
    d. capitalize()
    Answer: b. isupper()testbook+1​
  9. What does the SQL REPLACE function do?
    a. Finds a substring
    b. Changes characters in a string
    c. Joins two strings
    d. Splits a string
    Answer: b. Changes characters in a stringdatacamp+1​
  10. Which method would you use to center a string in Python?
    a. left()
    b. right()
    c. center()
    d. align()
    Answer: c. center()w3schools​
  11. What does the LEN function do in SQL?
    a. Combines two strings
    b. Returns the length of a string
    c. Removes spaces
    d. Finds substrings
    Answer: b. Returns the length of a stringwikipedia+1​
  12. Which method converts a string to all uppercase characters in Python?
    a. capitalize()
    b. upper()
    c. swapcase()
    d. title()
    Answer: b. upper()testbook+1​
  13. Which method splits a string into a list where each word is a list item?
    a. split()
    b. join()
    c. strip()
    d. replace()
    Answer: a. split()alooba+1​
  14. Which method removes leading and trailing whitespaces in Python?
    a. center()
    b. strip()
    c. join()
    d. upper()
    Answer: b. strip()w3schools+1​
  15. What does the FIND function do in Python?
    a. Returns substring index
    b. Combines strings
    c. Removes spaces
    d. Changes case
    Answer: a. Returns substring indexalooba+1​
  16. Which SQL function returns the position of the first occurrence of a substring?
    a. SUBSTRING
    b. FIND
    c. CHARINDEX
    d. LEFT
    Answer: c. CHARINDEXpress.rebus+1​
  17. How can you join a list of strings in Python?
    a. add()
    b. join()
    c. split()
    d. find()
    Answer: b. join()alooba+1​
  18. Which Python method returns a copy of a string with only the first character capitalized?
    a. title()
    b. capitalize()
    c. upper()
    d. swapcase()
    Answer: b. capitalize()testbook+1​
  19. What does the SQL RIGHT function do?
    a. Returns leftmost characters
    b. Returns rightmost characters
    c. Concatenates string
    d. Removes spaces
    Answer: b. Returns rightmost characterspress.rebus+1​
  20. Which function in SQL removes all occurrences of a specified substring?
    a. REMOVE
    b. REPLACE
    c. TRIM
    d. LEFT
    Answer: b. REPLACEalooba+1​
  21. Which Python method swaps uppercase to lowercase and vice versa?
    a. capitalize()
    b. split()
    c. swapcase()
    d. title()
    Answer: c. swapcase()w3schools​
  22. What does the STRING slice operation s[2:5] mean in Python?
    a. Returns character at index 2
    b. Returns substring from index 2 to 5 (exclusive)
    c. Returns the whole string
    d. Returns first two characters
    Answer: b. Returns substring from index 2 to 5 (exclusive)geeksforgeeks+1​
  23. Which SQL function changes a substring at a specific position for a certain length?
    a. SUBSTRING
    b. STUFF
    c. CONCAT
    d. LEFT
    Answer: b. STUFFpress.rebus+1​
  24. Which method checks if a string starts with a specified substring in Python?
    a. startswith()
    b. endswith()
    c. find()
    d. contains()
    Answer: a. startswith()w3schools​
  25. Which Python method checks if a string ends with a particular substring?
    a. end()
    b. finish()
    c. endswith()
    d. stop()
    Answer: c. endswith()w3schools​
  26. SQL function to extract the leftmost characters from a string?
    a. LEFT
    b. RIGHT
    c. CENTER
    d. SUBSTRING
    Answer: a. LEFTdatacamp+1​
  27. In Python, which function can pad a string to make it a certain length, with zeros on the left?
    a. pad()
    b. ljust()
    c. zfill()
    d. rjust()
    Answer: c. zfill()testbook+1​
  28. What does the ISNULL SQL function do with string data?
    a. Combines strings
    b. Checks if string is null
    c. Changes case
    d. Splits string
    Answer: b. Checks if string is nullalooba​
  29. Which method would you use to replace substring “cat” with “dog” in “catnap”?
    a. swapcase()
    b. replace()
    c. split()
    d. join()
    Answer: b. replace()testbook+1​
  30. Which SQL function can compare two strings for equality?
    a. COMPARE
    b. EQUAL
    c. ==
    d. LIKE
    Answer: d. LIKEpress.rebus+1​
  31. Which method is used to get the ASCII value of a character in Python?
    a. char()
    b. ord()
    c. str()
    d. asc()
    Answer: b. ord()w3schools​
  32. Which method would return True if the string contains only whitespace?
    a. strip()
    b. isspace()
    c. isalpha()
    d. islower()
    Answer: b. isspace()testbook+1​
  33. What does the join() method do in Python?
    a. Splits a string
    b. Combines elements of a list into a string
    c. Changes case
    d. Removes whitespace
    Answer: b. Combines elements of a list into a stringalooba+1​
  34. Which function reverses the order of characters in a Python string?
    a. reverse()
    b. rev()
    c. [::-1]
    d. flip()
    Answer: c. [::-1]alooba​
  35. Which method tests if the string is alphabetic in Python?
    a. isdigit()
    b. isalpha()
    c. isspace()
    d. isnumeric()
    Answer: b. isalpha()testbook+1​
  36. SQL function to find the length of a string?
    a. LEFT
    b. LENGTH
    c. CONCAT
    d. FIND
    Answer: b. LENGTHdatacamp+1​
  37. SQL function to change all letters in a string to uppercase?
    a. REPLACE
    b. UPPER
    c. TITLE
    d. CONCAT
    Answer: b. UPPERdatacamp+1​
  38. Python method to check if all characters are lowercase?
    a. islower()
    b. isupper()
    c. lower()
    d. issmall()
    Answer: a. islower()w3schools+1​
  39. Which SQL function can search for patterns in a string?
    a. LIKE
    b. SEARCH
    c. FIND
    d. REPLACE
    Answer: a. LIKEalooba+1​
  40. How do you concatenate “foo” and “bar” in Python?
    a. foo concat bar
    b. foo.bar
    c. foo + bar
    d. foo | bar
    Answer: c. foo + baralooba+1​
  41. Which Python method returns the string with the first letter of each word capitalized?
    a. capitalize()
    b. title()
    c. upper()
    d. swapcase()
    Answer: b. title()testbook+1​
  42. What is the main difference between split() and join() in Python?
    a. Both split strings
    b. Both combine strings
    c. split() divides strings, join() combines list elements into a string
    d. No difference
    Answer: c. split() divides strings, join() combines list elements into a stringalooba+1​
  43. What is true about strings in Python?
    a. Mutable
    b. Immutable
    c. Always numeric
    d. Always uppercase
    Answer: b. Immutablecsiplearninghub+1​
  44. Which function will check if all string characters are decimal numbers?
    a. isdigit()
    b. isalpha()
    c. isdecimal()
    d. isnumeric()
    Answer: c. isdecimal()w3schools+1​
  45. Which method would you use to get every alternate character starting from index 0 in a Python string?
    a. s[::2]
    b. s[1:2]
    c. s[::-1]
    d. s[2:2]
    Answer: a. s[::2]alooba​
  46. SQL function to remove extra spaces from left end of string?
    a. LTRIM
    b. RTRIM
    c. TRIMLEFT
    d. LEFT
    Answer: a. LTRIMpress.rebus+1​
  47. Which method will count number of words in a Python string?
    a. split() and len()
    b. count()
    c. find()
    d. index()
    Answer: a. split() and len()alooba+1​
  48. Which Python method finds the last occurrence of a substring?
    a. find()
    b. last()
    c. rfind()
    d. end()
    Answer: c. rfind()testbook+1​
  49. SQL function used to extract a substring from specified index and length?
    a. LEFT
    b. SUBSTRING
    c. CONCAT
    d. REPLACE
    Answer: b. SUBSTRINGalooba+1​
  50. Which method would return True in Python if all the characters in the string are alphanumeric?
    a. isalpha()
    b. isdigit()
    c. isalnum()
    d. isnumeric()
    Answer: c. isalnum()w3schools+1​
  1. https://www.w3schools.com/python/python_ref_string.asp
  2. https://www.scribd.com/document/772517524/String-Manipulation-Mcq
  3. https://www.alooba.com/skills/concepts/sql-19/string-functions/
  4. https://www.datacamp.com/tutorial/sql-string-functions
  5. https://testbook.com/objective-questions/mcq-on-string-data-type–60014612a1f01e033fa34694
  6. https://en.wikipedia.org/wiki/String_(computer_science)
  7. https://www.alooba.com/skills/concepts/programming/programming-concepts/string-manipulation/
  8. https://press.rebus.community/programmingfundamentals/chapter/string-functions/
  9. https://www.geeksforgeeks.org/dsa/basic-string-operations-with-implementation/
  10. https://csiplearninghub.com/mcq-on-python-string-class-11/
  11. https://www.geeksforgeeks.org/sql/sql-string-functions/
  12. https://mode.com/sql-tutorial/sql-string-functions-for-cleaning/
  13. https://www.geeksforgeeks.org/dsa/string-data-structure/
  14. http://infra.fragnel.edu.in:3170/c/string
  15. https://www.sanfoundry.com/arduino-questions-answers-string-manipulation/
  16. https://neo4j.com/docs/cypher-manual/current/functions/string/
  17. https://www.sharpener.tech/blog/string-representation-in-data-structures/
  18. https://education.launchcode.org/data-analysis/chapters/strings/string-methods.html
  19. https://www.geeksforgeeks.org/quizzes/python-string-quiz/
  20. https://pynative.com/python-string-quiz/

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!