IBM笔试题

[复制链接]
3470|21
手机看帖
扫描二维码
随时随地手机跟帖
pkat|  楼主 | 2013-2-26 22:50 | 显示全部楼层 |阅读模式
IBM, ST, TE, TI, IO
题目1. If a pre-order traversal sequence of a binary tree is abcdefg, which of the following possible in-order traversal sequence? (前序2差树什么的 没看懂)
A. abcdefg
B. gfedcba
C. bcdefga
D. bceadfg
E. bcdaefg

题目2. Which of the following(s) are NOT related to object-Oriented Design?(以下选项中哪个不是面向对象设计)
A. Inheritance
B. Liskov substitution principle
C. Open-close principle
D. Polymorphism
E. Defensive programming

题目3. In C/C++ programming language, among the following different types of variables, which is/are NOT possibly allocated on stack?(在C++编程语言中,下面这些变量那个/些不能在栈里分配)
A global static variables
B local variables
C method parameters
D. return values
E. none of above

题目4. Which "const" modifier should be removed (下面哪个const应该被移除, 真心没看懂啊没看懂!)

#include "stdafx.h"
#include <windows.h>
#define BUF_SIZE 100

class A
{
public:
  A();
  ~A(){};
public:
  inline const(a) BYTE* GetBuffer() const(b) {return m_pBuf;}
private:
  const(c) BYTE* const(d) m_pBuf;
};


A::A():m_pBuf(NULL)
{
  BYTE* pBuf = new BYTE[BUF_SIZE];
  if(pBuf == NULL)
    return;

  for(int i = 0; i < BUF_SIZE; i++)
  {
     pBuf[i]=i;
  }
  m_pBuf = pBuf;
}

int _tmain(int argc, _TCHAR* argv[])
{
  A a;
  Const(e) BYTE* pB = a.GetBuffer();
  if(pB != NULL)
  {
     for(int i = 0; i< BUF_SIZE; i++)
     {
        printf("%u", pB[i]++);
     }
  }


A. a B. b C. c D. d E. e







题目5 In C++, you can NOT throw exceptions from: (在C++中,你不能从以下哪个抛出异常)
A. constructor
B. destructor
C. Virtual function
D. const member function of a class
E. None of the above

题目6 which of the following are resolved at compile time?(下面那个不能在编译时间被解析,我翻译的对么?)
A Macros
B Inline functions
C Template in C++
D virtual function calls in C++



题目7. Which of the following C++ keyword(s) is(are) related to encapsulation? (下面哪个/些关键字与封装相关?)
A. virtual
B. void
C. interface
D. private
E. all of the above

题目8. A sorting algorithm is an algorithm that puts elements of a list in a certain order. Which of the following statement(s) is(are) correct:(下面关于排序哪个描述是正确的)
A. Bubble sort has worst-case and average complexity both O(n^2), where n is the number of items being sorted
B. Quick sort is widely used because it has the advantage of worst-case performance O(nlog(n))
C. Merge sort is a unstable sorting algorithm and average case performance is O(nlog(n))
D. Heap sort has the same time bounds as merge sort, but it requires only O(1) auxiliary space
E. None of the above

题目9. Please choose the right statement of "this" pointer:(下面关于this指针哪个描述是正确的)
A. "this" pointer cannot be used in static functions
B. "this" pointer could not be store in Register.
C. "this" pointer is constructed before member function.
D. "this" pointer is not counted for calculating the size of the object.
E. "this" pointer is read only.


题目10. The recursive function mystrlen(char *buf, int N)defined below tries to find the length of the first null-terminated string in the buffer buf(not counting the null character), where the buffer size is N. For instance if
   buf = {'b','u','f','f','e','r','\0','a','b','c'}
with N = 10 is the input, the desired output is 6. If the buffer does not have any null character the desired output is N.
   int mystrlen(char *buf, int N)
   {
      return mystrlen(buf, N/2) + mystrlen(buf + N/2, N/2);
   }

What are all the possible mistakes in the code? (代码中可能的错误是哪个/些)
A. There are no mistakes in the code
B. There is no termination of recursion
C. The addition of the the two mystrlen()s in the recursion is incorrect
D. The use of N/2 in the recursion is incorrect
E. Recursion cannot be used to calculate this function

题目11. Continuing the above example, which of the following recursive implementations fix the code fully? (如果要修正上题的错误,应该)
A. No change to the code in example above
B.
   int mystrlen(char *buf int N)
   {
     if(N==0)
       return 0;
     else
       return mystrlen(buf, N/2) + mystrlen(buf + N/2, N/2);
    }
C.
   int mystrlen(char *buf int N)
   {
     if(N==0||buf[0]==0)
       return 0;
     else if (N==1)
       return 1;
     int t = mystrlen(buf, N/2);
     if(t<N/2)
       return t;
     else
       return (t + mystrlen(buf + N/2, (N+1)/2));
    }
D. None of above
   
      
      

题目12. Which of the following data sequence(s) produces a balanced binary search tree if the inserted from left to right?
A. 8,-1,6,7,4,3,-2
B. 20,10,16,4,30,24,31
C. 7,12,3,-2,8,19,5,10
D. 10,5,20,6,2,1,22,15,30
E. all of the above


题目13. What is the complexity of the following question? Given an array A of integer numbers, find a pair of numbers A[i] and A[j], such that A[i] < A[j] and j-i is maximized (这个题目什么意思?)
A. O(logn)
B. O(n)
C. O(nlogn)
D. O(n^2)


题目14. About the link and array list, if we store same items with same sequence in an array list and a link list, which description(s) below is(are) wrong:(下面说法错误的是)
A. When known one item value, finding the item in the array list will be always faster than finding in the link list
B. Remove an item in a link list will cost lower memory and operation time than do it in an array list
C. Without thinking about memory usage, sorting in the array list will be always faster than sorting in the link list
D. Array list cost less memory than link list


题目15 If we define F(0) = 0,  F(1) = 1,  F(n) = F(n-1) + F(n-2) (n>=2), what is the result of F(1025) mod 5?
A. 0 B. 1 C. 2 D. 3 E. 4

相关帖子

无冕之王| | 2013-2-26 23:18 | 显示全部楼层
IBM试卷题目不是很难,都是偏基本功的。但题目比较多,就是考你英文阅读呢

使用特权

评论回复
dfsa| | 2013-2-26 23:23 | 显示全部楼层
不太难

使用特权

评论回复
yybj| | 2013-2-27 21:01 | 显示全部楼层
对英文水平要求比较高

使用特权

评论回复
sinadz| | 2013-2-27 21:04 | 显示全部楼层
题目很基础,不过要求英文水平高

使用特权

评论回复
txcy| | 2013-2-27 23:31 | 显示全部楼层
很好的一些笔试题

使用特权

评论回复
火箭球迷| | 2013-2-27 23:53 | 显示全部楼层
基础的笔试题

使用特权

评论回复
yybj| | 2013-2-27 23:56 | 显示全部楼层
做了一遍,的确是很基础

使用特权

评论回复
firstblood| | 2013-2-28 13:08 | 显示全部楼层
全英文的,不过还好都能看懂的,题目还是有些难度的

使用特权

评论回复
秋天落叶| | 2013-2-28 13:12 | 显示全部楼层
都是一些很基础的题目

使用特权

评论回复
baidudz| | 2013-2-28 13:15 | 显示全部楼层
IBM的面试题一般比较难

使用特权

评论回复
angerbird| | 2013-2-28 15:36 | 显示全部楼层
这些主要涉及到软件编程啥的,还是有些难度的

使用特权

评论回复
yybj| | 2013-2-28 16:05 | 显示全部楼层
很经典的一些题目

使用特权

评论回复
火箭球迷| | 2013-2-28 16:10 | 显示全部楼层
名企的笔试题还是很有代表性的

使用特权

评论回复
hsbjb| | 2013-2-28 16:21 | 显示全部楼层
很有代表性

使用特权

评论回复
xsgy123| | 2013-2-28 16:32 | 显示全部楼层
多做一些名企的笔试题还是很有好处的

使用特权

评论回复
sinadz| | 2013-2-28 18:24 | 显示全部楼层
多做一些这样的笔试题,对找工作还是很有帮助的

使用特权

评论回复
baidudz| | 2013-2-28 18:53 | 显示全部楼层
有没有答案

使用特权

评论回复
火箭球迷| | 2013-2-28 18:56 | 显示全部楼层
baidudz 发表于 2013-2-28 18:53
有没有答案

能给出答案就更好了

使用特权

评论回复
gxgclg| | 2013-2-28 20:26 | 显示全部楼层
想去外企,英语不好还真不行

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

196

主题

2726

帖子

0

粉丝