Microsoft Interview for SDET2

They will chat your porject with you in english. and then wirter some algorithm,then write some test case.
 
 1. Give you a website which just implement one function: translating. such as: Chinese will be translated to English. there is a Textbox to input,a Button to click and a Label to return the result from translated.
 Question: please try to write more test cases to test this website.
 
 // The below algorithm is from Microsoft
2.  The function will return the count of str1 containing str2.
        such as: str1=abc, str2=ab, return 1
        str1=aaa, str2=aa, return 2 ....
  
        /// <summary>
        ///  The function will return the count of str1 containing str2.
        ///  such as: str1=abc, str2=ab, return 1
        ///  str1=aaa, str2=aa, return 2 ....
        /// </summary>
        /// <param name="str1"></param>
        /// <param name="str2"></param>
        /// <returns></returns>
        public int ContainNumber(string str1, string str2)
        {
            if (string.IsNullOrEmpty(str1))
                return 0;
            if (string.IsNullOrEmpty(str2))
                return 0;
            if (str1.Length < str2.Length)
                return 0;
            int number = 0;
            int i=0;
                while(str1.Length - i >= str2.Length)
                {
                    string temp = str1.Substring(i, str2.Length);
                    if (temp == str2)
                    {
                        number++;
                    }
                    i++;
                }
           
            return number;
        }

        /// <summary>
        /// the function will return the content between quotation in one string inputed.
        /// such as:   input str:  I am "from" china, I love "china". this sentence will return a list which take two eletements
        /// from, china.
        /// </summary>
        /// <param name="str"> </param>
        /// <returns></returns>
        public List<string> GetContentOfQuotation(string str)
        {
            if (string.IsNullOrEmpty(str))
                return null;
            List<string> Qlist = new List<string>();
            int i=0;
            int start = 0;
            while (i < str.Length)
            {
                if (str[i] == '"')
                {
                    start = i;
                    i++;
                    while (i < str.Length)
                    {
                        if (str[i] == '"')
                        {
                            Qlist.Add(str.Substring(start+1, i - start-1));
                            break;
                        }
                        i++;
     }                  
                }
                i++;
            }
            return Qlist;
        }

       /*
        At last:  All the method, you should writte test case to test these method.      
       */

 

4. how to ensure night point on one circular?

-------------------------------------------------------------

5. reverse wards by space. And write test case

6. Given two parameters, string sentence and int length. Then you should cut the sentence by the specific length. But if the cut point located in a vocabulary, you move the cut point in the previous space in0 front of the vocabulary. And write test case

Example:

String : I love this game.

Length: 6

Result: I love

                this

                game.

 

String : I love basketball.

Length: 6

Result: I love

Give a message here: the cut point located in “basketball” which is a vocabulary

posted @   tomin  阅读(1020)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
历史上的今天:
2008-11-17 数据库的完整性设计
2008-11-17 ASP.NET中常用的26个优化性能方法
点击右上角即可分享
微信分享提示