Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6181323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:59:58+00:00 2026-05-24T00:59:58+00:00

I recently had this question in an interview to write test cases to test

  • 0

I recently had this question in an interview to write test cases to test a function which checks if one string is present in another I didn’t quite expect that question to pop in the interview for a developer position, yesterday I got the heads up for an on-site visit from same company I wanted to get some pointers from testing folks here to get an idea (before I head there) as to go about answering those type of questions. This is the skeleton they provided for the function to ask me to test it.

public static boolean checkSubString(String str1, String str2)
    {
        //first string is the source
            // second string is the reference
        if(str1.contains(str2))
            return true;
        else
            return false;
    }

Thanks for reading. I look forward to your replies eagerly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:59:58+00:00Added an answer on May 24, 2026 at 12:59 am

    Just one tip: consider this part: str1.contains(str2), when would it result in true, when in false and what would be needed to make it throw an Exception.

    That would then be your test cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is one of an interview question which I had recently. I would like
I recently had this question in an interview and this is what I came
Recently i had an interview in which the question was asked as How would
Recently I had this question , and everything worked properly until I sent it
I've recently asked and had answered this question and it's stopped the issue of
Recently I had a question on the interview - I was asked to compare
I recently had to take a quick look at Adobe InDesign server. In this
We recently had a code review . One of my classes was used so
I recently had a discussion on another forum with another developer and the topic
We recently had a new requirement to use the phonon component of Qt, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.