各知名企业笔试题笔经大全

微软亚洲研究院笔试题

微软研究院(亚洲)的网址是:http://research.microsoft.com/asia/
1.改错

#include <stdio.h>
#include <String.h>
class CBuffer
{
  char * m_pBuffer;
  int m_size;
  public:
    CBuffer()
    {
      m_pBuffer=NULL;
    }
    ~CBuffer()
    {
      Free();
    }
    void Allocte(int size)  (3)    {
      m_size=size;
      m_pBuffer= new char[size];
    }
  private:
    void Free()
    {
      if(m_pBuffer!=NULL)
      {
        delete m_pBuffer;
        m_pBuffer=NULL;
      }
    }
    public:
    void SaveString(const char* pText) const
    {
      strcpy(m_pBuffer, pText);
    }
    char* GetBuffer() const
    {
      return m_pBuffer;
    }
};

void main (int argc, char* argv[])
{
  CBuffer buffer1;
  buffer1.SaveString("Microsoft");
  printf(buffer1.GetBuffer());
}

答:改正后
主要改正SaveString函数

void SaveString(const char* pText) const
{
strcpy(m_pBuffer, pText);
}
改为
void SaveString(const char* pText) (1)
{
Allocte(strlen(pText)+1); (2)
strcpy(m_pBuffer, pText);
}
原因:
(1) const成员函数表示不会修改数据成员,而SaveString做不到,去掉const声明
(2) m_pBuffer指向NULL,必须用Allocte分配空间才能赋值。
(3) 另外需要将Allocte成员函数声明为私有成员函数更符合实际

2.下来程序想打印“Welcome MSR Asia”,改正错误

#include <stdio.h>
#include <string.h>
char * GetName (void)
{
  //To return “MSR Asia” String
  char name[]="MSR Asia";
  return name;
}
void main(int argc, char* argv[])
{
  char name[32];
  //Fill in zeros into name
  for(int i=0;i<=32;i++)
  {
    name='/0';
  }
  //copy “Welcome” to name
  name="Welcome";
  //Append a blank char
  name[8]=" ";
  //Append string to name
  strcat(name,GetName());
  //print out
  printf(name);
}

答:改正后为

#include <stdio.h>
#include <string.h>
char * GetName (void)
{
  //To return “MSR Asia” String
  //char name[]="MSR Asia";      (1)  
        char *name=(char *)malloc(strlen("MSR Asia")+1);   
  strcpy(name,"MSR Asia");
  return name;
}
void main(int argc, char* argv[])
{
  char name[32];
  //Fill in zeros into name
  for(int i=0;i<=32;i++)
  {
    name='/0';
  }
  //copy “Welcome” to name
  //name="Welcome";        (2)
  strcat(name,"Welcome ");
  //Append a blank char
//  name[8]=' ';            (3)
  //Append string to name
  char *p=GetName();        (4)
  strcat(name,p);
  free (p);
  //print out
  printf(name);
}
原因:(1)在函数内部定义的变量在函数结束时就清空了,必须动态分配内存
(2)字符串赋值语句错误,应该用strcat
(3)该语句无效,可去掉
(4)定义一个指针指向动态分配的内存,用完后需用free语句释放


3.写出下面程序的输出结果

#include <stdio.h>
class A
{
public:
  void FuncA()
  {
    printf("FuncA called/n");
  }
  virtual void FuncB()
  {
    printf("FuncB called/n");
  }
};

class B: public A
{
public:
  void FuncA()
  {
    A::FuncA();
    printf("FuncAB called/n");
  }
  virtual void FuncB()
  {
    printf("FuncBB called/n");
  }
};

void main(void)
{
  B b;
  A *pa;
  pa=&b;
  A *pa2=new A;
  b.FuncA();      (1)
  b.FuncB();      (2)  
        pa->FuncA();      (3)
  pa->FuncB();      (4)
  pa2->FuncA();      (5)
  pa2->FuncB();
  delete pa2;
}
答:
1.b.FuncA(); 输出
FuncA called
FuncAB called
2.b.FuncB();输出
FuncBB called
上两者好理解,直接调用类B的相应成员函数
3.pa->FuncA();输出
FuncA called 调用类A的FuncA()
4.pa->FuncB();输出
FuncBBcalled调用类B的FuncB(),原因是C++的动态决议机制,当基类函数声明为virtual时,指向派生类对象的基类指针来调用该函数会选择派生类的实现,除非派生类没有才调用基类的虚函数。还有一点注意的是:指向基类类型的指针可以指向基类对象也可以指向派生类对象,如pa=&b;
5. pa2->FuncA();
pa2->FuncB();输出
FuncA called
FuncB called
这也好理解,直接调用类A的相应成员函数

4.In the main() function, after ModifyString(text) is called, what’s the value of ‘text’?

#include <stdio.h>
#include <string.h>
int FindSubString(char* pch)
{
  int count=0;
  char* p1=pch;
  while(*p1!='/0')
  {
    if(*p1==p1[1]-1)
    {
      p1++;
      count++;
    }
    else
    {
      break;
    }
  }
  int count2=count;
  while(*p1!='/0')
  {
    if(*p1==p1[1]+1)
    {
      p1++;
      count2--;
    }
    else
    {
      break;
    }
  }
  if(count2==0)
    return count;
  return 0;
}

void ModifyString(char* pText)
{
  char* p1=pText;
  char* p2=p1;
  while(*p1!='/0')
  {
    int count=FindSubString(p1);
    if(count>0)
    {
      *p2++=*p1;
      sprintf(p2, "%I", count);
      while(*p2!= '/0')
      {
        p2++;
      }
      p1+=count+count+1;
    }
    else
    {
      *p2++=*p1++;
    }
  }
}
void main(void)
{
  char text[32]="XYBCDCBABABA";
  ModifyString(text);
  printf(text);
}
答:我不知道这个结构混乱的程序到底想考察什么,只能将最后运行结果写出来是XYBCDCBAIBAAP

 

百度笔试题 [软件工程师]

            1、请实现两棵树是否相等的比较,相等返回,否则返回其他值,并说明算法复杂度。
数据结构为:
typedef struct_TreeNode{
    char c;
    TreeNode *leftchild;
    TreeNode *rightchild;
}TreeNode;
函数接口为:int CompTree(TreeNode* tree1,TreeNode* tree2);
注:A、B两棵树相等当且仅当Root->c==RootB-->c,而且A和B的左右子树相等或者左右互换相等。

2、写一段程序,找出数组中第k大小的数,输出数所在的位置。例如{2,4,3,4,7}中,第一大的数是7,位置在4。第二大、第三大的数都是4,位置在1、3随便输出哪一个均可。
函数接口为:int find_orderk(const int* narry,const int n,const int k)

2'、已知一个字串由GBK汉字和ansi编码的数字字母混合组成,编写c语言函数实现从中去掉所有ansi编码的字母和数字(包括大小写),要求在原字串上返回结果。
函数接口为:int filter_ansi(char* gbk_string)
注:汉字的GBK编码范围是0x8140-0xFEFE



  1)此题10分  
  对任意输入的正整数N,编写C程序求N!的尾部连续0的个数,并指出计算复杂度。如:18!=6402373705728000,尾部连续0的个数是3。  
  (不用考虑数值超出计算机整数界限的问题)  
   
  2)此题10分  
  编写一个C语言函数,要求输入一个url,输出该url是首页、目录页或者其他url  
  如下形式叫做首页:  
  militia.info/  
  www.apcnc.com.cn/  
  http://www.cyjzs.comwww.greena888.com/  
  www.800cool.net/  
  http://hgh-products.my-age.net/  
  如下形式叫做目录页:  
  thursdaythree.net/greenhouses--gas-global-green-house-warming/  
  http://www.mw.net.tw/user/tgk5ar1r/profile/  
  http://www.szeasy.com/food/yszt/chunjie/  
  www.fuckingjapanese.com/Reality/  
   
  请注意:  
  a) url有可能带http头也有可能不带  
  b)动态url(即含有"?"的url)的一律不算目录页,如:  
  www.buddhismcity.net/utility/mailit.php?l=/activity/details/3135/  
  www.buddhismcity.net/utility/mailit.php?l=/activity/details/2449/  
   
  另:如果你会linux,请用linux下的grep命令实现第2题的功能(附加5分)。  
   
  3)此题40分  
  如果必须从网页中区分出一部分"重要网页"(例如在10亿中选8亿),比其他网页更值得展现给用户,请提出一种方案。  
   
  4)此题40分  
  假设有10亿网页已经被我们存下来,并提供如下信息:网页全文(即网页的源码)、全文长度、网页正文(即网页中提取的主体文字)、  
  正文长度,以及其他网页提取物等,现在希望去掉其中的重复网页,请提出可行的方案,计算出每个网页对应的重复度,你可以自己  
  对网页重复下定义,也可以提出需要哪些更多的网页提取物来实现更好的去重复方案
华为-3COM网络工程师认证(HCNE)试题精选

说明:所收录试题、试卷均为网上下载,仅用于认证学生的复习参考。
注意:1、答案为网上提供答案,注意分辩真伪。
2、从2004年参加认证均为新命令行,注意试题中有些题可能仍为旧命令行的。
1、下列关于ospf协议的说法正确的是:( )
a、 ospf支持基于接口的报文验证
b、 ospf支持到同一目的地址的多条等值路由
c、 ospf是一个基于链路状态算法的边界网关路由协议
d、 ospf发现的路由可以根据不同的类型而有不同的优先级answer:a、b、d2、在运行windows 98的计算机中配置网关,类似于在路由器中配置(     )
a、 直接路由
b、 默认路由
c、 动态路由
d、 间接路由answer:b3、配置访问控制列表必须作的配置是(     )
a、启动防火墙对数据包过滤
b、定义访问控制列表
c、在接口上应用访问控制列表
d、制定日志主机
answer:a、c、d4、dns工作于(     )
a、 网络层
b、 传输层
c、 会话层
d、 表示层
e、 应用层answer:e5、以下关于dte的说法的正确的是(     )
a、 dte是指 数据终端设备
b、 dte是指 数据电路终接设备
c、 dte可以是计算机或计算机终端,也可以是其它数据终端
d、 dte在模拟技术体制下是调制解调器,而在数字技术体制下可以是数据业务单元answer:a、c6、路由器a串口0配置如下
interface serial0
encapsulation ppp
ppp pap sent-username huawei password 0 quidway
ip address 2.2.2.1 255.0.0.0
路由器b串口及全局配置如下
user huawei service-type ppp password 0 quidway
!
interface serial0
clock-select dteclk1
encapsulation ppp
ppp authentication pap
ip address 2.2.2.2 255.0.0.0
当两台路由器串口0相连时,两台路由器是否可以连接到对端(a)
a、 能
b、 不能7、关于千兆以太网,以下说法正确的是(     )
a、 ieee802.3ab定义了千兆以太网
b、 在同一冲突域中,千兆以太网不允许中继器的互连
c、 ieee802.3z专门定义了千兆以太网在双绞线上的传输标准
d、 千兆以太网支持网络速率的自适应,可以与快速以太网自动协商传输速率answer:b8、高层的协议将数据传递到网络层后,形成(     ),而后传送到数据链路层
a、数据帧
b、信元
c、数据包
d、数据段answer:c9、在路由器上配置帧中继静态map必须指定(     )参数
a、 本地的dlci
b、 对端的dlci
c、 本地的协议地址
d、 对端的协议地址answer:a、d10、路由器的主要性能指标不包括(     )
a、 延迟
b、 流通量
c、 帧丢失率
d、 语音数据压缩比answer:d11、一个b类网络,有5位掩码加入缺省掩码用来划分子网,每个子网最多(  d   )台主机
a、510
b、512
c、1022
d、204612、在路由器中,能用以下命令察看路由器的路由表(  d   )
a、 arp -a
b、 traceroute
c、 route print
d、 display ip routing-table13、dhcp客户端是使用地址(   a  )来申请一个新的ip地址的
a、0.0.0.0
b、10.0.0.1
c、127.0.0.1
d、255.255.255.25514、下面有关nat叙述正确的是(  abd   )
a、 nat是英文“地址转换”的缩写,又称地址翻译
b、 nat用来实现私有地址与公用网络地址之间的转换
c、 当内部网络的主机访问外部网络的时候,一定不需要nat
d、 地址转换的提出为解决ip地址紧张的问题提供了一个有效途径15、以下属于正确的主机的ip地址的是( d  )
a、224.0.0.5
b、127.32.5.62
c、202.112.5.0
d、162.111.111.111answer:d16、设置主接口由up转down后延迟30秒切换到备份接口,主接口由down转up后60秒钟切换回主接口的配置为(     )a、 standby timer 30 60
b、 standby timer 60 30
c、 standby timer enable-delay 60 disable-delay 30
d、 standby timer enable-delay 30 disable-delay 60answer:d17、在一个以太网中,30台pc通过qutdway r2501路由器s0口连接internet,quidway r2501路由器配置如下:
qutidway(config-if-e0)#ip address 192.168.1.1.255.255.255.0
qutidway(config-if-e0)eixt
qutidway(config)#interface s0
qutidway(config-if-s0)#ip address 211.136.3.6.255.255.255.252
qutidway(config-if-s0)#encapsulation ppp
一台pc机默认网关为192.168.2.1,路由器会怎样处理发自这台pc的数据包?a
a. 路由器会认为发自这一台pc的数据包不在同一网段,不转发数据包
b. 路由器会自动修正这一台pc机的ip地址,转发数据包
c. 路由器丢弃数据包,这时候需要重启路由器,路由器自动修正误配
d. 路由器丢弃数据包,不做任何处理,需要重配pc网关为192.168.1.118、isdn b信道速率是(b )
a、 16kbps
b、 64kbps
c、 144kbps
d、 2048kbps19、异步串口可以设为( a b)
a、 专线方式
b、 拨号方式
c、 语音方式
d、 pri接入方式20.在quidway路由器上,应该使用什么命令来观察网络的路由表( a )
a. display ip route-path
b. display ip route-table
c. display interface
d. display running-config
e. display ip rip21.以下为局域网协议的有(d f h )
a. ppp
b. x.25
c. slip
d. ethemetll
e. framerelay
f. ethemetsnap
g. ppp-multilink
h. ieee802.322.在配置帧中继子接口时,可配的子接口类型有哪些(a c )
a、 point-to-point
b、 nbma
c、 point-to-multipoint
d、 broadcast23、网络常见的拓扑形式有:(abcde )。
answer:
a 总线
b、星型
c、树型
d、环型
e、网型24、下面的访问控制列表的描述正确的是:(b )
a.access-list 1 deny 1.1.1.1
b.access-list 1 permit any
c.access-list 1 permit 1.1.1.1 0 2.2.2.2 0.0.0.255
d.access-list 99 deny tcp any 2.2.2.2 0.0.0.25525、一些上网用户抱怨他们不能够发送email了,但他们仍然能够接收到新的email信件。那么,作为管理员,下面哪一个项是首先应该检查的:( b)
a.该email服务器目前是否未连接到网络上?
b.处于客户端和email服务器之间的quidway路由器接口的访问列表项是否隐含了deny smtp流量的条目?
c.处于客户端和email服务器之间的quidway路由器接口的访问列表项是否隐含了deny any的条目?
d.处于客户端和email服务器之间的quidway路由器接口的访问列表项是否隐含了deny pop流量的条目?26.  bgp是在( d)之间传播路由的协议
      (a)   主机      (b)   子网
      (c)   区域(area)      (d)   自治系统(as)27.采用单模光纤的1000base-lx网段的理论最大长度为多少? ( b )
  a.100米
  b.10公里
  c.200米
  d.500米28.属于点到点连接的链路层协议有(bd)
a、x.25
b、hdlc
c、atm
d、ppp29. 路由器的作用有(a,b,c,d,e,f)
a. 异种网络互连
b. 子网间的速率适配
c. 隔离网络,防止网络风暴,指定访问规则(防火墙)
d. 子网协议转换
e. 路由(寻径):路由表建立、刷新、查找
f. 报文的分片与重组下面的题原题就记不清楚了,只记得大概和知识点(我找出相似的题或列出了知识点)30.下面关于1000兆以太网口的描述正确的是(多选)(ab )
a、1000m以太网可以提供全双工/半双工通信
b、1000m以太网的物理介质可以采用5类以上双绞线、单模/多模光纤
c、1000m以太网有自动协商功能,可以与低速以太网之间协商速率
d、在同一冲突域中,千兆以太网允许中继器互链
31.arp是什么英文的缩写?
32.fr的特点:虚电路技术
             快速分组交换交换技术
33.x.25 地址映射(ip地址和x.121地址)
34.stp目的
35.关于tcp 问到对端主机建立的是什么?(单选)
       a一条物理链路
       b一条虚链路
       c一条直接链路
36.关于ppp的一些概念
37.---交换机---交换机---交换机---问划分几个广播域(没有vlan的情况下)
38.问dcc的配置命令:display dialer interface s0
39.还有问两个路由器 a:e0:11.111.0.1/30 s0:10.110.0.1/24
                    b: e0: 11.110.0.2/30 s0:10.110.0.2/24
                    所有口都只启动rip v1
                    问a路由器接的本网段的主机,能否和路由器b接的本网段的主机通信
40.关于ospf、rip v2支持vlsm,而rip v1不支持剩下的10道题中有2道关于osi七层协议功能的(包括所传数据单元),主要是传输层、网络层、和数据链路层
还有2道子网划分的题和简单,最后几道题就实在不记得了,不过只要你看过2遍书,是绝对没问题的
华为硬件面试题 [硬件工程师]

全都是几本模电数电信号单片机题目 
 1.用与非门等设计全加法器  
2.给出两个门电路让你分析异同  
3.名词:sram,ssram,sdram 
 4.信号与系统:在时域与频域关系 
 5.信号与系统:和4题差不多  
6.晶体振荡器,好像是给出振荡频率让你求周期(应该是单片机的,12分之一周期..  ..) 
 7.串行通信与同步通信异同,特点,比较 
 8.RS232c高电平脉冲对应的TTL逻辑是?(负逻辑?) 
 9.延时问题,判错  
10.史密斯特电路,求回差电压  
11.VCO是什么,什么参数(压控振荡器?)  
12. 用D触发器做个二分颦的电路.又问什么是状态图  
13. 什么耐奎斯特定律,怎么由模拟信号转为数字信号  
14. 用D触发器做个4进制的计数  
15.那种排序方法最快?  
一、 研发(软件)  用C语言写一个递归算法求N!; 
 给一个C的函数,关于字符串和数组,找出错误; 
 防火墙是怎么实现的?  你对哪方面编程熟悉?
硬件:1、继电器控制电路。
2、SDRAM是怎么工作的
3、写出逻辑表达式说明A2A1A0大于B2B1B0。
4、常用触发器有几种
5、示波器有几种触发方式,举出三种
华为笔试题含答案 [软件工程题]

            写一个程序, 要求功能:求出用1,2,5这三个数不同个数组合的和为100的组合个数。
如:100个1是一个组合,5个1加19个5是一个组合。。。。 请用C++语言写。

答案:最容易想到的算法是:
    设x是1的个数,y是2的个数,z是5的个数,number是组合数
    注意到0<=x<=100,0<=y<=50,0<=z=20,所以可以编程为:


    number=0;
    for (x=0; x<=100; x++)
        for (y=0; y<=50; y++)
            for (z=0; z<=20; z++)
                if ((x+2*y+5*z)==100)
                    number++;
    cout<<number<<endl;


    上面这个程序一共要循环100*50*20次,效率实在是太低了
    事实上,这个题目是一道明显的数学问题,而不是单纯的编程问题。我的解法如下:
    因为x+2y+5z=100
    所以x+2y=100-5z,且z<=20 x<=100 y<=50
    所以(x+2y)<=100,且(x+5z)是偶数
    对z作循环,求x的可能值如下:

     z=0, x=100, 98, 96, ... 0
     z=1, x=95, 93, ..., 1
     z=2, x=90, 88, ..., 0
     z=3, x=85, 83, ..., 1
     z=4, x=80, 78, ..., 0
     ......
     z=19, x=5, 3, 1
     z=20, x=0

    因此,组合总数为100以内的偶数+95以内的奇数+90以内的偶数+...+5以内的奇数+1,
即为:
(51+48)+(46+43)+(41+38)+(36+33)+(31+28)+(26+23)+(21+18)+(16+13)+(11+8)+(6+3)+1


    某个偶数m以内的偶数个数(包括0)可以表示为m/2+1=(m+2)/2
    某个奇数m以内的奇数个数也可以表示为(m+2)/2

    所以,求总的组合次数可以编程为:
    number=0;
    for (int m=0;m<=100;m+=5)
    {
        number+=(m+2)/2;
    }
    cout<<number<<endl;
    这个程序,只需要循环21次, 两个变量,就可以得到答案,比上面的那个程序高效了许多
倍----只是因为作了一些简单的数学分析

    这再一次证明了:计算机程序=数据结构+算法,而且算法是程序的灵魂,对任何工程问
题,当用软件来实现时,必须选取满足当前的资源限制,用户需求限制,开发时间限制等种
种限制条件下的最优算法。而绝不能一拿到手,就立刻用最容易想到的算法编出一个程序了
事——这不是一个专业的研发人员的行为。

    那么,那种最容易想到的算法就完全没有用吗?不,这种算法正好可以用来验证新算法
的正确性,在调试阶段,这非常有用。在很多大公司,例如微软,都采用了这种方法:在调
试阶段,对一些重要的需要好的算法来实现的程序,而这种好的算法又比较复杂时,同时用
容易想到的算法来验证这段程序,如果两种算法得出的结果不一致(而最容易想到的算法保
证是正确的),那么说明优化的算法出了问题,需要修改。
    可以举例表示为:
    #ifdef DEBUG
        int simple();
    #end if
        int optimize();
    ......
    in a function:
    {
        result=optimize();
        ASSERT(result==simple());
    }
    这样,在调试阶段,如果简单算法和优化算法的结果不一致,就会打出断言。同时,在程
序的发布版本,却不会包含笨重的simple()函数。——任何大型工程软件都需要预先设计良
好的调试手段,而这里提到的就是一种有用的方法。



一个学生的信息是:姓名,学号,性别,年龄等信息,用一个链表,把这些学生信息连在一起, 给出一个age, 在些链表中删除学生年龄等于age的学生信息。

#include "stdio.h"
#include "conio.h"

struct stu{
    char name[20];
    char sex;
    int no;
    int age;
    struct stu * next;
}*linklist;
struct stu *creatlist(int n)
{
    int i;
    //h为头结点,p为前一结点,s为当前结点
    struct stu *h,*p,*s;
    h = (struct stu *)malloc(sizeof(struct stu));
    h->next = NULL;
    p=h;
    for(i=0;i<n;i++)
    {   
        s = (struct stu *)malloc(sizeof(struct stu));
        p->next = s;
        printf("Please input the information of the student: name sex no age /n");
        scanf("%s %c %d %d",s->name,&s->sex,&s->no,&s->age);
        s->next = NULL;
        p = s;
    }
    printf("Create successful!");
    return(h);
}
void deletelist(struct stu *s,int a)
{
struct stu *p;
while(s->age!=a)
{
  p = s;
  s = s->next;
}
if(s==NULL)
  printf("The record is not exist.");
else
{
  p->next = s->next;
  printf("Delete successful!");
}
}
void display(struct stu *s)
{
s = s->next;
    while(s!=NULL)
    {
        printf("%s %c %d %d/n",s->name,s->sex,s->no,s->age);
        s = s->next;
    }
}
int main()
{
    struct stu *s;
int n,age;
printf("Please input the length of seqlist:/n");
scanf("%d",&n);
    s = creatlist(n);
    display(s);
printf("Please input the age:/n");
scanf("%d",&age);
deletelist(s,age);
display(s);
    return 0;
}

2、实现一个函数,把一个字符串中的字符从小写转为大写。

#include "stdio.h"
#include "conio.h"

void uppers(char *s,char *us)
{
    for(;*s!='/0';s++,us++)
    {
        if(*s>='a'&&*s<='z')
            *us = *s-32;
        else
            *us = *s;
    }
    *us = '/0';
}
int main()
{
    char *s,*us;
    char ss[20];
    printf("Please input a string:/n");
    scanf("%s",ss);
    s = ss;
    uppers(s,us);
    printf("The result is:/n%s/n",us);
    getch();
}

随机输入一个数,判断它是不是对称数(回文数)(如3,121,12321,45254)。不能用字符串库函数   

/***************************************************************
1.
函数名称:Symmetry
功能: 判断一个数时候为回文数(121,35653)
输入: 长整型的数
输出: 若为回文数返回值为1 esle 0
******************************************************************/
unsigned char Symmetry (long n)
{
  long i,temp;
  i=n; temp=0;
  while(i) //不用出现长度问题,将数按高低位掉换
  {
    temp=temp*10+i%10;
    i/=10;
  }
  return(temp==n);
}
方法一
/* ---------------------------------------------------------------------------
功能:
判断字符串是否为回文数字
实现:
先将字符串转换为正整数,再将正整数逆序组合为新的正整数,两数相同则为回文数字
输入:
char *s:待判断的字符串
输出:

返回:
0:正确;1:待判断的字符串为空;2:待判断的字符串不为数字;
3:字符串不为回文数字;4:待判断的字符串溢出
---------------------------------------------------------------------------- */
unsigned IsSymmetry(char *s)
{
char *p = s;
long nNumber = 0;
long n = 0;
long nTemp = 0;

/*判断输入是否为空*/
if (*s == /'//0/')
return 1;

/*将字符串转换为正整数*/
while (*p != /'//0/')
{
/*判断字符是否为数字*/
if (*p</'0/' || *p>/'9/')
return 2;

/*判断正整数是否溢出*/
if ((*p-/'0/') > (4294967295-(nNumber*10)))
return 4;

nNumber = (*p-/'0/') + (nNumber * 10);

p++;
}

/*将数字逆序组合,直接抄楼上高手的代码,莫怪,呵呵*/
n = nNumber;
while(n)
{
/*判断正整数是否溢出*/
if ((n%10) > (4294967295-(nTemp*10)))
return 3;

nTemp = nTemp*10 + n%10;
n /= 10;
}

/*比较逆序数和原序数是否相等*/
if (nNumber != nTemp)
return 3;

return 0;
}

方法二
/* ---------------------------------------------------------------------------
功能:
判断字符串是否为回文数字
实现:
先得到字符串的长度,再依次比较字符串的对应位字符是否相同
输入:
char *s:待判断的字符串
输出:

返回:
0:正确;1:待判断的字符串为空;2:待判断的字符串不为数字;
3:字符串不为回文数字
---------------------------------------------------------------------------- */
unsigned IsSymmetry_2(char *s)
{
char *p = s;
int nLen = 0;
int i = 0;

/*判断输入是否为空*/
if (*s == /'//0/')
return 1;

/*得到字符串长度*/
while (*p != /'//0/')
{
/*判断字符是否为数字*/
if (*p</'0/' || *p>/'9/')
return 2;

nLen++;
p++;
}

/*长度不为奇数,不为回文数字*/
if (nLen%2 == 0)
return 4;

/*长度为1,即为回文数字*/
if (nLen == 1)
return 0;

/*依次比较对应字符是否相同*/
p = s;
i = nLen/2 - 1;
while (i)
{
if (*(p+i) != *(p+nLen-i-1))
return 3;

i--;
}

return 0;
}

求2~2000的所有素数.有足够的内存,要求尽量快


答案:
int findvalue[2000]={2};
static int find=1;
bool adjust(int value)
{
assert(value>=2);
if(value==2) return true;
for(int i=0;i<=find;i++)
{
if(value%findvalue==0)
return false;
}
findvalue[find++];
return true;
}
中兴面试题目 [软件工程师]



1.对数据库的一张表进行操作,同时要对另一张表进行操作,如何实现??
2.TCP/IP 建立连接的过程?(3-way shake)
3.ICMP是什么协议,处于哪一层?
4.触发器怎么工作的?
5.winsock建立连接的主要实现步骤?
6.动态连接库的两种方式?
7.IP组播有那些好处?

 

 Sony笔试题

1.完成下列程序
*
*.*.
*..*..*..
*...*...*...*...
*....*....*....*....*....
*.....*.....*.....*.....*.....*.....
*......*......*......*......*......*......*......
*.......*.......*.......*.......*.......*.......*.......*.......
#include
#define N 8
int main()
{
int i;
int j;
int k;
---------------------------------------------------------
│ │
│ │
│ │
---------------------------------------------------------
return 0;
}
答:

#define N 8
int main()
{
int i;
int j;
int k;

for(i=0;i<N;i++)
{
for(j=0;j<i+1;j++)
{
printf("*");
for(k=0;k<i;k++)
printf(".");
}
printf("/n");
}
return 0;
}

2.完成程序,实现对数组的降序排序
#include
void sort( );
int main()
{
int array[]={45,56,76,234,1,34,23,2,3}; //数字任意给出
sort( );
return 0;
}
void sort( )
{
---------------------------------------------------------
│ │
│ │
│ │
---------------------------------------------------------
}
答:使用选择排序法,我为sort函数多加了两个形参,至少第一个是必须的,否则无法传入待排序数组。不知道这样做是否符合题意。

void sort(int *array,int num)
{
int temp;
for(int i=0;i<num-1;i++)
for(int j=i+1;j<num;j++)
if (array <array[j])
{
temp=array;
array=array[j];
array[j]=temp;
}
}


3.费波那其数列,1,1,2,3,5……编写程序求第十项。可以用递归,也可以用其他方法,但要说明你选择的理由。
#include
int Pheponatch(int);
int main()
{
printf("The 10th is %d",Pheponatch(10));
return 0;
}
int Pheponatch(int N)
{
--------------------------------
│ │
│ │
--------------------------------
}
答:
使用递归,理由是递归编程简单,代码容易理解,但缺点是效率不高,而且有深度限制,如果深度太深,则堆栈会溢出。

int Pheponatch(int N)
{
if (N==3)
return 2;
else if (N==2||N==1)
return 1;
else
return Pheponatch(N-1)+Pheponatch(N-2);
}

4.下列程序运行时会崩溃,请找出错误并改正,并且说明原因。

#include <stdio.h>
#include <malloc.h>
typedef struct TNode
{
TNode* left;
TNode* right;
int value;
}TNode;

TNode* root=NULL;
void append(int N);

int main()
{
append(63);
append(45);
append(32);
append(77);
append(96);
append(21);
append(17); // Again, 数字任意给出
return 0;
}

void append(int N)
{
TNode* NewNode=(TNode *)malloc(sizeof(TNode));
NewNode->value=N;
NewNode->left=NULL; //新增
NewNode->right=NULL; //新增
if(root==NULL)
{
root=NewNode;
return;
}
else
{
TNode* temp;
temp=root;
while((N>=temp->value && temp->left!=NULL)||(N<temp->value && temp->right!=NULL))
{
while(N>=temp->value && temp->left!=NULL)
temp=temp->left;
while(N<temp->value && temp->right!=NULL)
temp=temp->right;
}
if(N>=temp->value)
temp->left=NewNode;
else
temp->right=NewNode;
return;
}
}
答:因为新节点的左右指针没有赋NULL值,至使下面的while循环不能正确结束而导致内存越界,最后崩溃(注意结束条件是temp->left!= NULL或temp->right!=NULL)。改正就是增加两条赋值语句,如上文红色部分字体就是新增的两条语句。
DELL的英文面试题(硬件部分和操作系统)


Technical Components
Part1 Hardware (40%)
1. CPU stands for ______ b
a. Cyber Processing Unit
b. Central processing Unit
c. Chief Processing Unit
d. Celeron Processing Unit.

2. DDR2 Module has ____ pins.
a. 72
b. 164
c. 184
d. 240

3. Which type of Intel CPU has no pins integrated on package?
a. Socket 775
b. Socket 478
c. Slot 1
d. Socket A

4. The speed of USB 2.0 is ____MB/s.
a. 1.5
b. 12
c. 128
d. 480

5. One IDE cable can connect ___ IDE device(s) like HD or CDROM.
a. 1
b. 2
c. 3
d. 4

6. If you enable Hyper-Threading of your dual-core CPU, you can see ____ CPU(s) displayed in Device Manager.
a. 1
b. 2
c. 3
d. 4

7. HT of CPU is a good technology in many high-level CPU. HT stands for ____.
a. High Tech
b. Huge Terminal
c. Hyper Threading
d. High Transporting

8. You bought a 160G hard drive, but in Windows XP, you can only see about 147G in disk management tool. Why? b

a. Your partitions tables use others space.
b. It’s the difference between Decimal System and Binary System.
c. You should install XP with SP2.
d. Maybe you create a un-supported partition in windows XP.

9. South bridge chipset works with ________, usually it locates far away from CPU. (Choose all the answers)
a. Memory controller
b. HD controller
c. AGP controller
d. USB controller

10. Each SATA cable can connect __ SATA hard drive(s).
a. 1
b. 2
c. 3
d. 4

11. RAID 1 is ______
a. Disk mirroring
b. Disk striping
c. Disk ghosting
d. Disk protecting

12. Which of the following is/are interface standard of HardDrive. (Choose all the answers)
a. PATA
b. SATA
c. SCSI
d. SAS

13. Which resolution rate will CRT run when you select VGA mode in Windows? c
a. 640*480
b. 800*600
c. 1024*768
d. 1280*1024

14. Which resolution and fresh rate is the best one for 17“ SXGA Lcd? b
a. 800*600@60hz
b. 1024*768@80hz
c. 1280*1024@60hz
d. 1600*1200@80hz

15. PC3200 Memory’s clock speed is ____ Mhz.
a. 266
b. 333
c. 400
d. 533

16. If you want to install RAMBUS memory modules, you must use __ module(s) together.
a. 1
b. 2
c. 3
d. 4

17. Can AGP 2X video card work in AGP 8X slot?
a. yes, but video card only works in 2X.
b. yes, and video card will work in 8X.
c. no, though you can plug it into such slot, it can’t work due to different voltage supported
d. no, you can’t plug 2X video card into 8X slot even.

18. Which of the following jumper modes can you find in PATA HD. (Choose all the answers)
a. Master
b. Slave
c. Cable select
d. single

19. Can you install a 2.1 channel speaker into a 5.1 audio system?
a. yes.
b. no.

20. Can USB keyboard works in BIOS setting menu?
a. Yes, but it depends on BIOS’ support.
b. Yes, and no requirements for the BIOS version.
c. Yes, but you just can enter BIOS with USB keyboard, you can’t change items in BIOS.
d. No, you only can use PS/2 keyboard in BIOS.

Part2 Network (30%)
21. One user has a new computer with Windows XP installed. The system was functional well while no network connected. He connected an ADSL modem to the NIC. During reboot, Windows XP froze for about one minute before entering into windows. What shall we do to solve this issue?
A) Reinstall NIC driver
B) Replace ADSL modem
C) Set IP address manually
D) Set correct subnet mask

22. Under Windows XP, which command would you use to trace a packet from source host to destination host?
A) TRACERT
B) ROUTE
C) BTSTAT
D) IPCONFIG

23. You notice that the subnet mask is 0.0.0.0 on your Windows XP computer while using the IPCONFIG utility at the command prompt to check for IP address configuration. What does it mean when the IPCONFIG utility displays a subnet mask of 0.0.0.0?
A)The default gateway on your computer does not match the default gateway of the network.
B)Your computer has the same subnet mask as another computer on the network.
C)Your computer does not have the correct IP address class specified for it.
D)Your computer has the same IP address as another computer on the network.

24. If you want to give up its lease with a DHCP server, what command would you use to accomplish the task?
A) ipconfig/endlease
B) ipconfig/release
C) route/release
D) route/end lease

25. You type command 'Ping' to visit 127.0.0.1 successfully, what's that mean?
A) TCP/IP protocol work normally.
B) PC can visit internet.
C) Network card get IP from DHCP server.
D) Network card is a integrated device.

26. What type of system is used to visit correct IP by using name for a website?
A) DNS
B) Transaction
C) Index
D) Search

27. Which of the following IP address range is not reserved for private network?
A) 192.168.0.0 - 192.168.255.255
B) 10.0.0.0 - 10.255.255.255
C) 172.16.0.0 - 172.31.255.255
D) 1.0.0.0 - 1.255.255.255

28. Which command would you use to view the IP settings on a win2k/winxp system?
A) CMD
B) winipcfg
C) ipconfig
D) ifconfig

29. Which port does HTTP use by default?
A) 20
B) 21
C) 80
D) 81

30. We want connect 2 hosts by a direct connection UTP cable for a 10M network. Now which pins need to match when we add RJ45 plug.
A) 1-1, 2-2, 3-3, 6-6
B) 1-3, 2-6, 3-1, 6-2
C) 1-2, 2-1, 3-6, 6-3
D) can’t made this kind of cable.

Part3 Operation System (30%)

31. What is the difference between Quick Format and Format?


A) When you choose to run a regular format on a volume, files are removed from the volume that you are formatting.
B) If you choose Quick format option, format will not remove files from the partition,
C) Hard disk will be scanned for bad sectors if you choose regular format option.
D) The system will not check hard disk for bad sectors neither choosing Quick option nor regular option.



32 How many Extended Drives does it show on the picture below?

A) 1
B) 2
C) 3
D) 4

33. Which one of the following is NOT a feature of Windows XP SP2?
A) NX Technology (Data Execution Prevention)
B) Pop-Up Blocker
C) Spam Blocker
D) Windows Firewall


34. If there is no listing for SP2 in the Add/Remove Programs list, it can be uninstalled manually. (Windows XP SP2)
A) False
B) True

35. If a customer has Windows Update set to automatic, he will still have to visit the web to download Service Pack 2. (Windows XP SP2)
A) False
B) True

36. Windows Firewall will be enabled by default on which of the following interfaces? (Windows XP SP2)
A) All of the answers are correct
B) Dial-Up Connection
C) Local Area Network (LAN)

37. If the customer is having a problem with the Windows Firewall, what is the best solution? (Windows XP SP2)

A) Correct the configuration settings of the firewall
B) Give the customer the support contact numbers for Microsoft.
C) Suggest the customer downloads a 3rd party firewall
D) Turn the firewall off

38. We’ve just replaced a hard drive for a customer. Previously the customer had a 30G hard drive formatted in a single FAT32 partition. The customer received a 40G drive and wants it partitioned the same way. How would you handle this situation?

A We can create a single volume with 40G then format it as FAT32 partition
B Suggest customer to format the single 40G volume as FAT16 partition
C Suggest customer to format the single 40G volume as NTFS partition
d Say NO to customer, we ‘re unable to do that.

39. Which command is right to fix errors on the disk?
A chkdsk /f
B diskprobe
C fdisk
D format /q

40. Windows XP Media Center Edition 2005 has all the features of Windows XP SP2.
A) False
B) True
大唐电信笔试面试题

考试时间一小时,第一部分是填空和选择:
  1.数列6,10,18,32,“?”,问“?”是几?
  2.某人出70买进一个x,80卖出,90买回,100卖出,这桩买卖怎么样?
  3.月球绕地球一圈,至少要多少时间?
  4.7个人用7小时挖了7米的沟,以同样的速度在50小时挖50米的沟要多少人?
  5.鱼头长9,鱼尾等于鱼头加半个鱼身,鱼身等于鱼头加鱼尾,问鱼全长多少?
  6.一个小姐买了一块手表,回家发现手表比她家的表慢了两分钟,晚上看新闻的时候又发现她家的表比新闻里的时间慢了两分钟,则 。
  A 手表和新闻里的时间一样
  B 手表比新闻里的时间慢
  C 手表比新闻里的时间快
  7.王先生看到一则招聘启事,发现两个公司除了以下条件不同外,其他条件都相同
  A 半年年薪50万,每半年涨5万
  B 一年年薪100万,每一年涨20万
  王先生想去一家待遇比较优厚的公司,他会去哪家?
  10.问哪个袋子里有金子?
  A袋子上的标签是这样写的:B袋子上的话是对的,金子在A袋子。
  B袋子上的标签是这样写的:A袋子上的话是错的,金子在A袋子里。
  11.3个人住酒店30块钱,经理找回5块钱,服务生从中藏了2块钱,找给每人1块钱,3×(101)+2=29,问这是怎么回事?
  12.三篇写作,均为书信形式。
  (1)一片中文的祝贺信,祝贺某男当了某公司xx
  (2)两篇英文的,一是说有事不能应邀,派别人去;另一篇是讨债的,7天不给钱就走人(主要考business letter格式)。

  面试试题

  1.什么是中断?中断发生时CPU做什么工作?
  2.CPU在上电后,进入操作系统的main()之前必须做什么工作?
  3.简述ISO OSI的物理层Layer1,链路层Layer2,网络层Layer3的任务。
  4.有线电话和无线电话有何区别?无线电话特别需要注意的是什么?
  5.软件开发五个主要step是什么?
  6.你在开发软件的时候,这5个step分别占用的时间百分比是多少?
  7.makefile文件的作用是什么?
  8.UNIX显示文件夹中,文件名的命令是什么?能使文件内容显示在屏幕的命令是什么?
  9.(选做)手机用户在从一个基站漫游到另一个基站的过程中,都会发生什么?
大唐面试题II

1.什么是中断?中断发生时CPU做什么工作?

2.CPU在上电后,进入操作系统的main()之前必须做什么工作?

3.简述ISO OSI的物理层Layer1,链路层Layer2,网络层Layer3的任务。

4.有线电话和无线电话有何区别?无线电话特别需要注意的是什么?

5.软件开发五个主要step是什么?

6.你在开发软件的时候,这5个step分别占用的时间百分比是多少?

7.makefile文件的作用是什么?

8.UNIX显示文件夹中,文件名的命令是什么?能使文件内容显示在屏幕的命令是什么?

9.(选做)手机用户在从一个基站漫游到另一个基站的过程中,都会发生什么?

 

高通笔试题

1. Can you describe the trend of wireless mobile communication industry? (2000 letters) 2. Compare the major third generation technologies.(2000 letters) 3. Describe the characteristics of Walsh function. Explain how to generate Walsh Function. (2000 letters) 4. List factors that will affect the capacity of forward and reverse links of a CDMA system. (2000 letters) 5. What are the differences between IS-95 A/B and cdma2000 1X? (2000 letters)


 -------------------------------------------
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值