JAVA模拟题:TestoftheJavaSkill(4)
百度广告
Question 25:
int Output = 10;
if ((b1==true)&&((Output+=10)==20)){
}
System.out.println("Not equal!" + Output);
A. Compile error, attempting to perform binary comparison on logical data type
B. Compilation and output of "We are equal 10"
C. Compilation and output of "Not equal! 20"
D. Compilation and output of "Not equal! 10"
Question 26:
A. Java uses a time-slicing scheduling system for determining which Thread will execute.
B. Java uses a pre-emptive, co-operative system for determining which Thread will execute.
C. Java scheduling is platform dependent and may vary from one implementation to another.
D. You can set the priority of a Thread in code.
What will happen when you attempt to compile and run the following code?
public class MySwitch{
MySwitch ms = new MySwitch();
}
int k=10;
default:
break;
System.out.println("ten");
System.out.println("twenty");
}
}
A. None of these options
B. Compile time error target of switch must be an integral type
C. Compile and run with output "This is the default output"
D. Compile and run with output "ten" |||
Question 28:
public class StrEq{
StrEq s = new StrEq();
private StrEq(){
String s2 = new String("Marcus");
System.out.println("we have a match");
System.out.println("Not equal");
}
A. Compile time error caused by private constructor
B. Output of "we have a match"
C. Output of "Not equal"
D. Compile time error by attempting to compare string using ==
Question 29:
A. short myshort = 99S;
B. String name = 'Excellent tutorial Mr Green';
C. char c = 17c;
D. int z = 015;
Which of the following are benefits of encapsulation?
A. All variables can be manipulated as Objects instead of primitives
B. By making all variables protected they are protected from accidental corruption
C. The implementation of a class can be changed without breaking code that uses it
D. making all methods protected prevents accidental corruption of data
Question 31:
interface IFace{}
class Base{}
public class ObRef extends Base{
ObRef ob = new ObRef();
Object o1 = new Object();
}
A. o1 = o2;
B. b = ob;
C. ob = b;
D. o1 = b;
Your chief software designer has shown you a sketch of the new Computer parts system she is about to create. At the top of the hierarchy is a Class called Computer and under this are two child classes. One is called LinuxPC and one is called WindowsPC. The main difference between the two is that one runs the Linux OS and the other runs the Windows OS (of course another difference is that one needs constant re-booting and the other runs reliably). Under the WindowsPC are two Sub classes one called Server and one Called Workstation. How might you appraise your designers work?
A. Give the go ahead for further design using the current scheme
B. Ask for a re-design of the hierarchy with changing the OS to a field rather than Class type
C. Ask for the option of WindowsPC to be removed as it will soon be obsolete
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>