本期试题:
1.【多选】java.io包中定义了多个流类型来实现输入和输出功能,可以从不同的角度对其进行分类,按功能分为:(),如果为读取的内容进行处理后再输出,需要使用下列哪种流?( )
A、输入流和输出流 B、字节流和字符流 C、节点流和处理流 D、File stream E、Pipe stream F、Random stream G、Filter stream
2.【单选】下列代码的执行结果是:( )
public class Test3{
public static void main(String args[]){
System.out.print(100%3);
System.out.print(",");
System.out.println(100%3.0);
}
}
复制代码
A、1,1 B、1,1.0 C、1.0,1 D、1.0,1.0
3.【单选】以下程序的运行结果为( )
public class IfTest{
public static void main(String args[]){
int x=3;
int y=1;
if(x==y)
System.out.println("Not equal");
else
System.out.println("Equal");
}
}
复制代码
A、Not equal B、Equal C、无输出 D、编译出错
4.【单选】Java语言中字符串“学Java”所占的内存空间是( )
A、 6个字节 B、 7个字节 C、10个字节 D、11个字节
5.【单选】关于下列程序段的输出结果,说法正确的是( )
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
复制代码
A、有错误,变量i没有初始化。 B、null C、1 D、0
6.【多选】下面异常是属于 Runtime Exception 的是( )
A、ArithmeticException B、IllegalArgumentException C、NullPointerException D、BufferUnderflowException
7.【填空】写出adb 常用指令的作用。
adb logcat : __________ ___
adb kill-server : ________
adb pull: _____________
adb devices :___________ _
8.【填空】我们用_ ______ __来定义一个整数,用________ _来定义一个字符类型,称为原始数据类型。
9.【填空】程序运行的结果是:_________ ___。
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
Sytem.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
复制代码
10.【简答】请解释下在单线程模型中Message、Handler、Message Queue、Looper之间的关系。
答案:
1.CG 2.B 3.B 4.A 5.D 6.ABCD
7.adb logcat : _获取adb的日志
adb kill-server : _杀死adb的调试桥
adb pull: _到出文件
adb devices :_列出连接在调试桥上的设备
8.int 、char 9.good and gbc
10.答:简单的说,Handler获取当前线程中的looper对象,looper用来从存放Message的MessageQueue中取出Message,再有Handler进行Message的分发和处理。
1.【多选】java.io包中定义了多个流类型来实现输入和输出功能,可以从不同的角度对其进行分类,按功能分为:(),如果为读取的内容进行处理后再输出,需要使用下列哪种流?( )
A、输入流和输出流 B、字节流和字符流 C、节点流和处理流 D、File stream E、Pipe stream F、Random stream G、Filter stream
2.【单选】下列代码的执行结果是:( )
public class Test3{
public static void main(String args[]){
System.out.print(100%3);
System.out.print(",");
System.out.println(100%3.0);
}
}
复制代码
A、1,1 B、1,1.0 C、1.0,1 D、1.0,1.0
3.【单选】以下程序的运行结果为( )
public class IfTest{
public static void main(String args[]){
int x=3;
int y=1;
if(x==y)
System.out.println("Not equal");
else
System.out.println("Equal");
}
}
复制代码
A、Not equal B、Equal C、无输出 D、编译出错
4.【单选】Java语言中字符串“学Java”所占的内存空间是( )
A、 6个字节 B、 7个字节 C、10个字节 D、11个字节
5.【单选】关于下列程序段的输出结果,说法正确的是( )
public class MyClass{
static int i;
public static void main(String argv[]){
System.out.println(i);
}
}
复制代码
A、有错误,变量i没有初始化。 B、null C、1 D、0
6.【多选】下面异常是属于 Runtime Exception 的是( )
A、ArithmeticException B、IllegalArgumentException C、NullPointerException D、BufferUnderflowException
7.【填空】写出adb 常用指令的作用。
adb logcat : __________ ___
adb kill-server : ________
adb pull: _____________
adb devices :___________ _
8.【填空】我们用_ ______ __来定义一个整数,用________ _来定义一个字符类型,称为原始数据类型。
9.【填空】程序运行的结果是:_________ ___。
public class Example{
String str=new String("good");
char[]ch={'a','b','c'};
public static void main(String args[]){
Example ex=new Example();
ex.change(ex.str,ex.ch);
System.out.print(ex.str+" and ");
Sytem.out.print(ex.ch);
}
public void change(String str,char ch[]){
str="test ok";
ch[0]='g';
}
}
复制代码
10.【简答】请解释下在单线程模型中Message、Handler、Message Queue、Looper之间的关系。
答案:
1.CG 2.B 3.B 4.A 5.D 6.ABCD
7.adb logcat : _获取adb的日志
adb kill-server : _杀死adb的调试桥
adb pull: _到出文件
adb devices :_列出连接在调试桥上的设备
8.int 、char 9.good and gbc
10.答:简单的说,Handler获取当前线程中的looper对象,looper用来从存放Message的MessageQueue中取出Message,再有Handler进行Message的分发和处理。