1 学校从各班级随机抽取学生进行了一次模拟考试。以下是一张成绩表,请利用SQL文给出成绩全部合格的信息(包含学号、科目、得分) 注:合格分:60分及以上
表1:成绩一览表
学号 |
科目 |
得分 |
… |
… |
… |
002045 |
语文 |
96 |
002045 |
数学 |
62 |
002046 |
语文 |
84 |
002046 |
数学 |
99 |
003002 |
语文 |
36 |
003002 |
数学 |
67 |
… |
… |
… |
SELECT * FROM test2 HAVING (score>=60);
或
SELECT * FROM test2 WHERE score>=60;
2 简单地用HTML画出如下的页面内容:
检索日期:2018/01/01 商品对象:2 检索
日志ID |
店Code |
顾客Code |
日期 |
商品ID |
登录者ID |
1 |
300 |
3000001 |
20180101 |
2 |
A |
2 |
300 |
3000001 |
20180101 |
2 |
B |
3 |
300 |
3000002 |
20180101 |
2 |
C |
DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>tabletitle>
head>
<body>
<div>
<span>检索日期:<input type="text" value="2018/01/01" >span>
<span>商品对象:
<select name="beans">
<option value="2">2option>
<option value="3">3option>
select>
span>
<input type="button" value="检索" />
div>
<table style="border: 1px solid black;">
<tr>
<th>日志IDth>
<th>店Codeth>
<th>顾客Codeth>
<th>日期th>
<th>商品IDth>
<th>登陆者IDth>
tr>
<tr>
<td>1td>
<td>300td>
<td>300001td>
<td>20180101td>
<td>2td>
<td>Atd>
tr>
<tr>
<td>2td>
<td>300td>
<td>300001td>
<td>20180101td>
<td>2td>
<td>Btd>
tr>
<tr>
<td>3td>
<td>300td>
<td>300002td>
<td>20180101td>
<td>2td>
<td>Ctd>
tr>
table>
body>
html>
3. 从键盘录入任意两个三位数,分别为最大值和最小值,在该范围内输出一个三位数,要求该三位数每一位的数字立方加起来等于这个数本身。
public class Test {
public static void main(String[] args) {
for (int num = 100; num < 1000; num++) {
// 个位数
int a = num % 10;
// 十位数
int b = num / 10 % 10;
// 百位数
int c = num / 100 % 10;
if (Math.pow(a, 3) + Math.pow(b, 3) + Math.pow(c, 3) == num) {
System.out.println(num);
}
}
}
}
4 某钢厂在对成品钢卷进行排列并存放,假设钢卷编号分别为NO.3,NO.4,NO.5,NO.6,NO.7,NO.8,请用你熟悉的语法编写一个函数,打印出所有不同的组合排列,如:345678,876543等,要求:NO.4号钢卷不能在第3位,NO.3和NO.5号钢卷不能相邻。
public class Test {
private static String[] mustExistNumber = new String[] { "3", "4", "5", "6", "7", "8" };
private static boolean isValidNumber(String str) {
// 检查是否包含345678这五个数,不包含返回false
for (String number : mustExistNumber) {
if (str.indexOf(number) < 0)
return false;
}
// 检查4在不在第三位,是返回false
if (str.charAt(2) == '4') {
return false;
}
// 检查是否存在35在一起,有返回false
if (str.indexOf("35") >= 0 || str.indexOf("53") >= 0) {
return false;
}
return true;
}
public static void main(String[] args) {
int count=0;
for (int i = 345678; i <=876543; i++) {
if (isValidNumber(String.valueOf(i))) {
System.out.println(i);
count++;
}
}
System.out.println(count);
}
}
或
public class Test2 {
public static String [] arr = {"3","4","5","6","7","8"};
public static void print () {
int count = 0;
for (int i = 0; i <= 5; i++) {
String tr = "";
tr += arr[i];
for (int j = 0; j <= 5; j++) {
String t = tr;
if (i == j ||i+j == 2) {
continue;
}
t += arr[j];
for (int a = 0; a <= 5; a++) {
String s = t;
if (a == i||a == j||a+j == 2||a == 1) {
continue;
}
s += arr[a];
for (int b = 0; b <= 5; b++) {
String d = s;
if (b == i||b == j||a+b == 2||a == b) {
continue;
}
d += arr[b];
for (int c = 0; c <= 5; c++) {
String f = d;
if (c == i||c == j||c+b == 2||c == b||c == a) {
continue;
}
f += arr[c];
for (int v = 0; v <= 5; v++) {
String g = f;
if (v == i||v == j||v+c == 2||c == v||v == a|| v == b) {
continue;
}
g += arr[v];
System.out.println(g);
count++;
}
}
}
}
}
}
System.out.println(count);
}
public static void main(String[] args) {
print();
}
}
5 请阅读以下代码,并使用JavaScript或者Jquery实现。
5-1 请将上述代码中的第一个“li”中的文字修改成“HTML++”。
$("#li_html").html("HTML++");
5-2 请将上述代码中的第二个“li”的背景颜色设置为红色。
$(".li_css").css("background-color","red");
5-3 请将上述代码中的第四个“li”删除。
$(".li_css").next().next().remove();
5-4 请将上述代码中的第五个“li”里的文字内容添加到第二个“li”中。
var a=$(".li_css").next().next().next().html();
$(".li_css").append(a);