收藏 分销(赏)

C++外企笔试题.doc

上传人:精**** 文档编号:3635829 上传时间:2024-07-11 格式:DOC 页数:10 大小:37.50KB
下载 相关 举报
C++外企笔试题.doc_第1页
第1页 / 共10页
C++外企笔试题.doc_第2页
第2页 / 共10页
C++外企笔试题.doc_第3页
第3页 / 共10页
C++外企笔试题.doc_第4页
第4页 / 共10页
C++外企笔试题.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

1、C+外企笔试题资料仅供参考VC+开发工程师笔试题(时间:1小时 满分:100分)备注:答案请写在答题纸上,请勿在试卷上涂写一、 选择题(每题1分,共15分)1、C+语言的跳转语句中,对于break和continue说法正确的是( ) A)break语句只应用与循环体中 B)continue语句只应用于循环体中 C)break是无条件跳转语句,continue不是 D)break和continue的跳转范围不够明确,容易产生问题 2、for(int x=,y=o;!x&y 20; 8 9 if(copy) 10 len = flag & 0xF; 11 errstr = malloc(len);

2、 12 if(errstr = NULL) 13 return -1; 14 strncpy(errstr, _errindex, sizeof(errstr); 15 else 16 errstr = _err + index; 17 18 19 void f2(int c) 20 char *err; 21 22 swtch(c) 23 case 1: 24 if(f1(err, 0x110004) != -1) 25 printf(err); 26 case 2: 27 if(f1(err, 0x30000D) != -1) 28 printf(err); 29 30 四、 程序输出结果

3、(每题5分,共20分)1、第一题#includeusing namespace std;int f(int); int main() int i; for(i=0;i5;i+) coutf(I)0;i-) k + = i; return k; 程序输出结果为:2、第二题#include #include using namespace std;class Studentpublic: Student(char* pName=no name,int ssId=0) strncpy(name,pName,40); name39=0; id = ssId; cout Constructing new

4、 student pName endl; Student(Student& s) cout Constructing copy of s.name endl; strcpy(name,copy of ); strcat(name,s.name); id=s.id; Student() cout Destructing name endl; protected: char name40; int id;void fn(Student s) cout In function fn()n;void main() Student randy(Randy,1234); cout Calling fn()

5、n; fn(randy); cout Returned from fn()n;程序输出结果为:3、第三题#includeusing namespace std;struct sachar a2; short int d; int b; char c13;struct sbchar e; int b; char a7; int *p;void main()char *p_char = NULL;int *p_int = NULL;cout sizeof(p_char) ;cout sizeof(p_int) ;cout sizeof(short int) ;cout sizeof(sa) ;co

6、ut sizeof(sb) ;程序输出结果为:4、第四题#include void main()char *p = NULL;int a = -10;unsigned int b = 7;if(p=malloc(0) = = NULL)printf(successed);else printf(failed);(a+b)0 ? printf(n):printf(Badn);程序输出结果为:五、 简答题(每题3分,共15分)1. 简述VC中Debug和Release的区别?Assert和Verify的区别?2. 简述char、wchar_t及TCHAR的区别和联系?3. 简述COM和DLL的区别

7、和联系?4. 简述new和malloc, delete和free的区别和联系?C+中为什么要引入new和delete ?5. 试从性能上讨论STL中Vector和List的区别?六、 编程题(每题10分,共20分)1. 合并两个有序单链表。要求:(1)写出合并算法的思路 (2)尽量少占用存储空间(3)合并函数原型为Node * Merge(Node*head1,Node*head2),其中Node链表中的节点:定义为:typedef struct NODE int value; struct NODE * next;Node;head1为单链表1的头节点指针,head2为单链表2的头结点指针。2. 设计一个洗牌算法。描述:现有一副扑克牌共54张,每次玩完牌局后,需要重新洗牌,你的任务是设计一个洗牌算法并用C/C+语言来实现它。要求: (1)写出算法的设计思路以及存放牌的数据结构 (2)要求设计的算法扩展性,比如能够高效率的洗10万张牌。 (3)算法效率越高牌洗的越充分,本题得分越高。

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 通信科技 > 开发语言

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服