易错题汇总

感谢您能抽出几分钟时间来参加本次答题,现在我们就马上开始吧!
以下哪个选项用于将用户界面与活动相关联?
setContentView()
setView()
createContentView()
createView()
一下那个选项表示用于激活应用程序组件
活动
小部件
视图视图
Intent
以下哪个工具用于调试与布局相关的事项,它使你能够调试和优化应用的UI。
ADB
DDMS
Hierarchy Viewer
Traceview
你需要重写以下哪种方法来创建广播接收器?
onCreate()
sendBroadcast()
onStartCommand()
onReceive()
以下哪个类型的通知运行你显示简短消息?
消息条通知
状态栏通知
对话框通知
进度对话框通知
以下哪个选项用于从移动网络提供商接收位置设置?
Android.permission.ACCESS_FINE_LOCATION
Android.permission.ACCESS_SINGLE_LOCATION
Android.permission.ACCESS_MULTIPLE_LOCATION
Android.permission.ACCESS_COARSE_LOCATION.
Liza想使用Android手机应用得到正确的经度和维度,从而追踪她的位置。她的应用必须使用下面哪段代码来得到正确的位置?
LocationManager lm ;List providers = lm.getProviders(true);for (String provider:providers){Location l = lm.getLastKnownLocation(provider);if(l != null)Toast.makeText(this, Latitude: +l.getLatitude() + \n Longitude+ l.getLongitude(), Toast.LENGHT_LONG).show();}
LocationProvider lp ;List providers = lp.getProviders(true);for (String provider:providers){Location l = lp.getLastKnownLocation(provider);if(l != null)Toast.makeText(this, Latitude: +l.getLatitude() + \n Longitude+ l.getLongitude(), Toast.LENGHT_LONG).show();}
LocationManager lm ;List providers = lm.getLocationProviders(true);for (String provider:providers){Location l = lm.getLastKnownLocation(provider);if(l != null)Toast.makeText(this, Latitude: +l.getLatitude() + \n Longitude+ l.getLongitude(), Toast.LENGHT_LONG).show();}
LocationManager lm ;List providers = lm.getProviders(true);for (String provider: providers){Location l = lm.getKnownLocation(provider);if(l != null)Toast.makeText(this, Latitude: +l.getLatitude() + \n Longitude+ l.getLongitude(), Toast.LENGHT_LONG).show();}
以下哪个选项在在线地图中显示了地理数据?
LocationManager
GSM
KML file format
GMS
以下哪个选项可让您发送和接收消息?
Android.telephony.SmsManager
Android.telephony.SmsMessage.SubmitPdu
Android.telephony.gsm.SmsManager
Android.telephony.gsm.SmsMessage
在创建项目的测试用例类时,不需要执行以下哪个操作?
执行状态管理测试
添加测试用例构造函数
添加Setup方法
添加初始化测试
以下哪个方法将在另一个活动将要获得用户焦 点时被调用?
onPause()
onRestart()
onResume()
onStop()
以下哪个类示-组描述位置的字符串?
Address
Criteria
Geocoder
Location
要创建自己的内容提供者,您应该创建一个类来扩 展抽象______类。
ContentProvider
ContentResolver
UriMatcher
Provider
Alice正在开发Android应用的UI。UI包含文本视图和编辑文本,放置方式是一个放在另- 个的下面。创建此类UI需要使用以下哪个布局和属性组合?
线性布局,并诅android:orientation属性设置为vertical。
相对布局,并且android:orientation属性设置为horizontal。
相对布局,诅android:orientation属性设置为vertical
线性布局,并且android:orientation属性设置为horizontal.
在以下代码段中填空, 该代码段显示如何使用类名为IncomingSMSReceiver的广播接收器来侦听传入消息:1. fmal String RECEIVED_ SMS="__ ”;2.__________ft=new_____(RECEIVED_ SMS); 3.BroadcastReceiver receiver = new ________();4.4. registerReceiver(receiver, ft); .
android provider. Telephony SMS_ RECEIVED 2. IntentF ilter IntentF ilter3.IncomingSMSReceiver
android provider. Telephony 2.Intent, Intent 3. listen
android provider Telephony.SMS_ RECEIVED 2.IntentF ilter, IntentFiter 3. onReceive
android. provider.Telephony.SMS_ RECEIVED 2.PendingIntent, PendingIntent 3. getBroadcast
识别以下代码段中包含错误(如有)的行号:1. public class MyCompoundView implements LinearLayout{ 2EditText eT; 3.Button Btn; 4.String str; 5. public MyCompoundView(Context context, AttributeSet Att) {6.33 super(context, Attr); 7.String service = ContextLAYOUT _INFLATER SERVICE; 8LayoutInflater i =(LayoutInflater)getContextO.getSystemService(service); 9.1i. inflat(R.layout mainl, this, true); 10. eT = (EditText)findViewById(R id.editText1); 11.Btn = (Button)findViewById(R id. add); 12AddUrl0; 13.} 14. private void AddUrl0{ 15 Btn setOnClickL istener(new Buton.OnClickL istener0 { 16. public void onClick(Viewv) }}); 17.}}
第1行出错
第10行出错
第7行出错
没错误
RestTemplate的以下哪种DELETE方法无法正确删除结果?
delete(String url, Object… urlVariables)
delete(String url, Map urlVariables)
delete(URI url, Class deleteType)
delete(URI url)
以下哪项是ribbon指定客户端的配置?
ribbon.client.key=value
client.ribbon.key=value
ribbon.key=value
client.key=value
关于Hystrix使用详解描述错误的?
fallback 是 Hystrix 命令执行失败时使用的后备方法,用来实现服务的降级处理逻辑。 注解使用参数为defaultFallbackMethod
以通过@HystrixCommand 注解来更为优雅地实现 Hystrix 命令的定义
使用注册配置实现 Hystrix 命令时,它还支持忽略指定异常类型功能,只需要通过设置@HystrixCommand 注解的 ignoreExceptions 参数,比如:
注解配置方式也同样可以实现异常的获取。它的实现也非 常简单,只需要在 fallback 实现方法的参数中增加 Throwable e 对象的定义,这样在方法内部就可以获取触发服务降级的具体异常内容了
关于请求缓存注解描述错误的是
@CacheResult 该注解用来标记请求命令返回的结果应该被缓存,它必须与 @HystrixCommand 注解结合使用
@CacheRemove 该注解用来让请求命令的缓存失效,失效的缓存根据定义的 Key 决定
如果同时还使用了 @CacheResult 和@CacheRemove 注解的 cacheKeyMethod 方法指定缓存 Key 的生成,那么该注解@CacheKey将仍起作用
使用注册配置实现 Hystrix 命令时,它还支持忽略指定异常类型功能,只需要通过设置@HystrixCommand 注解的 ignoreExceptions 参数,比如:
HBase依靠以下哪个框架存储底层数据?
HDFS
Zookeeper
Hive
MapReduce
在Hadoop的shell命令中,显示HDFS上/user/niit/data.txt文件内容的命令,正确的是?
hadoop fs -cat /user/niit/data.txt
hadoop -cat /user/niit/data.txt
hadoop dfs -cat /user/niit/data.txt
hadoop cat -fs /user/niit/data.txt
关于ResourceManager的说法,正确的是?A:用户提交的每个应用程序均包含一个ApplicationMaster,主要功能与ResourceManager调度器协商以获取资源B:和资源管理器协商,以获取资源(Container)
A正确,B不正确
A不正确,B正确
A和B都正确
A和B都不正确
关于Container的说法,正确的是?A:Container 是YARN 中的资源抽象,它封装了某个DataNode节点上的资源,如有多少内存、多少个CPUB:ResourceManager以Container的形式来返回NodeManager申请的资源
A正确,B不正确
A不正确,B正确
A和B都正确
A和B都不正确
关于NodeManager的说法,正确的是?A:它会定时地向 AM 汇报本节点上的资源使用情况和各个 Container 的运行状态B:它接收并处理来自 AM 的 Container 启动/停止等各种请求
A正确,B不正确
A不正确,B正确
A和B都正确
A和B都不正确
请分析以下代码片段:public class WordCount { public static void main(String[] args) throws Exception {Configuration conf = new Configuration();① Job job = Job.getInstance(conf);② job.setJarByClass(WordCount);③ job.setMapperClass(TokenizerMapper.class);④ job.setReducerClass(IntSumReducer.class);……  System.exit(job.waitForCompletion(true) ? 0 : 1); } public static class TokenizerMapper extends Mapper<Object, Text, Text, IntWritable> {…… } public static class IntSumReducer extends Reducer<Text, IntWritable, Text, IntWritable> {  …… }}语句①-④中有语法错误的是?
①有语法错误
②有语法错误
③有语法错误
④有语法错误
class DistinctMapper extends Mapper<LongWritable, Text, Text, NullWritable> {① @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { context.write(value, NullWritable.get()); }}class DistinctReducer extends Reducer<Text, NullWritable, Text, NullWritable> {② @Override protected void reduce(Text key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException { context.write(key, NullWritable.get()); }}public class DistinctDriver { public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {Configuration conf = new Configuration();Job job =Job.getInstance(conf); job.setJarByClass(DistinctDriver.class);  job.setMapperClass(DistinctMapper.class); job.setReducerClass(DistinctReducer.class);job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class);③  job.setOutputKeyClass(Text.class);  job.setOutputValueClass(NullWritable.class);④  FileInputFormat.addInputPath(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1]));System.exit(job.waitForCompletion(true) ? 0 : 1);}}以上代码实现了去重模式,其中有一处错误,以下那个选项的描述是正确的:
①处有错误, 应该改为MapperObject, Text, Text, NullWritable
②处有错误,应该改为ReducerNullWritable, Text, Text, NullWritable
③处有错误,应该改为job.setMapOutputValueClass(NullWritable.class);
④处有错误,应该改为job.setOutputValueClass(Text.class);

27题 | 被引用0次

使用此模板创建