当前位置:首页 > 全部子站 > IT > 思科认证

SCJP试题-SCJPMockExam4

来源:长理培训发布时间:2017-12-19 10:53:07

 百度广告

Question 1) 
1) float f=1.3;  
3) byte b=257;  
5) int i=10; 



Question 2) 

public class MyClass { 
amethod(arguments); 
public void amethod(String arguments) { 
System.out.println(arguments[1]); 

2) error method main not correct  
4) amethod must be declared with String 

Answer to Question 2 


Question 3) 

1) 

import java.awt.*; 
class Myclass {} 

package MyPackage; 
class MyClass{} 

/*This is a comment */

package MyPackage; 
class MyClass{}

Answer to Question 3 


Question 4) 

1) -128 to 127  
3) -255 to 256  

Answer to Question 4 


Question 5) 

java myprog good morning 
public static void main(String argv) 
System.out.println(argv) 

2) good  
4) Exception raised: "java.lang.ArrayIndexOutOfBoundsException: 2" 



Question 6) 

1) if  
3) goto  
5) case 

Answer to Question 6 


Question 7) 

1) 2variable  
3) _whatavariable  
5) $anothervar  

Answer to Question 7 


Question 8) 


static int i; 
System.out.println(i); 

2) null  
4) 0 

Answer to Question 8 


Question 9) 

public class Q { 
int anar=new int{1,2,3}; 

1) 1  
3) 2  



Question 10)

What will happen if you try to compile and run the following code? 

public class Q { 
int anar=new int; 

1) Error: anar is referenced before it is initialized  
3) 0  

Answer to Question 10 


Question 11)

What will be the result of attempting to compile and run the following code? 

abstract class MineBase { 
static int i; 
public class Mine extends MineBase { 
int ar=new int; 
System.out.println(ar[i]); 

2) Error: ar is used before it is initialized  
4) IndexOutOfBoundes Error 

Answer to Question 11  


Question 12) 

int i=1; 
case 0: 
break; 
System.out.println("one"); 
System.out.println("two"); 
System.out.println("default"); 
1) one  
3) one, two, default  

Answer to Question 12 


Question 13) 

int i=9; 
default: 
case 0: 
break; 
System.out.println("one"); 
System.out.println("two"); 
1) default  
3) error default clause not defined  

Answer to Question 13 


Question 14) 

1) 

int i=0; 
System.out.println("Hello"); 
2) 

boolean b=true; 
if(b==b2) { 

int i=1; 
if(i==1|| j==2) 
4) 

int i=1; 
if(i==1 &| j==2)

System.out.println("OK"); 


Question 15) 
no file called Hello.txt in the current directory?. 

import java.io.*; 
public static void main(String argv){ 
System.out.println(m.amethod()); 
public int amethod() { 
FileInputStream dis=new FileInputStream("Hello.txt"); 
System.out.println("No such file found"); 
}catch(IOException ioe) { 
System.out.println("Doing finally"); 

return 0; 


2 No such file found ,-1  
4) 0 

Answer to Question 15 


Question 16) 

1) Methods cannot be overriden to be more private 
3) Private methods cannot be overloaded 

Answer to Question 16 


Question 17) 

class Base {} 
class Sub2 extends Base {} 
public static void main(String argv){ 
Sub s=(Sub) b; 

2) Compile time Exception  



Question 18) 

1) System.out.println( -1 >>> 2);will output a result larger than 10 
>> 2); will output a positive number  
> 1); will output the number 1  
4) System.out.println( 1

责编:罗莉

发表评论(共0条评论)
请自觉遵守互联网相关政策法规,评论内容只代表网友观点,发表审核后显示!

国家电网校园招聘考试直播课程通关班

  • 讲师:刘萍萍 / 谢楠
  • 课时:160h
  • 价格 4580

特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关

配套通关班送国网在线题库一套

课程专业名称
讲师
课时
查看课程

国家电网招聘考试录播视频课程

  • 讲师:崔莹莹 / 刘萍萍
  • 课时:180h
  • 价格 3580

特色解密新课程高频考点,免费学习,助力一次通关

配套全套国网视频课程免费学习

课程专业名称
讲师
课时
查看课程
在线题库
面授课程更多>>
图书商城更多>>
在线报名
  • 报考专业:
    *(必填)
  • 姓名:
    *(必填)
  • 手机号码:
    *(必填)
返回顶部