Computer Programming 1 Quiz No. 2

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Lenlindo
L
Lenlindo
Community Contributor
Quizzes Created: 2 | Total Attempts: 188
Questions: 10 | Attempts: 66

SettingsSettingsSettings
Computer Programming 1 Quiz No. 2 - Quiz

.


Questions and Answers
  • 1. 

    Make clone of string

    • A.

      Duplicate

    • B.

      Clone

    • C.

      Clon

    • D.

      Option 4

    Correct Answer
    B. Clone
    Explanation
    The correct answer is "clone" because the question is asking for a term that means "to make a duplicate or copy of a string." The word "clone" accurately describes this action, as it refers to creating an identical or nearly identical copy of an object or entity.

    Rate this question:

  • 2. 

    This method replaces the character

    • A.

      Replaces

    • B.

      Replace

    • C.

      None of the above

    • D.

      Option 4

    Correct Answer
    B. Replace
    Explanation
    This method refers to the action of replacing a character with another character. It is a specific operation that involves substituting one character for another within a given string or text. The answer "Replace" accurately describes this action, indicating that the method is used to replace a character.

    Rate this question:

  • 3. 

    Converts string into upper case

    • A.

      ToUpper

    • B.

      Ucase

    • C.

      ToUpperCase

    • D.

      Option 4

    Correct Answer
    A. ToUpper
    Explanation
    The correct answer is "ToUpper". This function is used to convert a string into uppercase letters.

    Rate this question:

  • 4. 

    This method deletes all the characters from beginning to specified index position.

    • A.

      Delete

    • B.

      Remove

    • C.

      Trim

    • D.

      None of the above

    Correct Answer
    B. Remove
    Explanation
    This method refers to removing characters from a specified index position. It is different from deleting as it only eliminates characters starting from the specified index, rather than deleting the entire string. The options "Delete" and "Trim" do not accurately describe this action, leaving "Remove" as the correct answer.

    Rate this question:

  • 5. 

    This method checks whether specified character or string is exists or not in the string value

    • A.

      Duplicate

    • B.

      Contain

    • C.

      Contains

    • D.

      Option 4

    Correct Answer
    C. Contains
    Explanation
    The given answer "Contains" is correct because the method mentioned in the explanation checks whether a specified character or string exists or not in the given string value. Therefore, the correct option is "Contains" as it accurately describes the functionality of the method.

    Rate this question:

  • 6. 

    It checks whether the first character of string is same as specified character.

    • A.

      StartsWith

    • B.

      Beginning

    • C.

      EndsWith

    • D.

      None of the above

    Correct Answer
    A. StartsWith
    Explanation
    StartsWith is the correct answer because it is a method used to check whether a string starts with a specified character or substring. In this case, the explanation states that it checks whether the first character of the string is the same as the specified character. Therefore, StartsWith is the appropriate choice as it aligns with the given explanation.

    Rate this question:

  • 7. 

    Converts string into lower case

    • A.

      Lcase

    • B.

      ToLower

    • C.

      ToLowerCase

    • D.

      None of the above

    Correct Answer
    B. ToLower
    Explanation
    The function "ToLower" is used to convert a string into lowercase letters. This function takes a string as input and returns the same string with all the uppercase letters converted to lowercase. It is commonly used in programming to standardize the case of strings for comparison or display purposes. The other options mentioned in the question ("lcase" and "ToLowerCase") are not valid functions or methods in most programming languages, making "ToLower" the correct answer.

    Rate this question:

  • 8. 

    It removes extra whitespaces from beginning and ending of string

    • A.

      Trim

    • B.

      LTrim

    • C.

      RTrim

    • D.

      None of the above

    Correct Answer
    A. Trim
    Explanation
    The Trim function is used to remove any extra whitespace characters from both the beginning and the end of a string. This is useful for cleaning up user inputs or removing any unnecessary spaces. The LTrim function only removes whitespace from the beginning of the string, while the RTrim function only removes whitespace from the end. Therefore, the correct answer is Trim.

    Rate this question:

  • 9. 

    The CompareTo() function compare two strings and returns integer value as output. The integer value for true is ?

    • A.

      1

    • B.

      0

    • C.

      2

    • D.

      Option 4

    Correct Answer
    B. 0
    Explanation
    The CompareTo() function in Java compares two strings lexicographically. It returns an integer value that represents the difference between the two strings. If the two strings are equal, the CompareTo() function returns 0. Therefore, the correct integer value for true in this case is 0.

    Rate this question:

  • 10. 

    What conditional statement branch out to check more than one condition?

    • A.

      IF statement

    • B.

      If-else statement

    • C.

      Else-if statement

    • D.

      If-else-if statement

    Correct Answer
    D. If-else-if statement
    Explanation
    The if-else-if statement is a conditional statement that allows for multiple conditions to be checked. It provides a way to branch out and execute different blocks of code based on the evaluation of each condition. When the initial if statement evaluates to false, the program moves on to the next else-if statement, and so on, until a condition evaluates to true or until the final else statement is reached. This allows for more complex decision-making in programming by considering multiple conditions.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 24, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jan 10, 2016
    Quiz Created by
    Lenlindo
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.