C/C++笔试题(12)

 

香港电信笔试题

 

 


  1. Based on your understanding of the following java related technologies: servlets, JavaServerPage, JavaBeans, Enterprise JavaBeans, how do you think these technologies are work together or are applied in the development of an internet-based application (25marks).
  
2. In your opinion ,what do you think are the advantages or benefitsof using an object-oriented approach to software development? how do you think those benefits can be achieved or realized? (15marks).
  
3. In designing your classes, given the choice between inheritance and aggregation which do you choose (15marks).
  
4. How would you work around the lack of multiple inheritance feature in Java (15marks).
  
5. What would you consider to be the hardest part of OO analysis and design and why (10marks).
  
6. How do you keep yourself up to date with the latest in software techonogy, especially in the field of software development (10marks).
  
7. What si your career aspiration? Why do you think this E-Commerce Development Center can help you in achieving your career goals (10marks) (1hr, answer in English).
  

  

LORAL的笔试题


  1. Would you please describe yourself in 3-4 lines? (limited in 500 words)
  
2. Could you tell us why we should choose you as a Loreal Person, and what makes you unique? (limited in 500 words)
  
3. What is your short-term and long-term career plan? (limited in 500 words)
  
4. What kind of group activities are you interested in and what type of role do you often play? (limited in 500 words)
  
5. Please use one sentence to give a definition of ‘Beauty’, and describe the most beautiful thing in your life. (limited in 500 words)
  


维尔VERITAS软件笔试题


  1. A class B network on the internet has a subnet mask of 255.255.240.0, what is the maximum number of hosts per subnet .
  
a. 240 b. 255 c . 4094 d. 65534
  
2. What is the difference: between o(log n) and o(log n^2), where both logarithems have base 2 .
  
a. o(log n^2) is bigger b. o(log n) is bigger
  
c. no difference
  
3. For a class what would happen if we call a class’s constructor from with the same class’s constructor .
  
a. compilation error b. linking error
  
c. stack overflow d. none of the above
  
4. “new” in c++ is a: .
  
a. library function like malloc in c
  
b. key word c. operator
  
d. none of the above
  
5. Which of the following information is not contained in an inode .
  
a. file owner b. file size
  
c. file name d. disk address
  
6. What’s the number of comparisons in the worst case to merge two sorted lists containing n elements each .
  
a. 2n b.2n -1 c .2n+1 d.2n-2
  
7. Time complexity of n algorithm T(n), where n is the input size ,is T(n)=T(n-1)+1/n if n>1 otherwise 1 the order of this algorithm is .
  
a. log (n) b. n c. n^2 d. n^n
  
8. The number of 1’ s in the binary representation of 3*4096+ 15*256+5*16+3 are .
  
a. 8 b. 9 c . 10 d. 12
  

  

百威啤酒(武汉公司)


  1,为什么申请来百威?
  2,将来有什么打算
?
  3,有没有社会活动经历
?
  4,有没有当众演讲的经历
?
  5,经常使用那些软件
?
  6,喜欢哪些课程
?
  7,你认为工作中的什么因素对你来说最重要
?
  8,什么时候可以来上班?可以在这里工作多久
?
  9,八点上班,要加班和出差,能不能做到
?
  

星巴克


  1 您是一家咖啡店的店经理,你发现店内同时出现下列状况:
   1)许多张桌子桌面上有客人离去后留下的空杯未清理,桌面不干净待整理。
   2)有客人正在询问店内卖哪些品种,他不知如何点咖啡菜单。
   3)已有客人点完成咖啡,正在收银机旁等待结帐。
   4)有厂商正准备要进货,需要店经理签收。
    请问,针对上述同时发生的情况,你要如何排定处理之先后顺序,为什么
  2 有一位甲员工脾气不好以致在前三家店因为与店内其他同事相处不佳而屡屡调动,现在甲被调到你的店里面来,请问身为店经理的你,将如何应对??
  3 你是店经理,本周五结帐后,发现门市总销售额较上周五减少30%,请问可能原因会是哪几种,各原因如何应对?
  


凹凸电子软件笔试题

 

 


  1. Select ONE of the following projects to discuss:
  
a. Signal Filtering: You are given a sampled realtime waveform consisting of a sensor reading mixed with highly periodic impulses and high frequency noise.The desired output is the realtime filtered sensor signal with the impulses and noise removed, and a readout of the impulse period. The FFT may not be used.
  
b. Interrupt Processing.A headware register consisting of eight independent edge triggered latches is used to record external asynchronous interrupt requests. When any of the request bits are latched, a software interrupt is generated. The software may read the latch to see which interrupt(s) occurred. Writing a one to any latch bit will clear the latch. How does that software assure that no interrupt request is ever missed?
  
c. User Interface: a prototype MP3 player interface consisting of a playlist display and a few control buttons is given to you. How would you make the interface “skinnable”,with user selected graphics, options, and control button placement?
  
Each project description is incomplete. What questions would you ask to completely specify the project? What development tools would you prefer to use? What algorithm /data structures/design would you use?
  
2. What program(s) have you coded for you own enjoyment (not part of a school project,not for pay). What type of software project would you most enjoy working on?
  
3. Have you participated in a team programming project? What is the hardest part of programming as a team, as opposed to programming alone?
  

  

 

友立资讯笔试题目

 

 


  1.一堆鸡蛋,33个数剩余2个,55个数剩余1个,77个数剩余3个,问这堆鸡蛋最少有多少个?并给出通解。
  2.列举五岳,及其所在省份。
  3.何为四书。
  4.按顺序默写24节气。
  5.默写于谦的《吟石灰》。
  6.英语翻译约300字。
  7.作文一篇:求职有感。
  普华永道PWC笔试题目(作文)
  1.最近10年来中国媒体的变化。
  2.你认为发展汽车产业和公共交通哪个更重要?
  3.如何理解风险投资?
  4.如何理解广告的消极作用和积极作用?

德勤笔试题


  五个人来自不同地方,住不同房子,养不同动物,吸不同牌子香烟,喝不同饮料,喜欢不同食物。根据以下线索确定谁是养猫的人。
  (1)红房子在蓝房子的右边,白房子的左边(不一定紧邻)
  (2)黄房子的主人来自香港,而且他的房子不在最左边。
  (3)爱吃比萨饼的人住在爱喝矿泉水的人的隔壁。
  (4)来自北京的人爱喝茅台,住在来自上海的人的隔壁。
  (5)吸希尔顿香烟的人住在养马的人右边隔壁。
  (6)爱喝啤酒的人也爱吃鸡。
  (7)绿房子的人养狗。
  (8)爱吃面条的人住在养蛇的人的隔壁。
  (9)来自天津的人的邻居(紧邻)一个爱吃牛肉,另一个来自 成都。
  (10)养鱼的人住在最右边的房子里。
  (11)吸万宝路香烟的人住在吸希尔顿香烟的人和吸“ 555” 香烟的人的中间(紧邻)
  (12)红房子的人爱喝茶。
  (13)爱喝葡萄酒的人住在爱吃豆腐的人的右边隔壁。
  (14)吸红塔山香烟的人既不住在吸健牌香烟的人的隔壁,也不与来自上海的人相邻。
  (15)来自上海的人住在左数第二间房子里。
  (16)爱喝矿泉水的人住在最中间的房子里。
  (17)爱吃面条的人也爱喝葡萄酒。
  (18)吸“ 555” 香烟的人比吸希尔顿香烟的人住的靠右。

扬智(科技)笔试题目


  软件题目
  1. Queue is a useful structure
  
* What is a queue?
  
* Write 5 operations or functions, without details, that can be done on a queue.
  
2. Insert a sequence fo keys(24,49,13,20,59,23,90,35) into a data structure, which has no keys initially. Depict the data structure after these insertions, if it is:
  
* a heap tree
  
* an AVL tree
  
3. * What is a synchronous I/O bus?
  
* What is an asnchronous I/O bus?
  
* Compare the advantages and disadvantages of synchronous and a synchronous I/O bus.
  
4. Explain the following terminology:
  
* Baud rate
  
* Handshaking
  
* Memory mapped I/O
  
5. Explain the key issues in supporting a real-time operation system for embedded system.
  
6. Explain the mapping of visual addresses to real addresses under paging by
  
* direct mapping
  
* associative mapping
  
* combined direct/associated mapping
  
7. Please explain what is “write-back” and “write-through”, and discuss the advantage and disadvantage about these two methods.
  
8. Explain the concept and benefit of threads
  
9. What is hardware interrupt? What is software interrupt? What is exception? Please tell me all you know about interrupt.
  
10. Write a recursive function that tests wether a string is a palindrome. A palindrome is s string such as “abcba” or “otto” that reads the same in both directions.If you can write this function recursively,you can write an iterative version of this function instead.
  11.什么是进程(Process)和线程(Thread)?有何区别?

  12MFCSDK有何区别?
  13IRP是什么?有何作用?
  14Windows 2000操作系统下用户模式和内核模式下编程有何区别?
  15.驱动程序的BUFFERswap到磁盘上去吗?为什么?
  16.试编写3个函数实现
  (1)建立一个双向链表
  (2)插入一个节点
  (3)删除一个节点

typedef struct duLNode
{int data;
struct duLNode *prior;
struct duLNode *next;
}duLNode,*dulinklist;


Status Intilsit_DuL(dulinklist &l)//
初始化
{if(!(l=(dulinklist)malloc(sizeof(duLNode))))
return ERROR;
l->next=NULL;
l->prior=NULL;
l->data=0;   //
利用头接点的数据域存放表的长度
return OK;
}

 

常规插入操作:
status listinsert_dul(dulinklist &l,int i elemtype e) {
if (! (p=getelemp_dul (l,i))) return error;
if (!(s=(dulinklist) malloc (sizeof (dul node)))) return error;
s->data=e;
s->next=p->prior;
s->next=p;
p->prior->next=s;
p->priot=s;
return ok;
}

 

删除操作
status listdelete_dul (dulinklist &l,int i,elemtype &e) {
if (!(p=getelemp_dul(l,i))) return error;
e=p->data;
p->prior->next=p->next;
p->next->prior=p->prior;
free(p);
return ok;
}


  17.简述Hardware interruptsoftware中断的区别,简述其应用。
  18.试编写一个函数,计算一个字符串中A的个数。
  19.画出其相应流程图并编写一个函数实现一个整数到二进制数的转换,如输入6,输出110
  20
  (1)编写一个递归函数,删除一个目录。
  (2)编写一个非递归函数,删除一个目录。
  并比较其性能。
  21.附加题:简单叙述编程经历
    

 高通笔试题

 


  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)

 

威盛笔试试题

2002年软件笔试题
  1.三组程序,找出你认为的错误。
  (1a.c long temp[255];
  
b.c extern *temp;
  (2
a.c long temp[255];
  
b.c extern temp[256];
  (3
a.c long temp[255];
  
b.c extern temp[];
  2.在第一个声明处编译出了奇怪的错误,为什么?

  #include <stdio.h>
  
#include “myfun1.h”
  
#include “myfun2.h”
  
int myInt1;
  
int myInt2;
  3printf(“0x%x”, (&0)[&#61485;1]); 请问打印了什么?

  4.汇编,用ax,bx,cx,dx,求1000×1000/30(四舍五入),结果放在ax中。
  5.编最优化Bubble(int *pIntArray,int L),要求:交换元素不能用临时变量,如果有序需要最优。
  6.用任意一种编程语言写n!的算法。  


  2003 Software Engineer笔试题
  1. Describe x86 PC’s architecture in a diagram cpu,core chipset, Cache,DRAM, IO-subsystem, IO-Bus
  
2. SWI instruction is often called a “supervisor call”, describe the actions in detail
  
* Save the address of the instruction after the SWI in rl4_svc.
  
* Save the CPSR in SPSR_svc.
  
* Enter supervisor mode and disable IRQs.
  
* Set the PC to 08 and begin executing the instruction there.
  
3.
  
* What is PIO operation? advantage and disadvantage?
  
* DMA operation? advantage and disadvantage?
  
* Scatter/Gather DMA engine? how does it operate?
  
4. MP3 decoder related. (a flow chart of decoding is presented)
  
* advantages of Huffman encoding?
  
* why the aliasing reduction is necessary?
  
* analytical expression in mathematics of the IMDCT?
  
* which block in the flow chart is suitable for the software implementation and which for the hardware? why?
  
5. Assembly codes -> C language (about 15 lines).
  
6. Graduation thesis description.
  

 
  

汉王笔试题

 

 


  高级研究人员(模式识别、图像处理类)招聘试题
  说明:
  可能您的专业并不完全符合本试题所涉及的领域。因此,并非所有的问题都需要回答,您可以只回答你所熟悉和能够回答的问题。允许参考任意的资料,但请独立完成此试题,我们更欣赏您独立的思考和创新的精神。本试题并非我们录用或者不录用您的惟一依据。应聘高级研究人员者请回答这部分问题。
  1.人工智能与模式识别的研究已有多年,但似乎公认的观点认为它仍然非常困难。试对你所熟悉的任一方向(如指纹识别、人像识别、语音识别、字符识别、自然语言理解等)的发展状况进行描述。并设想如果你将从事该方向的研究,你打算如何着手,以建立有效的识别理论和方法;或者你认为现在的理论和方法有何缺陷,有什么办法来进行改进?(500字以内即可,不要太长)
  2.简述下面任一主题的主要理论框架或主要观点(500字以内即可,不要太长)
  (1David Marr的视觉计算理论框架
  (2)格式塔(Gestalt)心理学派的主要观点
  (3Bayes决策理论
  (4)人工神经网络中的BP网络、自组织网络和联想记忆网络的主要内容
  (5)基因算法
  (6)小波分析
  (7)目前流行的有损静态图像压缩方法
  3.设想你要设计一个算法,检测给定的图像中是否有矩形结构。所要检测的矩形可能有多种形态,试提出你的算法框架。要求你的算法至少能检测出样本中的矩形,而拒绝其他的任意非矩形结构。矩形的大小、位置和方向未知,要求你的算法能确定这些参数。
  如果你认为这个问题太难而不能解决,请说明理由。
  高级软件开发人员招聘试题
  说明:
  可能您的专业并不完全符合本试题所涉及的领域。因此,并非所有的问题都需要回答,您可以只回答你所熟悉和能够回答的问题。允许参考任意的资料,但请独立完成此试题,我们更欣赏您独立的思考和创新的精神。本试题并非我们录用或者不录用您的惟一依据。
  应聘高级软件开发人员者请回答这部分问题。
  1.数据的逻辑存储结构(如数组,队列,树等)对于软件开发具有十分重要的影响,试对你所了解的各种存储结构从运行速度、存储效率和适用场合等方面进行简要地分析。
  2.数据库技术是计算机系统中一个非常重要的领域,几乎所有的计算机应用中都或多或少地用到了数据库。试简要地谈谈数据库设计中应当注意哪些问题,以及如何解决?给出两种你所熟悉的DBMS,要求一种适用于小型应用,另一种适用于大型应用,给出你做出选择的理由。
  3.某公司的主要业务是提供WWWE-mail服务,出于安全考虑,该公司要求我公司提供一套网络指纹登录系统,该系统要求能够利用指纹替代E-mail中常用的密码,并对所提供的部分网页通过指纹认证后才能访问,请利用你所学过的知识对该系统进行分析设计,你可以指定网络的配置(包括协议),但必须保证邮件用户既可通过网页(http方式)收取信件,也可通过Outlook收取信件。请分析该系统的可行性,可行时给出系统结构和主要的存储结构,指出系统中的难点和解决方法。(假设指纹识别的问题已经解决)
  高级硬件开发人员招聘试题
  说明:
  可能您的专业并不完全符合本试题所涉及的领域。因此,并非所有的问题都需要回答,您可以只回答你所熟悉和能够回答的问题。允许参考任意的资料,但请独立完成此试题,我们更欣赏您独立的思考和创新的精神。本试题并非我们录用或者不录用您的惟一依据。
  应聘高级硬件开发人员者请回答这部分问题。
  1.下面是一些基本的数字电路知识问题,请简要回答:
  (1)什么是SetupHoldup时间?
  (2)什么是竞争与冒险现象?怎样判断?如何消除?
  (3)请画出用D触发器实现2倍分频的逻辑电路。
  (4)什么是线与逻辑?要实现它,在硬件特性上有什么具体要求?
  (5)什么是同步逻辑和异步逻辑?
  (6)请画出微机接口电路中,典型的输入设备与微机接口逻辑示意图(数据接口、控制接口、所存器/缓冲器)。
  (7)你知道哪些常用的逻辑电平?TTLCOMS电平可以直接互连吗?
  2.可编程逻辑器件在现代电子设计中越来越重要,请问:
  (1)你所知道的可编程逻辑器件有哪些?
  (2)试用VHDLVerilogABLE描述8D触发器逻辑
  3.设想你将设计完成一个电子电路方案。请简述用EDA软件(如PROTEL)进行设计(包括原理图和PCB图)到调试出样机的整个过程。在各个环节应注意哪些问题?
  
 
   
  

北京信威通信技术股份有限公司面试题

 

 


  1DSP和通用处理器在结构上有什么不同?请简要画出你熟悉的一种DSP结构图。
  2.说说定点DSP和浮点DSP的定义(或者说出他们的区别)。
  3.说说你对循环寻址和位反序寻址的理解。
  4.请写出【&#61485;87】的二进制补码和二进制偏置码。用Q15表示出0.5&#61485;0.5
  
  

中国国际金融有限公司CICC笔试题


  1. Please tell us about an achievement that you are especially proud of because it was difficult or demanding.
  (1
What the objective was?
  (2
Why it is important to you?
  (3
How you achieved it and the obstacles that you had to overcome in order to do so?
  
2. What is your career plan? Three years after graduation, and five years after graduation?
  
3. Why are you interested in investment bank? What other industries do you also have interests?
  
4. Why do you think you can be a qualified investment banker? How can you contribute in this industry?
  


国泰 君安笔试题


  一列火车上有三个工人,史密斯、琼斯和罗伯特,三人工作为消防员、司闸员和机械师,有三个乘客与这三人的名字相同。罗伯特住在底特律;司闸员住在芝加哥和底特律中间的地方;琼斯一年赚2万美金;有一个乘客和司闸员住在一个地方,每年的薪水是司闸员的3倍整;史密斯台球打得比消防员好;和司闸员同名的乘客住在芝加哥。
  请问谁是机械师?
  

广东北电面试题目


  英文笔试题
  1. Tranlation (Mandatory)
  
CDMA venders have worked hard to give CDMA roaming capabilities via the development of RUIM-essentially, a SIM card for CDMA handsets currently being deployed in China for new CDMA operator China Unicom. Korean cellco KTF demonstrated earlier this year the ability to roam between GSM and CDMA using such cards.However,only the card containing the user’s service data can roam-not the CDMA handset or the user’s number (except via call forwarding).
  
2. Programming (Mandatory)
  
Linked list
  
a. Implement a linked list for integers,which supports the insertafter (insert a node after a specified node) and removeafter (remove the node after a specified node) methods;
  
b. Implement a method to sort the linked list to descending order.
  
3. Debugging (Mandatory)
  
a. For each of the following recursive methods,enter Y in the answer box if themethod terminaters (assume i=5), Otherwise enter N.
  
static int f(int i){
  
return f(i-1)*f(i-1);
  
}
  
Ansewr:
  
static int f(int i){
  
if(i==0){return 1;}
  
else {return f(i-1)*f(i-1);}
  
}
  
Ansewr:
  
static int f(int i){
  
if(i==0){return 1;}
  
else {return f(i-1)*f(i-2);}
  
}
  
Ansewr:
  
b. There are two errors in the following JAVA program:
  
static void g(int i){
  
if(i==1){return;}
  
if(i%2==0){g(i/2);return;}
  
else {g(3*i);return;}
  
}
  
please correct them to make sure we can get the printed-out result as below:
  
3 10 5 16 8 4 2 1
  

  中文笔试题
  1.汉译英
  北电网络的开发者计划使来自于不同组织的开发者,能够在北电网络的平台上开发圆满的补充业务。北电网络符合工业标准的开放接口,为补充业务的开展引入了无数商机,开发者计划为不同层面的开发者提供不同等级的资格,资格的划分还考虑到以下因素:补充业务与北电网络平台的集合程度,开发者团体与北电网络的合作关系,等等。
  2.编程
  将整数转换成字符串:void itoa(int,char);
  例如itoa(-123,s[])
s=“ -123” ;
 

广州本田笔试题


  1.排序s-m-t-w-t-f-
  2.如果六千,六百,六表示成6606,那么十一千,十一百,十一表示成什么?

11000+1100+11=12111
  3grass后面加一个词,agent前面加一个单词,组成两个新词,这个词是什么?

land    grassland 草地    land-agent 地产管理人
  4.农场不知道有多少鸡,现有一批饲料,如果卖掉75只鸡饲料够20天用,买进100只鸡饲料够用15天,问原来有多少只鸡?

(x-75)*20=(x+100)*15   x=600
  56个桶,装着两种液体,一种液体的价格是另外一种的double,桶容量为81315171931,有一个美国人,各用了14美元买两种液体,剩下一个桶。问剩下哪个?

答案:19

X(价格)*V1(体积)=14   2X*V2=14    由题意可知所买的一种液体体积是另一种的两倍,固8+13+15+17+19+31=103之和再减去其中一个数所得的数(记为X)要求是3的倍数,

103-8=95;  103-13=90;  103-15=88;  103-17=86;  103-19=84;   103-31=72
所以得出131931合题意,但液体是不能混合的,所以X3(记为Y)必需是其中两容器之和。

90/3=30   (8,15,17,19,31) 没有合适组合  

72/3=24  813151719)没有合适组合

84/3=28 (813151731)    -13,15组合


  6.篮球场,还剩6秒,差对手4分,没可能追得上,现在有一个暂停,你会怎么指导球员去做?
  
  

明基面试问题


  1.自我介绍(2分钟)。
  2.你大学期间最辉煌的一件事是什么?
  3.如果你明天去火星呆上300年,今天晚上你最想做的一件事是什么?
  


网易


  110个人分成4 有几种分法?
  2、如图:
     7 8 9 10
    
6 1 2 11
    
5 4 3 12
    
16 15 14 13
    设“ 1” 的坐标为(00 “ 7” 的坐标为(-1,-1 编写一个小程序,使程序做到输入坐标(X,Y)之后显示出相应的数字。

  3#include<stdio.h>
    
//example input and output
    
//in 1 2 3 out 1 3 1
    
//in 123456789 2 100 out 123456789 100 21
    
long mex(long a,long b,long c)
    
{ long d;
    
if(b==0) return 0;
    
if(b==1) return a%c;
     d=mex(a,b/2,c) d*=d;这里忘了
;d*=mex(a,b%2,c);d%=c;
    
return d;
    
}
    
int main(void)
    
{ long x,y,z;
    
while(1)
    
{ if(scanf(%d %d %d,&x,&y,&z)>3) return 0;
    
if(x<0) { printf("too small/n");continue;}
    
if(y<0) { printf("too small/n");continue;}
    
if(z<1) { printf("too small/n");continue;}
    
if(y>z) { printf("too big/n");continue;}
    
if(z>1000000010) {printf("too big/n");continue}
    
printf(%d %d %d,x,z,mex(x,y,z);
    
}}
    根据这个程序,当已知一个输入,算出输出,如:输入 1 3 1 则输出 1 2 3 输入 123456789 100 21 输出 123456789 2 100

 

 广州日报


  1、填空部分是一些时事题,如:我国有多少网民,三个代表、北京申奥什么的,及记者的一些常识性的问题:如我国第一个以写新闻通讯出名的记者是谁?蔡元培曾经夸奖过的记者是谁?
  2、选择题范围与填空基本一样,包括时政和新闻知识:如深度采访的实质,记者的职业道德等。
  3、简答题就比较专业:一道是你参加一条高速公路的开通典礼,如何在记者会上发的新闻通稿之外写出会上没说的内容。一道是你去一个单位采访,但没有任何该单位的证件、邀请函之类东西,你如何骗过门卫混进去。第三道是有几家香水公司都想让你说好话,就是做软新闻了,你该如何处理。第四道是A明星与B明星不和,你如何报道AB的话而又不能让B告你诽谤。
  4、写作题是以今年冬天不太冷为题任意想象,加叙加议。
  5、五道智力测验:如何喝道啤酒杯底部的啤酒、汽车过隧道但高2厘米该怎么办、你吃苹果时吃到几条虫最恶心之类,10只点燃的蜡烛,让风吹灭了2只,后来在关窗户前又吹灭1只。问最后还有几支。

对数组,指针,数据结构,算法,字符串,文件操作等问题都有覆盖.主要以c语言的实现为主,也有c++的题.大家可以先做做这10道题,测试一下自己的水平.

1. 下面这段代码的输出是多少(32位机上).

    char *p;

    char *q[20];

    char *m[20][20];

    int (*n)[10];

struct MyStruct{

char dda;

double dda1;

int type ;

}
MyStruct k;

 printf("%d %d %d %d",sizeof(p),sizeof(q),sizeof(m),sizeof(n),sizeof(k));

答案:4801600424

 n是指向一维数组的指针变量;k中不要忘了考虑对齐问题,这里dda4个字节。

 

2.

(1)

char a[2][2][3]={{{1,6,3},{5,4,15}},{{3,5,33},{23,12,7}} };
for(int i=0;i<12;i++)
printf("%d ",_______);
在空格处填上合适的语句,顺序打印出a中的数字

答案:a[i/6][(i/3)%2][i%3];这道题目是多维数组的输出问题,这里要考虑的是每维数字的取值顺序问题:第一维,前六次循环都取0,后六次取1,于是i/6可以满足要求;第二维,前3次为0,再3次为1,再3次为0,再3次为1,用量化的思想,i/312个数字分为4组每组3个,量化为0123,为要得到0101我们这里就需要对(0123)%2=(0101),于是(i/3)%2;最后一维我们需要的是(012012012012;)我们就i%3

 (2)

char **p, a[16][8]; 

问:p=a是否会导致程序在以后出现问题?为什么?

答案:这个不会导致出现问题,但是要注意p的使用,如a[1][2] 等价的为 *(*(p+1)+2)而不是*(p+11),

3.用递归方式,非递归方式写函数将一个字符串反转.

   函数原型如下:char *reverse(char *str);

答案:

非递归方式:

char *reverse(char *str)
{
 int len = strlen(str);
 char temp;
 for(int i=0; i<len/2; i++)
 {
  temp = *(str+i);
  *(str+i) = *(str+len-1-i);
  *(str+len-1-i) = temp;
 }
 return str;
}

递归方式:???

 

4.strcpy函数和memcpy函数有什么区别?它们各自使用时应该注意什么问题?

答案:strcpy是字符串拷贝,遇 '/0' 则停。  
           memcpy
是内存拷贝,要指定拷贝的长度。
 
          
当要拷贝二进制数据(比如说一个结构),只能用memcpy

5.写一个函数将一个链表逆序.

6.一个单链表,不知道长度,写一个函数快速找到中间节点的位置.

普通的方法就是先遍历得到链表的长度,然后再通过长度遍历得到链表的中间节点。更好的办法是:

1  使用两个指针进行遍历,快指针每次步进2,慢指针每次步进1
2
  当快指针到达链表尾部的时候,慢指针指向的就是链表的中点。
(这个算法的思想和经典问题判定链表中是否存在环的思想是一致的)

函数代码如下:

node* find_mid_element(node* head)
{

       if (NULL == head) return NULL;
       if (head->_next == NULL) return head;
       if (head->_next->_next == NULL) return head;
       node* mid= head;

       node* p = mid->_next;
       while ((NULL != p) && (NULL != p->_next))
       {

              mid = mid->_next;
              p = p->_next->_next;
       }

       return mid;
}

 

7.写一个函数找出一个单向链表的倒数第n个节点的指针.(把能想到的最好算法写出).

 

8.用递归算法判断数组a[N]是否为一个递增数组。

9.

有一个文件(名为a.txt)如下,每行有4,第一项是他们的名次,写一个c程序,将五个人的名字打印出来.并按名次排序后将5行数据仍然保存到a.txt.使文件按名次排列每行.


2,07010188,0711,
李镇豪,
1,07010154,0421,
陈亦良
,
3,07010194,0312,
凌瑞松
,
4,07010209,0351,
罗安祥
,
5,07010237,0961,
黄世传,

10.写一个函数,判断一个unsigned char 字符有几位是1.

  写一个函数判断计算机的字节存储顺序是升序(little-endian)还是降序(big-endian).

 11.微软的笔试题.

Implement a string class in C++ with basic functionality like comparison, concatenation, input and output. Please also provide some test cases and using scenarios (sample code of using this class).

Please do not use MFC, STL and other libraries in your implementation.

12.有个数组a[100]存放了100个数,100个数取自1-99,且只有两个相同的数,剩下的98个数不同,写一个搜索算法找出相同的那个数的值.(注意空间效率时间效率尽可能要低).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值