- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
面向对象编程基础习题和答案
面向对象编程基础习题及答案
Choice Questions (1pt for each question).
To add a to b and store result in b, you write (Note: Java is case-sensitive)
A. b += a;
B. a = b + a;
C. b = A + b;
D. a += b;
To declare a constant PI, you write
A. final static PI = 3.14159;
B. final float PI = 3.14159;
C. static double PI = 3.14159;
D. final double PI = 3.14159;
To improve readability and maintainability, you should declare _________ instead of using literal values such as 3.14159.
A. variables
B. methods
C. constants
D. classes
To declare an int variable x with initial value 200, you write
A. int x = 200L;
B. int x = 200l;
C. int x = 200;
D. int x = 200.0;
To assign a double variable d to an int variable x, you write
A. x = (long)d
B. x = (int)d;
C. x = d;
D. x = (float)d;
In Java, the word true is ________.
A. a Java keyword
B. a Boolean literal
C. same as value 1
D. same as value 0
Which of the Boolean expressions below has incorrect syntax?
A. (true) (3 4)
B. !(x 0) (x 0)
C. (x 0) || (x 0)
D. (x != 0) || (x = 0)
Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
A. 1 x 100 x 0
B. ((x 100) (x 1)) || (x 0)
C. ((x 100) (x 1)) (x 0)
D. (1 x 100) || (x 0)
Which of the following is the correct expression of character a?
A. a
B. a
C. \000a
D. None of the above.
Which of the following statement prints smith\exam1\test.txt?
A. System.out.println(smith\exam1\test.txt);
B. System.out.println(smith\\exam1\\test.txt);
C. System.out.println(smith\exam1\test.txt);
D. System.out.println(smith\exam1\test.txt);
Suppose i is an int type variable. Which of the following statements display the character whose Unicode is stored in variable i?
A. System.out.println(i);
B. System.out.println((char)i);
C. System.out.println((int)i);
D. System.out.println(i + );
The Unicode of a is 97. What is the Unicode for c?
A. 96
B. 97
C. 98
D. 99
Which of the following is a constant, according to Java naming
您可能关注的文档
最近下载
- 迈富时 上市招股说明书.pdf VIP
- 年产3500吨对羟基苯甲酸乙酯(食品添加剂)项目可行性研究报告.docx VIP
- HMMT_-_哈佛-MIT数学竞赛题.pdf
- 资金平衡表.doc VIP
- 小学生四年级上册暑假练字电子字帖生字写字表提前学习练习楷书字帖pdf可打印文件.pdf VIP
- 氢氟酸安全标签.doc VIP
- 2025年全国统一高考生物试卷(江西卷)含答案 .pdf VIP
- 《义务教育数学课程标准(2022年版)》【试题】题库及答案汇总.docx VIP
- 八年级上册历史《中华民族的抗日战争》单元作业设计 (优质案例50页) .pdf VIP
- 商务日语函电第2课 支払い遅延の依頼と回答.ppt VIP
文档评论(0)