|
真题试看结束后微信扫下方二维码即可打包下载完整带答案详解版《★微软亚洲研究院笔真题》真题及18026套全国各地事业单位考试完整版真题
手机用户可保存上方二维码到手机中,在微信扫一扫中右上角选择“从相册选取二维码”即可。 真题预览: 微软亚洲研究院笔试题 (1) int Calc(unsigned int x) { int count=0; while(x) { printf("x=%i\n",x); count++; x=x&(x-1); } return count; } 问Calc(9999)的值是多少。 (2)检查错误 int CopyStringCount(const char* Str) { int nCount = 0; char* pBuffer; pBuffer = new char[_MAX_PATH]; strcpy(pBuffer,Str); for(;*pBuffer!='\0'; pBuffer++) if(*pBuffer == '\') nCount ++; // delete [] pBuffer; return nCount; } (3)写出结果 void foo(int p1[]) { *p1 += 5; } void bar(int p2[]) { p2[1] = 15; } void main() { int a[]={3,4,5}; int b[]={3,4,5}; int *p2; p2=&a[1]; bar(p2); printf("%i %i %i\n",a[0],a[1],a[2]); p2=&b[0]; p2++; foo(p2); bar(p2); printf("%i %i %i\n",b[0],b[1],b[2]); } (4) 有一5节车厢的过山车,每节能座两人,现有Luair,Jack,Gwen,Tom,Mark,Paul,6人去乘 车,有以下条件 1,Luair和别人同乘 2,Mark 不合别人同乘,而且Mark的前一节车厢是空的 3,Tom 不和Gwen 与 Paul 中的任何一人同乘 4,Gwen乘3,或者4节 ----------------------------------------------------------------------------- ------------- 1写出下列算法的时间复杂度。 (1)冒泡排序; (2)选择排序; (3)插入排序; (4)快速排序; (5)堆排序; (6)归并排序; 2写出下列程序在X86上的运行结果。 struct mybitfields { unsigned short a : 4; unsigned short b : 5; unsigned short c : 7; }test void main(void) { int i; test.a=2; test.b=3; test.c=0; i=*((short *)&test); printf("%d\n",i); } 3写出下列程序的运行结果。 unsigned int i=3; cout< 4写出下列程序所有可能的运行结果。 int a; int b; int c; void F1() { b=a*2; a=b; } void F2() { c=a+1; a=c; } main() { a=5; //Start F1,F2 in parallel F1(); F2(); printf("a=%d\n",a); } 5考察了一个CharPrev()函数的作用。 6对 16 Bits colors的处理,要求: (1)Byte转换为RGB时,保留高5、6bits; (2)RGB转换为Byte时,第2、3位置零。 7一个链表的操作,注意代码的健壮和安全性。要求: (1)增加一个元素; (2)获得头元素; (3)弹出头元素(获得值并删除)。 8一个给定的数值由左边开始升位到右边第N位,如 0010<<1 == 0100 或者 0001 0011<<4 == 0011 0000 请用C或者C++或者其他X86上能运行的程序实现。 ----------------------------------------------------------------------------- ----------------------------------- 附加题(只有在完成以上题目后,才获准回答) In C++, what does "explicit" mean? what does "protected" mean? explicit C++ Specific This keyword is a declaration specifier that can only be applied to in-class constructor declarations. Constructors declared explicit will not be considered for implicit conversions. For example: class X { public: explicit X(int); //legal explicit X(double) { //legal // ... } }; explicit X::X(int) {} //illegal An explicit constructor cannot take part in implicit conversions. It can only be used to explicitly construct an object. For example, with the class declared above: void f(X) {} void g(int I) { f(i); // will cause error } void h() { X x1(1); // legal } The function call f(i) fails because there is no available implicit conversion from int to X. Note It is meaningless to apply explicit to constructors with multiple arguments, since such constructors cannot take part in implicit conversions. END C++ Specific protected C++ Specific —> protected: [member-list] protected base-class When preceding a list of class members, the protected keyword specifies that those members are accessible only from member functions and friends of the class and its derived classes. This applies to all members declared up to the next access specifier or the end of the class. When preceding the name of a base class, the protected keyword specifies that the public and protected members of the base class are protected members of the derived class. Default access of members in a class is private. Default access of members in a structure or union is public. Default access of a base class is private for classes and public for structures. Unions cannot have base classes. For related information, see public, private, friend, and Table of Member Access Privileges. END C++ Specific Example // Example of the protected keyword class BaseClass { protected: int protectFunc(); }; class DerivedClass : public BaseClass { public: int useProtect() { protectFunc(); } // protectFunc accessible from derived class }; void main() { BaseClass aBase; DerivedClass aDerived; aBase.protectFunc(); // Error: protectFunc not accessible aDerived.protectFunc(); // Error: protectFunc not accessible in derived class } How do you code an infinite loop in C? 2. Volatile: a) What does the keyword volatile mean? Give an example b) Can a parameter be both const and volatile? Give an example c) Can a pointer be volatile? Give an example 3. What are the values of a, b, and c after the following instructions: int a=5, b=7, c; c = a+++b; 4, What do the following declarations mean? a) const int a; b) int const a; c) const int *a; d) int * const a; e) int const * a const; 5. Which of the following statements describe the use of the keyword static? a) Within the body of a function: A static variable maintains its value between function revocations b) Within a module: A static variable is accessible by all functions within that module c) Within a module: A static function can only be called by other functions within that module 6. Embedded systems always require the user to manipulate bits in registers or variables. Given an integer variable a, write two code fragments. The first should set bit 5 of a. The second shnuld clear bit 5 of a. In both cases, the remaining bits should be unmodified. 7. What does the following function return? char foo(void) { unsigned int a = 6; iht b = -20; char c; (a+b > 6) ? (c=1): (c=0); return c; } 8. What values are printed when the following C program is executed? int i = 8; void main(void) ( 9. What will be the output of the following C code? main() { int k, num= 30; k =(num > 5 ? (num <=10 ? 100:200): 500); printf("%d", k); } 10. What will the following C code do? int *ptr; ptr =(int *)Ox67a9; *ptr = Oxaa55; 11. What will be the output of the follow C code? #define product(x) (x*x) main() { int i = 3, j, k; j = product(i++); k = product(++i); printf("%d %d",j,k); } 12. Simplify the following Boolean expression !((i ==12) || (j > 15)) 13. How many flip-flop circuits are needed to divide by 16? 14. Provides 3 properties that make an OS, a RTOS? 15. What is pre-emption? 16. Assume the BC register value is 8538H, and the DE register value is 62A5H.Find the value of register BC after the following assembly operations: MOV A,C SUB E MOV C,A MOV A,B SBB D MOV B,A 17.In the Assembly code shown below LOOP: MVI C,78H DCR C JNZ LOOP HLT How many times is the DCR C Operation executed? 18.Describe the most efficient way(in term of execution time and code size) to divide a number by 4 in assembly language 19.what value is stored in m in the following assembly language code fragment if n=7? LDAA #n LABEL1: CMPA #5 BHI L3 BEQ L2 DECA BRA L1 LABEL2: CLRA LABEL3: STAA #m 20. What is the state of a process if a resource is not available? #define a 365*24*60*60 21. Using the #define statement, how would you declare a manifest constant that returns the number of seconds in a year? Disregard leap years in your answer. 22. Interrupts are an important part of embedded systems. Consequently, many compiler vendors offer an extension to standard C to support interrupts. Typically, the keyword is __interrupt. The following code uses __interrupt to define an interrupt service routine (ISR). Point out problems in the code. __interrupt double compute_area (double radius) { double area = PI * radius * radius; printf("\nArea = %f", area); return area; } 一.选择题 1.一株查找二叉树,其结点A、B、C、D、E、F依次存放在一个起始地址为n(假定地址以字 节 为单位顺序编号)的连续区域中,每个节点占4个字节:前两个字节存放结点值,后两个字节 依 次放左指针、右指针. 若该查找二叉树的根结点为E,则它的一种可能的前序遍历为____ ,相应的层次遍历为___ _ . 在以上两种遍历情况下,结点C的左指针LC的存放地址为_____ ,LC的内容为______ 结点A 的 左指针RA的内容为_______. 供选择的答案 (1) A. EAFCBD B.EFACDB C.EABCFD D.EACBDF (2) A. EAFCBD B.EFACDB C.EABCFD D.EACBDF (3) A.n+4 B.n+10 C.n+12 D.n+13 (4) A.n+9 B.n+8 C.n+12 D.n+13 (5) A.n+4 B.n+8 C.n+12 D.n+16 2.虚存页面调整算法有多种,______ 调度算法不是页面调度算法. 供选择的答案 A.后进先出 B.先进先出 C.最近最少使用 D.随机选择 3.在软件开发过程中常用图作为描述工具.如DFD就是面向_______分析方法的描述工具. 在 一套分层DFD中,如果某一张图中有N个加工(Process),则这张图允许有_____ 张子图.在 一 张DFD图中,任意两个加工之间_____ .在画分层DFD时,应保持_____ 之间的平衡.DFD中从 系 统的输出流到系统的输出流的一连串连续变换形成一种信息流,这种信息可分为_____两 类 . A.(1)数据结构 (2)数据流 (3)对象 (4)构件 B.(1)0 (2)1 (3)1-N (4)0-N C.(1)有且仅有一条数据流 (2)至少有一条数据流 (3)可以有0条或多条名字互不相同的数据流 (4)可以有0或多条数据流,但允许其中存若干条名字相同的数据流. D.(1)父图与其子图 (2)同一父图的所有子图 (3)不同父图的所有子图 (4)同一子图的 所有直接父图. E.(1)控制流和变换流 (2)变换流和事务流 (3)事务流和事件流 (4)事件流和控制流 4.用二进制加法器对二一十进制编码的十进制数求和,当和的本位十进制数二一十进制编 码 小于等于1001且向高位无进位时,_____ ;当和小于等于1001且向高位存进位时,_____;当 和 大于1001时,_____ (1)-(3) A:不需进行修改 B:需进行加6修改 C:需进行减6修改 D:进行加6或减6修改,需进一步判别. 5.www页面访问的大致过程如下: 浏 览器通过____ 查询上述输入信息所指的WEB服务器的IP地址;浏览器通过网络与该IP地址 处 的WEB服务器的______服务端之间建立一条______连接;浏览器依照相关协议发送_____命 令 ;WEB服务器根据命令取出文档,发送回来;浏览器释放连接,显示该文档. (1) A.URL B.EMS C.NDS D.DNS (2)A.NAT B.EMS C.NDS D.DNS (3)A.HTML B.HTTP C.SMTP D.SNMP (4)A.RTP B.IP C.TCP D.UDP (5)A.TCP B.GET C.UDP D.PUT 6.假设某计算机具有1MB的内存(目前使用的计算机往往具有64MB以上内存),并按字节编 址 ,为了能存取该内存各地址的内容,其地址寄存器至少需要二进制____位.为使4字节组成 的 字段从存储器中一次读出,要求存放存储器中的字边界对齐,一个字节的地址码应_____若 存 储器周期为200ns,且每个周期可访问4个字节,则该存储器带宽为_____bit/s假如程序员 所 用的地址为______,而真正访问内存的地址称为_______ A.(1)10 (2)16 (3) 20 (4)32 B.(1)最低两位00 (2)最低两位为10 (3)最高两位为00 (4)最高两位为10 C.(1)20M (2)40M (3)80M (4)160M D.(1)有效地址 (2)程序地址 (3)逻辑地址 (4)物理地址 E.(1)指令地址 (2)物理地址 (3)内存地址 (4)数据地址 7.英语题 Soon,more of the information we receive via the internet could come _____in di gital wrappers. Wrappers are made up ______ softwore code that’s targeted to do specific thin gs with the data _____within them such as helping to define queries for search engines They also keep _____from_____access to that code. (1) A.Package B.packaged C.packages D.packaging (2)A.of B.off C.on D.out (3)A.close B.closed C.enclose D.enclosed (4)A.insiders B.money C.outsiders D.warehouse (5)A.gain B.gained C.gains D.gaining 二.设计题 1.在VC中怎样获得父窗口的指针(写出代码) 2.怎样创建一个临时文件 3.怎样获得状态栏和工具栏的指针. 4.访问控件存几种方法 三.填空题: 1.ODBC的数据类型分为_________和_________ 2.VC访问数据库的方式____________________ 3.VC的线路分为_________和_________,它是用什么对象表示的_________ 4.下列中a的值是_________ #define AAA 200 #define BBB AAA+100 int a= BBB*2 '> 真题预览结束 真题试看结束后 微信扫下方二维码即可打包下载完整带答案详解版《★微软亚洲研究院笔真题》真题及18026套全国各地事业单位考试完整版真题
手机用户可保存上方二维码到手机中,在微信扫一扫中右上角选择“从相册选取二维码”即可。 |