康佳软件方向笔试题2012年9月19号郑大
来源:互联网 发布:淘宝卖家好评的好处 编辑:程序博客网 时间:2024/04/29 08:50
报的是c++方向的,试卷是100分制,题型有选择题、填空题、简答题、改错题、找错题、编程题。60分的c方面的题,40分的c++或者java方面的题。
考的都很基础,没有什么太难的算法方面的,都是些语法基础,指针数组什么的都是些老生常谈的问题。有一个网络协议方面的填空题,一个操作系统方面的简答题
按回想的顺序总结一下想起那个算哪个:
1、定义一个宏交换一个unsigned short型数据的高8位和低8位
当时就是没想起来应该用移位了
代码:#define exchangebit(i) ((i) = ((i)<<(8))|((i)>>(8)));
2、互联网使用的协议是:TCP/IP协议。
ping(Packet Internet Groper)程序使用的协议是:ICMP(Internet Control Messages Protocol)
即因特网信报控制协议。
应用层所包含的协议有:
DHCP · DNS · FTP · Gopher · HTTP ·
IMAP4 · IRC · NNTP · XMPP · POP3 ·
SIP · SMTP · SNMP · SSH · TELNET ·
RPC · RTCP · RTP ·RTSP · SDP ·
SOAP · GTP · STUN · NTP · SSDP
3、要对绝对地址0x100000赋值,我们可以用(unsigned int*)0x100000 = 1234;
那么要是想让程序跳转到绝对地址是0x100000去执行,应该怎么做?
答案:*((void (*)( ))0x100000 ) ( );
首先要将0x100000强制转换成函数指针,
即:(void (*)())0x100000然后再调用它:*((void (*)())0x100000)();
用typedef可以看得更直观些:typedef void(*)() voidFuncPtr;*((voidFuncPtr)0x100000)();
4、写出该程序的运行结果
#include <iostream>using namespace std;class A{public:A(){cout << "A::A()" << endl;}~A(){cout << "~A::~A()" << endl;}};class B{public:B(){cout << "B::B()" << endl;}~B(){cout << "~B::~B()" << endl;}};class C: public B{A a;public:C(){cout << "C::C()" << endl;}~C(){cout << "~C::~C()" << endl;}};A a;int main(){C c;return 0;}
cygwin下运行结果如下:
A::A()
B::B()
A::A()
C::C()
~C::~C()
~A::~A()
~B::~B()
~A::~A()
5、编写一个String类
#include <iostream>#include <cstdlib>#include <cstring>#include <cassert>using namespace std;class String{char *m_pdata;public:String(const char *str = NULL);//普通构造函数String(const String& other);//拷贝构造函数~String();//析构函数String& operator=(const String& other);//重载=String& operator=(const char *str);//重载=};String::String(const char *str){if(NULL == str){m_pdata = new char[1];assert(m_pdata != NULL);}else{m_pdata = new char[strlen(str) + 1];assert(m_pdata != NULL);strcpy(m_pdata, str);}}String::String(const String& other){m_pdata = new char[strlen(other.m_pdata) + 1];assert(m_pdata != NULL);strcpy(m_pdata, other.m_pdata);}String::~String(){delete [] m_pdata;m_pdata = NULL;}String& String::operator=(const String& other){if(&other == this){return *this;}delete [] m_pdata;m_pdata = new char[strlen(other.m_pdata) + 1];assert(m_pdata != NULL);strcpy(m_pdata, other.m_pdata);return *this;}String& String::operator=(const char *str){delete [] m_pdata;if(NULL == str){m_pdata = new char[1];assert(m_pdata != NULL);m_pdata[0] = '\0';}else{m_pdata = new char[strlen(str) + 1];assert(m_pdata != NULL);strcpy(m_pdata, str);}return *this;}int main(){char chs[] = "hello";String s(chs);return 0;}
6、二分查找
#include <stdio.h>int binarysearch(int a[], int n, int k){int mid;if(n <= 0)return -1;mid = n/2;if(a[mid] == k)return mid;if(a[mid] < k)return binarysearch(a, mid, k);return binarysearch(a+mid+1, n-mid-1, k) + mid + 1;}int main(){return 0;}
7、写一个队列类
8、优先级反转及其解决办法
暂时这些吧,希望通过呵呵。。。
- 康佳软件方向笔试题2012年9月19号郑大
- Java方向软件笔试题
- G笔试题-2012年9月25日
- 2012年9月几个公司的笔试题
- 【微软】2011年9月笔试题
- 百度2014秋季校园招聘-软件研发工程师笔试题(2013年9月20日山东济南站)
- 9月笔试题总结
- 微软2012暑期实习生校园招聘 软件测试笔试题(4月7号)
- 深圳太极软件笔试题回顾(2013年12月11日)
- 2014年8月29日阿里校招在线笔试部分题--软件测试开发
- 2011年腾讯实习生应聘(软件开发>Web前端>flash方向)笔试面试经历
- 2011年腾讯实习生应聘(软件开发>Web前端>flash方向)笔试面试经历
- 腾讯2009校园招聘(软件开发职位方向笔试题与答案)
- 腾讯2009校园招聘(软件开发职位方向笔试题与答案)
- 腾讯实习生笔试题 软件开发-后台开发方向2014.4.20
- 2015百度校招笔试题(移动软件开发方向)
- 腾讯实习生笔试题 软件开发-后台开发方向2014.4.20
- 2012年10月9号阿里巴巴笔试(c++)
- JAVA--第四周实验--任务1--编写应用程序,求1000之内的所有完数。(编程思想)
- java获取本地局域网的外网IP ....
- hdu 1181 变形课 (深搜)
- ClassLoader学习
- vi复制 剪切 删除 多行的方法(汇总)
- 康佳软件方向笔试题2012年9月19号郑大
- “接口”杂谈
- HDU-1005
- linux/ubuntu计算程序运行时间方法
- 实模式和保护模式
- Pthreads-Win32的使用和一些问题
- 小感慨下
- PreferenceActivity基本用法
- C 存贮模式 near far huge