没有合适的资源?快使用搜索试试~ 我知道了~
Java初学者的基础测试题,主要真毒与Java第十版的针对性练习
资源详情
资源评论
资源推荐
Name:_______________________
Covers Chapters 1-3
50 mins
CSCI 1301 Introduction to Programming
Armstrong Atlantic State University
Instructor: Dr. Y. Daniel Liang
I pledge by honor that I will not discuss this exam with anyone until my
instructor reviews the exam in the class.
Signed by ___________________ Date ___________________
Part I. (10 pts) Show the output of the following code: (write the output
next to each println statement if the println statement is executed in
the program).
public class Test {
public static void main(String[] args) {
System.out.println((int)(Math.random()));
System.out.println(Math.pow(2, 3));
System.out.println(34 % 7);
System.out.println(3 + 4 * 2 > 2 * 9);
int number = 4;
if (number % 3 == 0)
System.out.println(3 * number);
System.out.println(4 * number);
int x = 943;
System.out.println(x / 100);
System.out.println(x % 100);
System.out.println(x + " is " + ((x % 2 == 0) ? "even" : "odd"));
int y = -1;
y++;
System.out.println(y);
}
}
Part II:
1. (10 pts) Write a program that prompts the user to enter the
exchange rate from currency US dollars to Chinese RMB.
Prompt the user to enter 0 to convert from US dollars to
Chinese RMB and 1 vice versa. Prompt the user to enter the
1
大头小不点儿
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0