
2.美工: 主要是迟碧设计页面,页面排版,效果图展示
分工是,美工做好效码毕举果图,然后前端用代码写出来,望采纳
一、 选择题:(每题1分,共30分乱拍肢)1. Which statement about the garbage collection mechanism are true? (B)
A.Garbage collection require additional program code in cases where multiple threads are running.
B.The programmer can indicate that a reference through a local variable is no longer of interest.
C.The programmer has a mechanism that explicit and immediately frees the memory used by Java objects.
D.The garbage collection mechanism can free the memory used by Java Object at expectable time.
E.The garbage collection system never reclaims memory from objects while are still accessible to running user threads.
2. Give the following method: D
1)public void method( ){
2) String a,b
3) a=new String(“hello world”)
4) b=new String(“game over”)
5) System.out.println(a+b+”ok”)
6) a=null
7) a=b
8)System.out.println(a)
9) }
In the absence of compiler optimization, which is the earliest point the object a referred is definitely hand to be garbage collection. ()
A. before line 3 B.before line 5 C. before line 6 D.before line 7 E. Before line 9
3. Give the following code:
public class Example{
public static void main(String args[] ){
int l=0
do{
System.out.println(“Doing it for l is:”+l)
}while(l>哗世0)
System.out.println(“Finish”)
}
}
Which well be output: D
A. Doing it for l is 3 B. Doing it for l is 1C Doing it for l is 2
D. Doing it for l is 0 E. Doing it for l is –1F. Finish
4. 以下(C)是JAVA的保留字。(选择一项)
A.JavaB.Hello C.class D.Class
5. 下面程序运行之后,变量x的值贺告是(B). (选择一项)
......
//swap方法的声明
public static void swap(int a,int b){
int t=a
a=b
b=t
}
//main方法
public static void main(String args[]){
int x=2
int y=3
swap(x,y)
}
A、2B、3 C、4D、6
6. 下面变量var的作用域范围是(D)。(选择一项)
1. //....
2. int x
3. switch(x){
4. case 0:
5. {
6. int var
7. //process
8. }
9. break
10. case 1:
11. {
12. int var1
13. //process
14. }
15. break
16. }
A、1和16行之间 B、4和8行之间 C、6和8行之间 D、6和14行之间
7. 以下的类(接口)定义中正确的是(A)。(选择一项)
A.
public class a {
private int x
public getX(){
return x
}
}
B.
public abstract class a {
private int x
public abstract int getX()
public int aMethod(){
return 0
}
}
C.
public class a {
private int x
public abstract int getX()
}
D.
public interface interfaceA{
private int x
public int getX(){
return x
}
}
8. 已知A类被打包在packageA , B类被打包在packageB ,且B类被声明为public ,且有一个成员变量x被声明为protected控制方式 。C类也位于packageA包,且继承了B类 。则以下说话正确的是(C)(选择一项)
A. A类的实例不能访问到B类的实例
B. A类的实例能够访问到B类一个实例的x成员
C. C类的实例可以访问到B类一个实例的x成员
D. C类的实例不能访问到B类的实例
9. 编译并运行下面的Java代码段:
char c='a'
switch (c) {
case 'a':
System.out.println("a")
default:
System.out.println("default")
}
输出结果是(B)。(选择一项)
A.代码无法编译,因为switch语句没有一个合法的表达式
B.a Default
C.a
D.default
10. 在Java中,关于final关键字的说法正确的是(AC)。(选择两项)
A.如果修饰变量,则一旦赋了值,就等同一个常量
B.如果修饰类,则该类只能被一个子类继承
C.如果修饰方法,则该方法不能在子类中被覆盖
D.如果修饰方法,则该方法所在的类不能被继承
11. 在Java中,要想使只有定义该类所在的包内的类可以访问该类,应该用(A)关键字。(选择一项)
A.不需要任何关键字
B.private
C.final
D.protected
12. 在Java中,下面关于包的陈述中正确的是(AD)。(选择两项)
A.包的声明必须是源文件的第一句代码
B.包的声明必须紧跟在import语句的后面
C.只有公共类才能放在包中
D.可以将多个源文件中的类放在同一个包中
13. public static void main方法的参数描述是:AB(请选择2个正确答案)
A.String args[]
B.String[] args
C.Strings args[]z
D.String args
14. 编译并运行下面的Java程序:B
class A{
int var1=1
int var2
public static void main(String[] args){
int var3=3
A a=new A()
System.out.println(a.var1+a.var2+var3)
}
}
将产生()结果。(选择一项)
A.0
B.4
C.3
D.代码无法编译,因为var2根本没有被初始化
15. 编译,运行下列代码后的结果是:D(选择一项)
public class Test {
public static void main (String args []) {
int age
age = age + 1
System.out.println("The age is " + age)
}
}
A.编译,运行后没有输出
B.编译,运行后输出:The age is 1
C.能通过编译,但运行时产生错误
D.不能通过编译
16. 下列哪些表达式返回true:AB(请选择2个正确答案 )
A."john" == "john"
B."john".equals("john")
C."john" = "john"
D."john".equals(new Button("john"))
17. Give the code fragment:B
1)switch(x){
2) case 1: System.out.println(“Test 1”)break
3) case 2:
4) case 3: System.out.println(“Test 2”)break
5) default: System.out.println(“end”)
6) }
which value of x would cause “Test 2” to the output:
A. 1B. 2C. 3D. default
18. Given the following class definition: A
class A{
protected int i
A(int i){
this.i=i
}
}
which of the following would be a valid inner class for this class?
Select all valid answers:
A. class B{
}
B.class B extends A{
}
C.class B extends A{
B(){System.out.println(“i=”+i)}
}
D.class B{
class A{}
}
E.class A{}
19. The following code is entire contents of a file called Example.java,causes precisely one error during compilation: D
1) class SubClass extends BaseClass{
2) }
3) class BaseClass(){
4) String str
5) public BaseClass(){
6)System.out.println(“ok”)}
7) public BaseClass(String s){
str=s}
9) }
10) public class Example{
11) public void method(){
12)SubClass s=new SubClass(“hello”)
13)BaseClass b=new BaseClass(“world”)
14) }
15) }
Which line would be cause the error?
A. 9 B. 10 C. 11 D.12
20. Float s=new Float(0.9F)
Float t=new Float(0.9F)
Double u=new Double(0.9)
Which expression’s result is true? B
A. s= =t B. s.equals(t) C. s= =u D. t.equals(u)
21. What happens when you try to compile and run the following program? A
class Mystery{
String s
public static void main(String[] args){
Mystery m=new Mystery()
m.go()
}
void Mystery(){
s=”constructor”
}
void go(){
System.out.println(s)
}
}
A.this code will not compile
B.this code compile but throws an exception at runtime
C.this code runs but nothing appears in the standard output
D.this code runs and “constructor” in the standard output
E.this code runs and writes ”null” in the standard output
22. Give the following class: B
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.println(ex.str+”and”+ex.ch[0] +ex.ch[1] +ex.ch[2])
}
public void change(String str,char ch[]){
str=”test ok”ch[0]=’g’
}
}
Which is the output:
A. good and abc B. good and gbc C. test ok and abc D. test ok and gbc
23. Which correctly create a two dimensional array of integers? CD
A.int a[][] = new int[][]
B.int a[10][10] = new int[][]
C.int a[][] = new int[10][10]
D.int [][]a = new int[10][10]
E.int []a[] = new int[10][10]
24. Examine the following code which includes an inner class: B
public final class Test4 implements A{
class Inner{
void test(){
if (Test4.this.flag){
sample()
}
}
private boolean flag=false
}
public void sample(){
System.out.println(“Sample”)
}
public Test4(){
(new Inner()).test()
}
public static void main(String args[]){
new Test4()
}
}
What is the result:
A.Print out “Sample”
B.Program produces no output but terminates correctly.
C. Program does not terminate.
E.The program will not compile
25. Which statement is true about an inner class? D
A.It must be anonymous
B.It can not implement an interface
C.It is only accessible in the enclosing class
D.It can access any final variables in any enclosing scope
26. public class Test{ A
public int aMethod(){
static int i=0
i++
return i
}
public static void main(String args[]){
Test test = new Test()
test.aMethod()
int j=test.aMethod()
System.out.println(j)
}
}
What is the result?
A.Compilation will fail
B.Compilation will succeed and the program will print”0”.
C.Compilation will succeed and the program will print”1”.
D.Compilation will succeed and the program will print”2”
27. class Super{ D
public int i=0
public Super(String text){
i=1}
}
public class Sub extends Super{
public Sub(String text){
i=2
}
public static void main(String ag[]){
Sub sub=new Sub(“Hello”)
System.out.println(sub.i)
}
}
What is the result?
A.Compilation will fail
B.Compilation will succeed and the program will print”0”.
C.Compilation will succeed and the program will print”1”
D.Compilation will succeed and the program will print”2”
28. Given A
Package foo
public class Outer{
public static class Inner{
}
}
Which statement is true?
A.An instance of the Inner class can be constructed with “new Outer.Inner():
B.An instance of the Inner class cannot be constructed outside of package foo
C.An instance of the Inner class can only be constructed from within the Outer class.
D.From within the package bar, an instance of the Inner class can be constructed with “new Inner()”
29. What is the result? E
public class Test{
static String s=”Hello”
public static void main(String args[]){
Test t=new Test()
t.methodA(s)
System.out.println(s)
}
void methodA(String s){
s+=”World”
}
}
A.print “Hello”
B.print “World”
C.print “Hello World”
D.It does not compile
30. what is the result? C
public class Test{
public static void main(String args[]){
String s=new String(”true”)
Boolean b=new Boolean(true)
If(s.equals(b))
{ System.out.println(“hello”)}
}
}
A.print “hello”
B.compile error at line 6
C.compile succeed but print nothing
D.compile succeed but throw exception at runtime
1、 B
2、 D
3、 D
4、 C
5、 B
6、 D
7、 A
8、 C
9、 B
10、 AC
11、 A
12、 AD
13、 AB
14、 B
15、 D
16、 AB
17、 B
18、 A
19、 D
20、 B
21、 A
22、 B
23、 CD
24、 B
25、 D
26、 A
27、 D
28、 A
29、 E
30、 C
补充一下:真正的面试时的笔试题,很少是选择题的,大多都是些问答题或者直接让你写程序的。如有你需要正规大公司的面试题,我这有一些word文档,可以给你发邮件。
一个软件好比一个盖大楼的工程。
你所看到的软件不是凭空而来的,都是程序员一个一个字的敲写,包括每个按钮、每个输入框都用特定的语言来制作而成....
一般一个管理软件有几十万行代码(每行也至少有30个英文字母)吧。 而且让这些代码 有序的 逻辑性的组织。
为什么说IT 民工, 因为它干的活跟瓦工每砖每瓦都亲手垒一样,代码一个一个的敲。
不多说了,反正 写文章一样,但余氏败文章每段落都要单独能让人读懂并不脱离整个文章就把程序写的很好了。
补充:编程是编写程序的中竖颤文核历简称,就是让计算机为解决某个问题而使用某种程序设计语言编写程序代码,并最终得到相应结果的过程。
为了使计算机能够理解人的意图,人类就必须要将需解决的问题的思路、方法、和手段通过计算机能够理解的形式告诉计算机,使得计算机能够根据人的指令一步一步去工作,完成某种特定的任务。这种人和计算机之间交流的过程就是编程。
编程:设计具备逻辑流动作用的一种“可控体系”【注:编程不一定是针对计算机程序而言的,针对具备逻辑计算力的体系,都可以算编程】
例子:①比如编写一段代码程序②编写一个控制设备体系。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)