问题 单项选择题

如下程序是为变量i赋值。若程序的输出结果是180。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
class Base

int i;
Base()

add(10);

void add(int v)

i+=v;

void print()

System.out.println(i);


class Extension extends Base

Extension()

add(______);

void add(int v)

i+=v*2;


public class ConstructTest3

public static void main(String args[])

bogo(new Extension());

static void bogo(Base b)

b.add(60);
b.print();

答案

参考答案:T

解析:[讲解] 本题综合考查了几个知识点,如调用子类的构造函数时,会先调用父类的构造函数;如果在子类的构造函数中没有显示调用父类的构造函数,那么创建子类的实例时,会先调用父类的缺省构造函数;方法的动态绑定。这些知识是考试的难点。以上代码创建的是Extension类的实例,所以,在运行时,所有调用add()方法的过程,将始终和Extension类的 add()方法动态绑定。以下是程序依次对变量i的改变过程。
初始值:i=0
Step1:创建实例new Extension()
先调用父类的缺省构造函数Base(),注意,父类中的add方法已被子类重写。父类的缺省构造函数中执行add(10),i=0+10*2得到i=20,再调用子类的缺省构造函数Extension(),假设横线处应填入的数是x,子类的缺省构造函数中执行add(x),i=20+x*2。
step2:执行add(60)
i=20+x*2+60*2=180得到x=20

多项选择题
单项选择题

Those of us hurrying to finish our taxes by tomorrow’s deadline will probably be subjected to thoughts of the I.R.S. (Internal Revenue Service) as an all-powerful bully. But the truth is, the government is not always a match for the tax advisors of wealthy people, so a lot of taxes will go unpaid at the top of the income scale.

Lawyers who represent high-income taxpayers earn more than 10 times what senior government lawyers do—an obvious disadvantage for the government agencies in attracting and retaining top talent. The lawyers who write our tax rules are overworked and sometimes inexperienced, so that they leave loopholes that are exploited by more experienced private lawyers. And the government always loses cases which it should win, and provides private lawyers with precedents.

As this vicious cycle shows, skimping (节约) on tax administration is a false economy. Instead, if we substantially increase government salaries and staffing levels, we can raise more revenue, with lower tax rates and less waste. Four reforms should be adopted immediately.

First, the government should focus on hiring talented young lawyers, since the pay disparity with the private sector is narrower for them. These efforts will be more effective if Congress helps new graduates repay student loans, which often are more than $100,000. A loan repayment program would be a powerful recruiting device.

Second, the government should tap another promising talent pool—recent retirees from private practice—to mentor young lawyers. The salary gap is less of an issue for retirees, and the opportunity to give back to the tax system can be quite appealing.

Third, the government should retain a small team of a dozen top tax lawyers at salaries closer to the market rate. They can serve as a rapid reaction force, deciding whether to shut down a new aggressive strategy immediately or to let it be evaluated through usual government channels.

Fourth, the government should retain private lawyers to help with high-priority projects. An important constraint is that lawyers who represent private clients may view it as a conflict to help the government. But this is not always true.

Through bar associations, private lawyers already volunteer to review proposed changes in the tax law and offer ways to improve them. Tax academics can also be a valuable and conflict-free source of expertise, since they ordinarily do not represent clients. And some tax litigators (诉讼律师) may view it as a prestigious opportunity and a patriotic service to represent the government in a tax case that could set an important precedent.

The tax system can be only as p as the people who run it, so the government has to recruit and retain the most promising talent. A tax system can be fair and efficient only when it is administered soundly.

Which of the following is true of the text ?()

A.The U.S. government revenue agencies always bully taxpayers.

B.The salary gap between senior government lawyers and private lawyers is smaller.

C.Private lawyers are unwilling to help the government make countermeasures against themselves.

D.Reforms in tax administration can help reduce waste and tax rate, and collect more revenue.