sap笔试试题

时间:2022-07-31 03:12:58 面试笔试 我要投稿
  • 相关推荐

sap笔试试题

  1.below is usual way we find one element in an array:

sap笔试试题

  const int *find1(const int* array, int n, int x)

  {

  const int* p = array;

  for(int i = 0; i < n; i++)

  {

  if(*p x)

  {

  return p;

  }

  ++p;

  }

  return 0;

  }

  in this case we have to bear the knowledge of value type "int", the size of

  array,

  even the existence of an array. would you re-write it using template to elim

  inate all

  these dependencies?

  2. assume you have a class like

  class erp

  {

  hr* m_hr;

  fi* m_fi;

  public:

  erp()

  {

  m_hr = new hr();

  m_fi = new fi();

  }

  ~erp()

  {

  }

  };

  if "new fi()" failed in the constructor, how can you detect this problem and

  release the

  properly allocated member pointer m_hr?

  3. check the class and variable definition below:

  #include

  #include

  using namespace std;

  class base

  {

  public:

  base() { cout<<"base-ctor"< ~base() { cout<<"base-dtor"< virtual void f(int) { cout<<"base::f(int)"< virtual void f(double) {cout<<"base::f(double)"< virtual void g(int i = 10) {cout<<"base::g()"<};

  class derived: public base

  {

  public:

  derived() { cout<<"derived-ctor"< ~derived() { cout<<"derived-dtor"< void f(complex) { cout<<"derived::f(complex)"< virtual void g(int i = 20) {cout<<"derived::g()"<};

  base b;

  derived d;

  base* pb = new derived;

  select the correct one from the four choices:

  cout

  cout

  pb->f(1.0);

  a.derived::f(complex) b.base::f(double)

  pb->g();

  a.base::g() 10 b.base::g() 20

  c.derived::g() 10 d.derived::g() 20

  4.implement the simplest singleton pattern(initialize if if necessary).

  5.name three sort algorithms you are familiar with. write out the correct or

  der by the

  average time complexity.

  6.write code to sort a duplex direction linklist. the node t has overridden

  the comparision operators

【sap笔试试题】相关文章:

java笔试题,笔试题目分享08-10

ITT HR的笔试题目,笔试试题08-09

synopsys CS笔试题,笔试试题分享08-09

腾讯笔试题 试题分享08-09

电厂笔试题 试题题目08-10

亚信科技笔试题,笔试题目分享08-09

扬智Ali的笔试题,笔试题目分享08-09

中兴笔试题08-18

OTIS笔试题08-10

瑞星笔试题08-06