SAP中国员工笔试试题及答案:
1.Below is usual way we find one element in an array:
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
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
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中国员工笔试试题及答案的回答:
报歉,目前还没有相关答案。我来抢答案?
- 当前共有0条记录,每页0条,当前0/0页
- 上一页
- 下一页
湖北成教网 武汉纺织大学成教
武汉轻工大学成教
湖北师范大学成教
武汉工程大学成教
长江大学成教
湖北科技学院成教
荆州教育学院成教
荆楚理工学院成教
湖北开放职业学院成教
湖北中医药高等专科学校成教
湖北理工学院成教
荆州理工职业学院成教
湖北国土资源职业学院成教
中南财经政法大学成教
武汉大学成教
武汉理工大学成教
武汉科技大学成教
华中农业大学成教
湖北工业大学成教
湖北中医药大学成教
武汉成人高考网
孝感成人高考网
荆州成人高考网
咸宁成人高考网
宜昌成人高考网
襄阳成人高考网
十堰成人高考网
武汉自考网
黄冈自考网
宜昌自考网
襄阳自考网
十堰自考网
湖北成人高考报名网
湖北自考报名网
湖北大学成教
湖北工业大学成教
湖北中医药大学成教
华中农业大学成教
武汉大学成教网
武汉科技大学成教
武汉理工大学成教
中南财经政法大学成教
上海成考网
上海自考网
中南财经政法大学自考
中南财经政法大学自考
华中师范大学自考招生网
武汉理工大学自考
湖北大学自考
华中农业大学自考
湖北中医药大学自考
湖北工业大学自考
华中师范大学自考招生网
湖北中医药大学成教
湖北中医药大学成教
武汉理工大学成教
武汉科技大学成教
武汉大学成教
湖北工业大学成教
湖北大学成教
华中农业大学成教
中南财经政法大学成教
华中师范大学成教
湖北中医药大学自考
武汉理工大学自考
武汉大学自考
湖北工业大学自考
湖北大学自考
华中农业大学自考
中南财经政法大学自考
华中师范大学自考