试题

深圳市福田区商报东路景明达酒店—莲兴苑8A(到北大医院或景新花园下)
  龙控科技开发有限公司(主要做安防、 网控等软、 硬件)
  以下试题有一定难度, 做完 1 /3 即可能被公司录用。 所有题不要求完整, 但要细量详
  细。 (共1 0 题)
  (所有题不要求具体语言, vb,c,c++,j ava 都可)
  1 . 写一个输入整数( 如 1 23456789 ) 转换为二进制的程序, 如输
 
入 32 则输出
  1 000000;
  答:
  private static string str = string. Empty;
   public string f(int m)
   {
   string sb = string. Empty;
   if (m == 0)
   {
   sb = "0";
   }
   if (m > 0)
   {
   f(m / 2) ;
   sb = (m % 2) . ToString() ;
   }
   str += sb;
   return str;
   }
  2. 写出对1 00 个整数进行排序的程序, 要求用两种不同的排序方法;
  答:
  冒泡法:
  public int[] maoPao(int[] list)
   {
   int i, j, temp;
   bool done = false;
   j = 1;
   while ((j < list. Length) && (! done) )
   {
   done = true;
   for (i = 0; i < list. Length - j; i++)
   {
   if (list[i] > list[i + 1] )
   {
   done = false;
   temp = list[i] ;
   list[i] = list[i + 1] ;
   list[i + 1] = temp;
   }
   }
   j++;
   }
   return list;
  }
  选择法:
  private int min;
   public void Sort(int[] list)
   {
   for (int i = 0; i < list. Length - 1; i++)
   {
   min = i;
   for (int j = i + 1; j < list. Length; j++)
   {
   if (list[j] < list[min] )
   min = j;
   }
   int t = list[min] ;
   list[min] = list[i] ;
   list[i] = t;
   }
   }
  3. 写出一个字符串替换程序如输入” Welcome to comp”,将“co”替换成” abc”, 即为
  ” Wel abcme to abcmp”, 要求不能作任何系统提供的函数如 strrepalce 等。
  答:
  public string replace(string str)
   {
   int count = str. Length;
   string[] strs = new string[count] ;
   string reStr = string. Empty;
   for (int i = 0; i < count; i++)
   {
   strs[i] = str. Substring(i, 1) ;
   }
   for (int k = 0; k < count; k++)
   {
   if (k + 1 < count)
   {
   if (strs[k] + strs[k + 1] == "co")
   {
   strs[k] = "a";
   strs[k + 1] = "bc";
   }
   }
   reStr += strs[k] ;
   }
   return reStr;
   }
  4. 设计数据库中有两个表, 当主表中的一条记录删除时, 副表中的相关记录全部自
  动删除。
  答: delete from 副表 where 主表号in (select 主表号 from 主表 where 条件);
  deleter from 主表 where 条件;
  注意: 两个的顺序不能弄反了。
  5. 写两个类, 子类中的方法在父类中实现。
  答:
  public class a
  {
   public void Fun()
   {
   Console. WriteLine("a. Fun() ") ;
   }
  }
  public class b : a
  {
   public void Fun()
   {
   base. Fun() ;
   }
  }
  6. 从数据库中查一个表, 将表中的所有数据输出到磁般中的一个文件中。
  //filePath是文件地址
   public void write(string filePath)
   {
   SqlConnection con = new SqlConnection() ;
   con. ConnectionString = "Server=. ; database=pubs; uid=sa; pwd=sa";
   SqlCommand cmd = new SqlCommand() ;
   cmd. CommandType = CommandType. Text;
   cmd. CommandText = "select * from authors";
   cmd. Connection = con;
   try
   {
   con. Open() ;
   StreamWriter sw = new StreamWriter(filePath, false, Encoding. GetEncoding("gb2312") ) ;
   SqlDataReader sdr = cmd. ExecuteReader(CommandBehavior. SingleResult) ;
   while (sdr. Read() )
   {
   for (int i = 0; i < sdr. FieldCount; i++)
   {
   sw. WriteLine((sdr. GetValue(i) . ToString() + "| | | | ") ) ;
   }
   Response. Write("/n") ;
   }
   sw. Close() ;
   sdr. Close() ;
   }
   finally
   {
   con. Close() ;
   }
   }
  7. 用 vb 或其它写一个stock server 和 clinel 通讯的例子;
  8. 一个线通讯的题, 记不清了!
  9. 写一个父线程控制线程运行的例子。
  1 0. 谈谈你对龙控公司的认识和你想在龙控公司所从事的岗位和工作。【天涯博客】本文地址http://blog.tianya.cn/blogger/post_show.asp?BlogID=1909439&PostID=16590111

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值