路透常考笔试题分享 -管理资料

管理资料 时间:2019-01-01 我要投稿
【www.unjs.com - 管理资料】

路透常考笔试题分享:

1.class

{

public:

void f();

const void g();

private;

int data;

}

下面哪个选项可以访问data?

a.g() b.f() c. g()和f() d.都不可以

2.which one calls a program to halt?(multiple answers)

A.assert(10>0) B.assert(10<0) C.assert(x=0) D.assert(x<0)

3.void time(int year,int moth=10,date=10);

下面哪些选项可以正确调用time()?

a.time(1995);

b.time(1995,1);

c.time(1995,1,2);

d.都不可以

4.下面哪个选项可以访问一个类的私有成员?

a.友元类的公有成员函数 b.类的公有成员函数 c.类的私有成员函数 d.都可以 e.都不可以

5.下面是一个类的几个部分,哪些部分有错误?

a.void ~Time(int);

b.class Time

{

public:

private:

int hour=0;

};

c.int Time(const char*,const char*);

d.Time(const char*,const char*);

6.什么时候会用到模版类?

7.(大概是这么个意思)

#include

int a =0;

void fn(int j,int *k)

{

int i=0;

i++;

int a=1;

*k=a;

j=i;

}

void main()

{

fn(1,2);

cout<

cout<<*k<

cout<

}

a,b,c句的打印结果是什么?

8.void f(________head_ptr);

其中head_ptr是链表的头,f()是一个要对链表进行某种操作的函数,这个链表可能本来有一个头结点,

路透常考笔试题分享

管理资料

路透常考笔试题分享》(https://www.unjs.com)。

横线上应该填什么?

a.node *, b.node &, c.node*&, d.node

9. 一个二叉树

10

/

2 15

/ /

1 30 3 5

移去二叉树的根节点并且用其他节点代替,用哪些节点使这个二叉树不受影响?

a. 2 b.15 c.1 d.3 e.5

10.(题目都没看懂)

circular array of CAPACITY elements, last is an index into that array, formular for the index afer last?

11.MyStruct

{

int a;

char*p;

double b;

}

void main()

{

MyStruct s[20];

MyStruct *p1=(MyStruct*)malloc(sizeof(MyStruct));

MyStruct*p2=new MyStruct;

}

求sizeof(MyStruct),sizeof(s);sizeof(p1),sizeof(p2);

12.

int fn(char *s)

{

int a=0;

while(*s++)

{

a++;

}

return a;

}

void main()

{

char str[20]="AAABBBCCC";

int i=fn(str);

int j=sizeof(str);

strcpy(str+3,"DDD");

cout<

}

i=?,j=?,最后输出的str=?

最新文章
推荐文章