String Case Conversion and Formatting Quiz Quiz

Assess your knowledge of string case conversion techniques and formatting best practices. This quiz covers various string case styles, transformations, and common pitfalls to help you master consistent text formatting.

  1. Converting to Title Case

    If you convert the string 'hello world' to title case, what will the result be?

    1. Hello World
    2. Hello world
    3. hello world
    4. HELLO WORLD

    Explanation: In title case, the first letter of each major word is capitalized, so 'hello world' becomes 'Hello World'. 'HELLO WORLD' is the uppercase version, not title case. 'hello world' remains lowercase and does not reflect title case. 'Hello world' capitalizes only the first word, which is not correct for title case when multiple words are present.

  2. Camel Case Identification

    Which of the following strings is correctly written in camel case?

    1. myvariablename
    2. my_variable_name
    3. MyVariableName
    4. myVariableName

    Explanation: Camel case begins with a lowercase letter and capitalizes the first letter of each subsequent word, resulting in 'myVariableName'. 'MyVariableName' uses Pascal case as it starts with an uppercase letter. 'my_variable_name' uses underscores, which is snake case. 'myvariablename' lacks internal capitalization and does not separate the words properly.

  3. Snake Case Conversion

    What will 'DataEntryForm' become if converted to snake case?

    1. Data_Entry_Form
    2. data_entry_form
    3. dataEntryForm
    4. data-entry-form

    Explanation: Snake case joins words with underscores and uses all lowercase letters, so 'DataEntryForm' turns into 'data_entry_form'. 'Data_Entry_Form' incorrectly uses uppercase letters. 'dataEntryForm' is camel case, not snake case. 'data-entry-form' uses hyphens and represents kebab case instead.

  4. Uppercase Conversion Effects

    After applying an uppercase conversion to the string 'Quick-Brown_fox42', what is the result?

    1. Quick-Brown_Fox42
    2. quick-brown_fox42
    3. Quick-brown_fox42
    4. QUICK-BROWN_FOX42

    Explanation: An uppercase conversion transforms all letters to uppercase, so the result is 'QUICK-BROWN_FOX42'. 'quick-brown_fox42' is in lowercase and shows no conversion. 'Quick-Brown_Fox42' and 'Quick-brown_fox42' maintain original or partial capitalization, which is not the effect of an uppercase conversion. Special characters and numbers remain unchanged.

  5. Sentence Case Recognition

    Which string correctly represents sentence case formatting given the sentence 'file processing completed successfully'?

    1. File processing completed successfully
    2. File_Processing_Completed_Successfully
    3. file processing completed successfully
    4. file Processing Completed Successfully

    Explanation: Sentence case capitalizes only the first letter of the first word, resulting in 'File processing completed successfully'. 'file Processing Completed Successfully' incorrectly capitalizes words beyond the initial one. 'File_Processing_Completed_Successfully' uses underscores, which is characteristic of snake case. 'file processing completed successfully' leaves the first word uncapitalized, which does not follow sentence case norms.