小虫之家
C++探索之旅
要不是因为哥哥在网上搜到这个博客,我近乎(已经)忘记了它的存在,当哥哥把貌似熟悉的文字发给我看时,惊喜和温柔,不能完全描述我的当时的心情。即使是现在,仍然能感受到这种欢欣和被爱的快乐。

这个新年,在哥哥每日早上的问候,和马普尔小姐的乡村生活中,淡淡的度过。和哥哥在一起的日子,完全可以不需要网络的存在,只和对方相伴,都能有着无比精彩和丰富的生活。

网络聊天的工具,就让它慢慢淡出我的生活吧,也未尝不是一个新的开始。

最近在看Java版的数据结构和一些Android的知识,在这里,重新开辟一个小天地吧。For both of us, only love that matters……
posted @ 2011-02-09 17:06 小虫 阅读(165) | 评论 (0)编辑 收藏
1.   C++的函数可以放在strcut内部作为“成员函数”。

2.   C++编译器将结构名转变为一个新的类型名(如int,char,float和double是类型名一样)

3.   在下面的C版本的struct的函数中,硬性传递结构的地址作为这些函数的第一个参数。例如:
           typedef struct CstashTag{
               int size;             //size of each space
               //.........
           } Cstash;
           void initialize(CStash *s, int size);

      而C++中则不是,这一过程是由编译器来完成。
           struct Stash {
               int size;            //size of each space
               //.........
               void initialize(int size);
           };
         
posted @ 2006-01-20 11:57 小虫 阅读(1641) | 评论 (0)编辑 收藏

华为笔试题
         1.请你分别画出OSI的七层网络结构图和TCP/IP的五层结构图。
  2.请你详细地解释一下IP协议的定义,在哪个层上面?主要有什么作用?TCP与UDP呢?
  3.请问交换机和路由器各自的实现原理是什么?分别在哪个层次上面实现的?
  4.请问C++的类和C里面的struct有什么区别?
  5.请讲一讲析构函数和虚函数的用法和作用。
  6.全局变量和局部变量有什么区别?是怎么实现的?操作系统和编译器是怎么知道的?
  7.8086是多少位的系统?在数据总线上是怎么实现的?

联想笔试题
         
1.设计函数 int atoi(char *s)。
  2.int i=(j=4,k=8,l=16,m=32); printf(“%d”, i); 输出是多少?
  3.解释局部变量、全局变量和静态变量的含义。
  4.解释堆和栈的区别。
  5.论述含参数的宏与函数的优缺点


普天C++笔试题
         1.实现双向链表删除一个节点P,在节点P后插入一个节点,写出这两个函数。
  2.写一个函数,将其中的\t都转换成4个空格。
  3.Windows程序的入口是哪里?写出Windows消息机制的流程。
  4.如何定义和实现一个类的成员函数为回调函数?
  5.C++里面是不是所有的动作都是main()引起的?如果不是,请举例。
  6.C++里面如何声明const void f(void)函数为C程序中的库函数?
  7.下列哪两个是等同的
  int b;
  A const int* a = &b;
  B const* int a = &b;
  C const int* const a = &b;
  D int const* const a = &b;
  8.内联函数在编译时是否做参数类型检查?
  void g(base & b){
   b.play;
  }
  void main(){
   son s;
   g(s);
   return;
  }

         1. How do you code an infinite loop in C?
  2. Volatile:
  (1)What does the keyword volatile mean? Give an example
  (2)Can a parameter be both const and volatile? Give an example
  (3)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?
  (1)const int a;
  (2)int const a;
  (3)const int *a;
  (4)int * const a;
  (5)int const * a const;
  5. Which of the following statements describe the use of the keyword static?
  (1)Within the body of a function: A static variable maintains its value between function revocations
  (2)Within a module: A static variable is accessible by all functions within that module
  (3)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 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);
  }
  9. What will the following C code do?
  int *ptr;
  ptr =(int *)Ox67a9;
  *ptr = Oxaa55;
  10. 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);
  }
  11. Simplify the following Boolean expression
  !((i ==12) || (j > 15))
  12. How many flip-flop circuits are needed to divide by 16?
  13. Provides 3 properties that make an OS, a RTOS?
  14. What is pre-emption?
  15. 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
  16. In the Assembly code shown below
  LOOP: MVI C,78H
   DCR C
   JNZ LOOP
   HLT
  How many times is the DCR C Operation executed?
  17. Describe the most efficient way (in term of execution time and code size) to divide a number by 4 in assembly language
  18. 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
  19. What is the state of a process if a resource is not available?
  #define a 365*24*60*60
  20. 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.
  21. 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 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;
  }

 维尔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. 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)?有何区别?
  12.MFC和SDK有何区别?
  13.IRP是什么?有何作用?
  14.Windows 2000操作系统下用户模式和内核模式下编程有何区别?
  15.驱动程序的BUFFER能swap到磁盘上去吗?为什么?
  16.试编写3个函数实现
  (1)建立一个双向链表
  (2)插入一个节点
  (3)删除一个节点
  17.简述Hardware interrupt和software中断的区别,简述其应用。
  18.试编写一个函数,计算一个字符串中A的个数。
  19.画出其相应流程图并编写一个函数实现一个整数到二进制数的转换,如输入6,输出110。
  20.
  (1)编写一个递归函数,删除一个目录。
  (2)编写一个非递归函数,删除一个目录。
  并比较其性能。


广东北电面试题目
  英文笔试题
  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”;


posted @ 2006-01-20 10:23 小虫 阅读(2678) | 评论 (5)编辑 收藏
        刚在china-pub里翻了翻书目,由于最近在翻 Bruce Eckel 的C++编程思想,顺便去瞅了瞅其中文版的书评。
        象大多数翻译版的作品一样,C++编程思想的翻译版被许多读者(留了言的读者)损的一塌糊涂。其实任何事情都是说起来容易,做起来难,当一份真正经典的计算机书籍摆在眼前时,其经典之处除了对于技术的透彻讲述、细致的选材之外,往往也颇具阅读趣味。想要翻译好一部这样的书籍,并非易事。除了深厚的技术功底、对技术的透彻了解之外,也需要扎实的语言功底,既能理解作者的意图,也要能够用语言将其完美的诠释。
        我有几个熟识的朋友,都并非计算机专业,他们大都对计算机专业能够有这么多经典著作(无论原版还是翻译版本)出现在国内的市场上表示羡慕不已。虽然现在有些出版物的确有不负责任之嫌,但真正热爱这门科学的朋友,我相信一定能够克服语言方面的障碍,通过交流和不断的学习,领悟到技术的精髓。

        稍有感悟,特此一记! (若有不同意见,欢迎拍砖)
 
posted @ 2006-01-18 17:14 小虫 阅读(251) | 评论 (0)编辑 收藏

    在使用类之前,我们通常会在程序中包含某个相应的头文件,因为自定义的类并不是程序语言本身的内建(built-in)。例如:
     #include <string>
     string s1[3] = {"winne","jackie","xp"};

    一般类的定义方式为:
     class stack //stack为类名
     {
       public:
           //.... 公共接口
       private:
          //....私有量的实现
     }

    成员函数可以在类主体内定义,也可以在主体外定义,但必须在class主体内进行声明。在主体内定一的成员函数会被自动视为内联(inline)函数;在主体外定义成员函数,如果希望该函数为inline,必须显式声明。例:
     inline bool
     stack::empty()
     {
         return _stack.empty();
     }
    运算符(::)是class scope resolution运算符

    通常类的定义和内联成员函数会放在与类同名的头文件中。如上例中的stack class的定义和empty()函数的定义,都放在stack.h文件中。

posted @ 2006-01-16 15:53 小虫 阅读(493) | 评论 (1)编辑 收藏
仅列出标题  下一页

<2024年10月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

常用链接

留言簿

随笔分类(7)

C++

Network

Search

最新随笔

积分与排名

  • 积分 - 7172
  • 排名 - 1348

最新评论