Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Human Resource (HR) Interviews:AchievementsAdministration OfficerBusiness process outsourcing (BPO)Call Center Team LeaderCall Center TipsCareer BreakCo WorkersConflict ResolutionCritical Thinking & Decision MakingCRO (Customer Representative Officer)Customer CommunicationCustomer FeedbackDay BoyDay GirlDifficult SituationsEvent AssistantFemale HR ExecutiveFinal RoundFreshers HRGeneral HRGetting Laid OffGood ManagerHobbiesHR Business PartnerHR ConsultantHR CoordinatorHR DevelopmentHR DirectorHR ExperiencedHR GeneralistHR Grievance HandlingHR Lay-offHR ManagerHR MotivationHR OfficerHR RecruitmentHuman Resource AssistantHuman Resource PlanningIR ExecutiveJob ReferencingLayoffLeader of a TeamOffice AssistantOffice BoyOffice GirlOverqualifiedPay RaisePersonal ConflictPersonalityPressure BasedProject AssistantRecruiterRecruiting CoordinatorRecruitment ConsultantReferences CheckingSample HR interviewTalent Acquisition ManagerTechnical Support
Copyright © 2018. All Rights Reserved
Project Assistant Interview Question:
Write InStr function. Write the test cases for this function?
Submitted by: Murtazausing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InStr
{
class Program
{
static void Main(string[] args)
{
//test case 1, should return -1
string txt = "this is a test";
string searchString = "ae";
Console.WriteLine(InStr(txt, searchString));
//cast case 2, should return 2
txt = "this is a test";
searchString = "is";
Console.WriteLine(InStr(txt, searchString));
Console.Read();
}
//return the position of the first occurrence of one
string "searchString" within another "txt"
//return -1 means cannot find
static int InStr(string txt, string searchString)
{
return txt.IndexOf(searchString);
}
}
}
Submitted by: Murtaza
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace InStr
{
class Program
{
static void Main(string[] args)
{
//test case 1, should return -1
string txt = "this is a test";
string searchString = "ae";
Console.WriteLine(InStr(txt, searchString));
//cast case 2, should return 2
txt = "this is a test";
searchString = "is";
Console.WriteLine(InStr(txt, searchString));
Console.Read();
}
//return the position of the first occurrence of one
string "searchString" within another "txt"
//return -1 means cannot find
static int InStr(string txt, string searchString)
{
return txt.IndexOf(searchString);
}
}
}
Submitted by: Murtaza
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.