数据库oracle笔试

1、 数据库中使用update修改多个字段值的问题

数据库oracle笔试

经我在PL/SQL环境下调试,得出如下结论(scott/tiger 下的dept表):

update dept set dname='yao', loc='shaoyang' where deptno=10; --通过

update dept set(dname, loc)=('yao','shaoyang') where deptno=10; --错误

update dept set(dname, loc)=(select dname,loc from dept where deptno=20) where deptno=10;--通过

2、程序流程问题(题目略去, 如下为我的验证代码):

public class TestCircle {

public static void main(String[] args) {

int i=2, j=9;

do{

if(i>j){

break;

}

j--;

}while(++i<5);

tln("i is: "+i+", j is: "+j);

int k = new TestCircle()Case(1);

tln("k is : "+k);

}

public int testCase(int n){

int j=1;

switch (n) {

case 1: j++;

case 2: j++;

case 3: j++;

case 4: j++;

case 5: j++;

tln("j is : "+j);

default: j++;

}

return n+j;

}

}

testCase这个问题我做错了, 题目是要求最终打印出的k为8,请你给i与n赋值。

我在考场上写的n=5, i=2; 运行得出结果却为9. 分析了一下得出原因在于: 如果n<5的话,那么它会从其自身起一直到5都会执行j++这条语句, 因为此代码片段中并没有使用 break。

n与i有多种组合值, 如(1,1)、(4,1)和(5,1)等都可以。

3、 复习 JAVA的 “内部类”章节。

4、 复习 JAVA的 “反射”章节。

5、 温习 操作系统 部分的知识。

6、 数组问题:

如我声明 int [] a = new int[1] , 那么a[0]的默认值就为0。 我起初理解错误了, 我认为如此声明只是为数组开辟了空间而已, 在其空间上默认值为NULL。

7、 关于启动 gc 的方法:

() 和 RunTime()类的 gc() 方法, 但是即使调用了前面的方法也不保证一定会进行回收。

拓展之:

a. GC并不是定期来回收你的垃圾内存,即是根据需要来回收。

b. GC的`回收是因为:它认为你的系统已经开始内存紧张(这个就是jvm的神奇)

c. 即使GC开始准备清理你的垃圾内存,但是如果该内存的引用还存在(不等于null), 这个时候GC仍然无能为力!

d、 RunTime类的 public static Runtime getRuntime() 返回: 与当前 Java 应用程序相关的 Runtime 对象。

8、 int i=10, double e = 10.0; 判断(i==e)、 (i==10.0)的真假。

我认为一个是int类型,一个是double类型,它们分属不同的类型, 所以我认为其是错误的, 然而经运行测试发现是正确的。

9、 public static void main(String[] args){

StringBuffer str1 = new StringBuffer("a");

StringBuffer str2 = new StringBuffer("b");

conver(str1, str2); }