没有合适的资源?快使用搜索试试~ 我知道了~
首页SSD3 卡耐基课程 选择题题库
资源详情
资源评论
资源推荐
1.1.1
1. The name of a Java source file (d)
(a) must be the same as the class it defines, ignoring case
(b) must use the extension .class
(c) has no restrictions
(d) must be the same as the class it defines, respecting case
2. Which method must exist in every Java application? (a)
(a) main
(b) paint
(c) init
(d) begin
1.1.3
1. Given the following code, how many tokens will be output? (b)
StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
stdOut.println(st.nextToken() );
}
(a) 1 (b) 4 (c) 0 (d) 3
2. Classes from which of the following packages are implicitly imported into every Java program?
(a) java.awt (d)
(b) java.io
(c) java.util
(d) java.lang
3. What is the name of the wrapper class for the type int? (d)
(a) integer
(b) Int
(c) INT
(d) Integer
4. Classes from which of the following packages are implicitly imported into every Java program?
(a) java.util (c)
(b) java.awt
(c) java.lang
(d) java.io
5. The term wrapper classes refers to (a)
(a) a collection of Java classes that "wrap" Java primitive types
(b) the Java classes that contain at least two data fields
(c) the Java classes that contain themselves
(d) a collection of Java classes that contain other Java classes
6. What will be output caused by the execution of the following Java program segment? (c)
String name = "Elvis";
System.out.print(name + "was here");
(a) name + was here
(b) Elvis was here
(c) Elviswas here
(d) name was here
1.1.4
1. What will be output when the following Java program segment is executed? (c)
int x = 5;
int y = 2;
System.out.println(x + y);
(a) 5 2
(b) 5+2
(c) 7
(d) 52
2. A difference between the methods print and println of the class java.io.PrintWriter is that (a)
(a) println appends a new line to the end of its output, but print does not
(b) print appends a new line to the end of its output, but println does not
(c) println inserts a new line at the beginning of its output, but print does not
(d) print inserts a new line at the beginning of its output, but println does not
3. Consider the following Java program segment. (c)
int x = 5;
int y = 2;
System.out.println(x + "1" + y);
Which of the following statements is true about the program segment?
(a) The output caused by the code will be 8.
(b) The output caused by the code will be 5 1 2.
(c) The output caused by the code will be 512.
(d) The code will cause a compilation error.
1.1.5
1. All Java exception classes are derived from the class (a)
(a) java.lang.Throwable
(b) java.lang.Error
(c) java.lang.RuntimeException
(d) java.io.IOException
2. In Java, exceptions that are not handled are passed up the (b)
(a) exception ladder
(b) call stack
(c) block hierarchy
(d) catch blocks
3. What is the right way to handle abnormalities in input on Java? (d)
(a) By writing while loops to guard against bad input
(b) By always specifying the throws clause in every method header where file I/O is performed
(c) By using the class FileFilter which gracefully filters out bad input data
(d) By handling these problems by providing exception handlers
4. Consider the following Java program segment.
import java.io.*;
public class SomeClass{
public void x() {
throw new RuntimeException("Exception from x");
}
public void y(){
throw new IOException("Exception from y");
}
}
Which of the following is true concerning the definitions for the methods x and y? (a)
(a) x has a legal definition, but y has an illegal definition.
(b) x has an illegal definition, but y has a legal definition.
(c) Neither x nor y has a legal definition.
(d) Both x and y have legal definitions.
1.1.6
1. Which of the following statements is true of the conventions outlined by Sun Microsystems in
the document entitled Code Conventions for the Java Programming Language? (d)
They define a standard interface definition language that must be used for all Java classes.
They provide recommendations intended to make source code easier to read and understand.
They describe one mechanism for network communication between Java and C++ programs.
(a) III only
(b) I and III only
(c) I, II, and III
(d) II only
Feedback: See section 1.1.6, subsection "CodeConvTOC" and section 1.1, subsection "Why Have
Code Conventions," in the course notes.
2. According to the Java code conventions, files that contain Java source code have the suffix
_____, and compiled bytecode files have the suffix _____. (d)
(a) .class, .javac
(b) .javac, .class
(c) .class, .java
(d) .java, .class
Feedback: See section 1.1.6, subsection "CodeConvTOC" and section 2.1, subsection "File
Suffixes," in the course notes.
3. According to the document entitled Code Conventions for the Java Programming Language, file
suffixes used by Java software include which of the following? (b)
.obj
.class
.h
(a) I and III only
(b) II only
(c) I and II only
(d) II and III only
1.1.7
1. Which of the following patterns of characters opens a Javadoc comment block? (b)
(a) /*
(b) /**
(c) **/
(d) //
1.1.8
1. After a typical debugger encounters a breakpoint, the programmer using the debugger may
perform which of the following actions? (a)
Examine the values of variables in the halted program
Execute the current line
Resume execution of the halted program
(a) I, II, and III
(b) I and II only
(c) I only
(d) III only
2. In a typical source-code debugger, a programmer can set a _____ to cause a program to stop
executing at a particular line of code. (c)
(a) test case
(b) stack trace
(c) breakpoint
(d) print statement
3. A stack trace is (b)
(a) a list of variables allocated on a program's stack
(b) a sequence of method calls
(c) only available through a typical debugger's step into feature
(d) a fatal error that causes a typical debugger to terminate
4. A tool that allows programmers to execute lines of a program one line at a time in order to help
locate the source of a program's errors is known as a(n) (b)
(a) stack trace
(b) debugger
(c) scope
(d) exception handler
1.1.
1.According to Javadoc convention, the first sentence of each Javadoc comment should be (c)
(a) an @author tag
(b) an @version tag
(c) a summary sentence of the declared entry
(d) the order of lines is not important
Feedback: See http://java.sun.com/j2se/javadoc/writingdoccomments/index.html#format for more
information.
剩余18页未读,继续阅读
tonyeighteen
- 粉丝: 3
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
- MW全能培训汽轮机调节保安系统PPT教学课件.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0