Write the InStr function. Write the test cases for this
function?
Answers were Sorted based on User's Feedback
Answer / echo
using 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);
}
}
}
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / majhoul
int Instr(int start,string string1,string string2,string type-of-the-test)
{
lenght= string2.lenght();
int lenght ;
int i ;// as counter for lenght
if (string1==NULL ll string2==Null)// to check that the
both of the strings
is not empty
return 0;
if (type-of-the-test = "text")// it doesn't matter if it is upper or lower case in the text test !!!
{
string1=toupper(string1) ;
string2=toupper(string2) ;
}
int location = string1.find(string2);
while (location != string::npos)//
{
if (location > start) // the string was found we have to check if it is match the type the test
{
i=0 ;
while ( lenght > 0 )
{
if (string1[location+i]!= string2[i] )
break ;// return where the string was found
}
if ((lenght-1) == i)
return location ;
}
else
location = string1.find(string2,location+1)
}
return 0 ; // if the string wasn't find at all [p
}
' String to search in.
string SearchString = "XXpXXpXXPXXP"
string SearchChar = "P"
TestPos = InStr(4, SearchString, SearchChar,"Text")
' A binary comparison starting at position 1. Returns 9.
TestPos = InStr(1, SearchString, SearchChar,"binary")
//' If Option Compare is not set, or set to Binary, return //9.
//' If Option Compare is set to Text, returns 3.
//TestPos = InStr(SearchString, SearchChar)
//' Returns 0.
//TestPos = InStr(1, SearchString, "W")
| Is This Answer Correct ? | 0 Yes | 1 No |
How do you track the technical activities in your project? How is the status of the project communicated to the team?
Scenario: -------- -- You are a project manager in a large software house of 375 staff in total. The company has been running for 5 years. The company has been CMM assessed at level 3. The company has many external clients for whom it develops a wide range of business applications. -- Most of the company‘s applications are developed in Java. The waterfall lifecycle development model is normally used in developments. -- The company has historically suffered from the type of problems that are common in the software industry. In particular systems have been delivered not always to user requirements and containing faults. The managing director of the company is very keen for improvements to be made in these areas. -- You are in charge of a project team of 8 developers, 2 requirements engineers and 3 testers. Your team is just about to start a new development. System to Develop :( Exact Question ) ------------------------------------- -- Your team is about to start to develop a novel vehicle navigation system for physically impaired drivers. The navigation system not only identifies the correct route for the driver in the normal way, but also controls the steering wheel to navigate the car to the destination identified by the driver. -- A basic statement of requirements has been received from the customer and budget and timescales have been formalised into a contract. Requires TASK to write : ------------------------ -- You must write a short report (maximum of 1 page) for the managing director of your company outlining how you propose to ensure that this project improves on previous projects in terms of delivering to user requirements and without faults. Your report must include how you propose to show improvement on these issues to your managing director. Also please tell me how should I choose the best software model when given scenarios like these ...?
How do you handle change requests ?
How does the senior management review your project's progress?
How do you estimate the effort for your project? Where is the estimation procedure documented?
How would you deal with changes being made a week or so before the ship date?
What and where are the policy statements for software project planning?
Tell about current project ?
How do you know that a particular individual is the project leader (or) how do you know that you are the Project Leader?
How do you rate yourself in c#,vb.net,Asp.net,oracle,sql server ?
0 Answers 3i Infotech, Choice Solutions, iGate,
Did you used crystal reports? Do you have sufficient knowledge on crystal reports?
What are the different phases of SDLC ?
94 Answers College School Exams Tests, Geometric Software, Infosys, Microsoft, NIIT, Samyak, Sun Microsystems, TCS,