测试MS面试题
来源:互联网 发布:足球实时数据 编辑:程序博客网 时间:2024/05/06 22:07
1、排序一个有大小字符,数字组成的字符串,例如EBa37-->37BEa
string inputs = "EBa37"; char[] result = inputs.ToCharArray(); char copyInputs; for (int i = 0; i < result.Length - 1; i++) { for (int j = i; j < result.Length; j++) { if (result[i] > result[j]) { copyInputs = result[j]; result[j] = result[i]; result[i] = copyInputs; } } } }
2、判断一个输入是不是水仙花状,如66566,2b22b2是,123321k不是
string inputs = "123321k"; int stringLength = inputs.Length; bool isFlower = true; for (int i = 0; i < stringLength / 2; i++) { if (inputs[i] != inputs[stringLength - i - 1]) { isFlower = false; break; } }
3、转换2进制、8进制、16进制表示的数字转换成为Decimal类型,任意选用语言,不得使用语言内部实现的类型转换函数/方法
如果使用.NET提供的转换则:Console.Write(Convert.ToInt32("101", 8));
static void ConvertType(string value, int type) { double currentType = Convert.ToDouble(type.ToString()); decimal hello = 0; int powIndex = -1; for (int i = value.Length - 1; i >= 0; i--) { powIndex++; if (Convert.ToDouble(value[i].ToString()) != 0) { hello += (decimal)System.Math.Pow(currentType, powIndex); } } Console.Write(hello); }
4、把一个数组中的重复元素挑出来然后并到数组尾部
(1)把重复的放到数组尾部
string stringInputs = "benqbqcbqs"; char[] userChar = stringInputs.ToCharArray(); List<string> list = new List<string>(); StringBuilder sbRepeateObject = new StringBuilder(userChar.Length); string userObject = ""; for (int i = 0; i < userChar.Length; i++) { userObject = userChar[i].ToString(); if (!list.Contains(userObject)) { list.Add(userObject); } else { sbRepeateObject.Append(userObject.ToString()); } } list.Add(sbRepeateObject.ToString());
(2)把所有重复的字符都放至数组尾部
string stringInputs = "benqbqcbqs"; string repeatString = ""; string originString = ""; string currentString = ""; for (int i = 0; i < stringInputs.Length; i++) { currentString = stringInputs[i].ToString(); if (Regex.Matches(stringInputs, currentString).Count == 1) { originString += currentString; } else { repeatString += currentString; } } Console.WriteLine(originString + repeatString);
- 测试MS面试题
- MS面试题
- MS的面试题
- MS的一道面试题~,求解
- 上周五的MS一道面试题
- 软件测试面试题
- 软件测试面试题
- 软件测试面试题
- 测试面试题2
- 软件测试面试题
- 测试面试题之一
- 软件测试面试题
- 性能测试面试题
- 性能测试面试题
- 性能测试面试题
- 软件测试面试题
- 面试题测试
- 测试笔试、面试题
- 用场景树来组织场景
- CSS应用小技巧十四例
- 常用CPLD/FPGA 标识的含义
- 网络游戏发展历史
- 架构(SOA)安全标准 过犹不及?
- 测试MS面试题
- 全角、半角字符相互转换
- 一个程序员的成长的六个阶段
- 简单状态机Workflow基于Web应用
- 僕の仕事が何処だ?
- 负载压力测试基础概念
- XML和XSL生成类PowerPoint组织结构图
- お仕事ついに来た!
- 常用的WEB功能测试方法