Code fragment a.
Code fragment b.
Code fragment c.
Code fragment d.
Code fragment e.
第1题:
A.static final int[]a={100,200};
B.static final int[]a;static{a=new int[2];a[0]=100;a[1]=200;}
C.static final int[]a=new int[2]{100,200};
D.static final int[]a;static void int(){a=new int[3];a[0]=100;a[1]=200;}
第2题:
Given the following statements:CREATE TABLE tab1 (col1 INT); CREATE TABLE tab2 (col1 INT); CREATE TRIGGER trig1 AFTER UPDATE ON tab1 REFERENCING NEW AS new1 FOR EACH ROW MODE DB2SQL INSERT INTO tab2 VALUES(new1.col1); INSERT INTO tab1 VALUES(2),(3);What is the result of the following query? SELECT count(*) FROM tab2;()
A.3
B.2
C.1
D.0
第3题:
You need to write a code segment that transfers the first 80 bytes from a stream variable named stream1 into a new byte array named byteArray.You also need to ensure that the code segment assigns the number of bytes that are transferred to an integer variable named bytesTransferred.Which code segment should you use?()
A.bytesTransferred=stream1.Read(byteArray,0,80);
B.
C.
D.
第4题:
Given the following statements: CREATE TABLE tab1 (col1 INT); CREATE TABLE tab2 (col1 INT); CREATE TRIGGER trig1 AFTER UPDATE ON tab1 REFERENCING NEW AS new1 FOR EACH ROW MODE DB2SQL INSERT INTO tab2 VALUES(new1.col1); INSERT INTO tab1 VALUES(2),(3); What is the result of the following query? SELECT count(*) FROM tab2;()
第5题:
What will be the result of attempting to compile and run the following code?() public class Q6b0c { public static void main(String args[]) { int i = 4; float f = 4.3; double d = 1.8; int c = 0; if (i == f) c++; if (((int) (f + d)) == ((int) f + (int) d)) c += 2; System.out.println(c); } }
第6题:
Whichcodefragmentswillsucceedininitializingatwo-dimensionalarraynamedtabwithasizethatwillcausetheexpressiontab[3][2]toaccessavalidelement?()
CODEFRAGMENTa:int[][]tab={{0,0,0},{0,0,0}};
CODEFRAGMENTb:inttab[][]=newint[4][];for(inti=0;i
CODEFRAGMENTc:inttab[][]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
CODEFRAGMENTd:inttab[3][2];
CODEFRAGMENTe:int[]tab[]={{0,0,0},{0,0,0},{0,0,0},{0,0,0}};
第7题:
You need to create a JSP that generates some JavaScript code to populate an array of strings used on theclient-side. Which JSP code snippet will create this array?()
第8题:
有以下程序: #include <iostream> #include <cstdlib> using namespace std; int main() { int arraysize; int *array; cout<<"Please input the size of the array:"; cin>>arraySiZe; array=new int[arraysize]; if(array==NULL) { cout<<"allocate Error\n"; exit(1); } for(int i=0;i<arraysize;i++) array[i]=i*i; int j; cout<<"which element you want to check:"; cin>>j; cout<<array[j]<<end1; return 0; } 执行程序输入:10<空格>5,则输出结果为( )。
A.allocate Error
B.1
C.0
D.25
第9题:
Which two code fragments correctly create and initialize a static array of int elements()
第10题:
Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?() CODE FRAGMENT a: public static void main(String args[]) { if (args.length != 0) System.out.println(args[args.length-1]); } CODE FRAGMENT b: public static void main(String args[]) { try { System.out.println(args[args.length]); } catch (ArrayIndexOutOfBoundsException e) {} } CODE FRAGMENT c: public static void main(String args[]) { int ix = args.length; String last = args[ix]; if (ix != 0) System.out.println(last); } CODE FRAGMENT d: public static void main(String args[]) { int ix = args.length-1; if (ix > 0) System.out.println(args[ix]); } CODE FRAGMENT e: public static void main(String args[]) { try { System.out.println(args[args.length-1]); }catch (NullPointerException e) {} }