题目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 |